Proxmox import ova ovf qcow2 disk into VM

Posted by & filed under Virtualization.

  • Create new VM
  • Note the VM ID
  • If you have a .ova or .ovf file, you simply need to do the following to extract the vmdk:
  • tar -xvf *.ova
  • Import the disk into the vmid of the new vm
  • qm importdisk targetvmid disk001.vmdk local -format qcow2


    qm importdisk targetvmid disk001.vmdk local-lvm -format qcow2

    Depending on the storage you have setup.

  • It’s also worth noting that at least on my particular homelab setup, running the qm importdisk command brought the server to it’s knees until the import completes.

PowerCLI – Get a VM’s Disks

Posted by & filed under Virtualization, VMWare.

PowerCLI snippets to get a VM’s disks

This command will retrieve the specified VM’s attached disk paths:

Get-HardDisk -VM Guest-VM-Name-Here

But we can also focus on the filename:

PowerCLI C:\> Get-HardDisk -VM VM-core | Select-Object Parent,Name,Filename

[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core_16.vmdk
[EMC_Tier2_NotReplicated_VMFS11] VM-core/VM-core_7.vmdk
[EMC2_Tier2_Replicated_VMFS3] VM-core/VM-core_14.vmdk
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core_2.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_5.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_1.vmdk
[EMC_Tier2_Replicated_VMFS2] VM-core/VM-core_17.vmdk
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core_1.vmdk
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_10.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_3.vmdk
[EMC2_Tier2_Replicated_VMFS3] VM-core/VM-core.vmdk

We can also see the other columns available:

PowerCLI C:\> Get-HardDisk -VM VM-core | Get-Member

   TypeName: VMware.VimAutomation.ViCore.Impl.V1.VirtualDevice.FlatHardDiskImpl

Name             MemberType Definition
----             ---------- ----------
ConvertToVersion Method     T VersionedObjectInterop.ConvertToVersion[T]()
Equals           Method     bool Equals(System.Object obj)
GetHashCode      Method     int GetHashCode()
GetType          Method     type GetType()
IsConvertableTo  Method     bool VersionedObjectInterop.IsConvertableTo(type type)
LockUpdates      Method     void ExtensionData.LockUpdates()
ToString         Method     string ToString()
UnlockUpdates    Method     void ExtensionData.UnlockUpdates()
CapacityGB       Property   decimal CapacityGB {get;}
CapacityKB       Property   long CapacityKB {get;}
Client           Property   VMware.VimAutomation.ViCore.Interop.V1.VIAutomation Client {get;}
ConnectionState  Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.ConnectInfo ConnectionState {get;}
DiskType         Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.DiskType DiskType {get;}
ExtensionData    Property   System.Object ExtensionData {get;}
Filename         Property   string Filename {get;}
Id               Property   string Id {get;}
Name             Property   string Name {get;}
Parent           Property   VMware.VimAutomation.Sdk.Types.V1.VIObject Parent {get;}
ParentId         Property   string ParentId {get;}
Persistence      Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.PersistencePolicy Persistence {get;}
StorageFormat    Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.VirtualDiskStorageFormat StorageFormat {get;}
Uid              Property   string Uid {get;}

We could also do something like get the Disk paths for all guests:

PowerCLI C:\> Get-VM -Location $datacenter | ForEach-Object {Get-HardDisk -VM $_.Name | Select-Object Parent,Name,Filename}

Parent                                                                          Name                                                                            Filename
------                                                                          ----                                                                            --------
REDACTEDADCSVR01                                                                    Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTEDADCSVR01/disk0-000001.vmdk
REDACTEDUTLSVR                                                                      Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTEDUTLSVR/disk0-000001.vmdk
RP-BATCHMASTER2                                                                 Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] RP-BATCHMASTER2/disk0-000001.vmdk
RP-TS02                                                                         Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS1] REDACTED/disk0-000001.vmdk
REDACTEDFMSVR01                                                                     Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTEDFMSVR01/disk0-000001.vmdk
REDACTEDSVR01                                                                    Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTED/disk0-000001.vmdk
REDACTEDSVR01                                                                    Hard disk 2                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTED/disk1-000001.vmdk