To mount a physical hard disk onto a VirtualBox guest, we need to first create a VMDK configuration file which points to the physical disk, and then attach this VMDK file to the VirtualBox guest.
VirtualBox running on Linux:
VBoxManage internalcommands createrawvmdk -filename ~/sdd.vmdk -rawdisk /dev/sdd
Now attach ~/sdd.vmdk to your guest as normal
VirtualBox running on Windows:
VBoxManage internalcommands createrawvmdk -filename c:\PhysicalDrive0.vmdk -rawdisk \ \ . \PhysicalDrive0
“\ \ . \PhysicalDrive0″ Is the DeviceID as seen by Windows, it can be found from the command:
wmic diskdrive list brief
Now attach c:\PhysicalDrive0.vmdk to your guest as normal
Mounting a disk image (made with dd):
Create a .vmdk config file as above. Use any attached hard disk. Even one in use. Then tweak it to point to your dd image file.
The .vmdk config file is a simple text file. Here’s my tweaked version with some comments.
# Disk DescriptorFile ##MYC## So the only things I actually changed were the CID, the number of sectors and the file location ##MYC## Then I commented out the original uuid lines ##MYC## CID must be different for each device mounted version=1 CID=6efb06b0 parentCID=ffffffff createType="fullDevice" # Extent description ##MYC## This number is the number of 512 byte sectors. The dd image filesize_in_bytes / 512 RW 625142528 FLAT "/3tb/ryph-newpc-images/eden-pc-final.dd" 0 # The disk Data Base #DDB ddb.virtualHWVersion = "4" ddb.adapterType="ide" ##MYC## Apparently the geometry parameters don't matter if the disk is greater than 8GB. Just leave them as they were ddb.geometry.cylinders="16383" ddb.geometry.heads="16" ddb.geometry.sectors="63" ##MYC## I commented out the uuid params. But I think they will get created again when you attach it ##MYC## ddb.uuid.image="6b29d83e-c656-40cf-919d-f8b2219761d2" ##MYC## ddb.uuid.parent="00000000-0000-0000-0000-000000000000" ##MYC## ddb.uuid.modification="5b4f167c-9bab-4e6a-935a-9dcf2ee9bc20" ##MYC## ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000" ddb.geometry.biosCylinders="1024" ddb.geometry.biosHeads="255" ddb.geometry.biosSectors="63"
Leave a Reply