Create a image of VMDK file for existing harddisk in ubuntu linux host:
$sudo VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda
if create a image is created from a given partition of physical harddisk,
$sudo VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5
Create a image of VMDK file from a exsting harddisk in window host:
- Run cmd as adminstrator mode
- C:\> cd "Program Files\Oracle\VirtualBox"
- C:\Program Files\Oracle\VirtualBox> VBoxManage internalcommands createrawvmdk -filename "C:\xxx.vmdk" -rawdisk "\\.\PhysicalDrive1"
the "\\.\physicalDrive1" is the harddisk which the image create from.
if create a image is from a given partition of physical harddisk,
C:\Program Files\Oracle\VirtualBox> VBoxManage internalcommands createrawvmdk -filename "C:\xxx.vmdk" -rawdisk "\\.\PhysicalDrive0" -partitions 6
if need to involve more partitions at once, could add "," between two partitions number, for example, -partitions 6,5
reference from:
https://www.virtualbox.org/manual/ch09.html#idm8266