I ran through the variations of "VBoxManage internalcommands createrawvmdk" that are listed in the manual. If I use my root account, I have no troubles creating a "raw disk" VMDK. It lets me create one for the whole disk (do NOT want!) as well as create one for just a single partition, with or without the -relative option, it all seems good.
However, once I create those VMDKs, I can't add them as storage to any of my VirtualBox VMs, whether I am running a user or as root. Both the GUI and `VboxManage storageattach` give me an error that says "Failed to open the hard disk [...]/RawSDA4.vmdk. The medium [...]/RawSDA4.vmdk can't be used as the requested device type." I've tried attaching to IDE, SATA and even added a SCSI, I just can't seem to load up a raw disk VMDK.
So, what's the deal? Is this a bug in VirtualBox? Here are some of my system details, and step-by-step to reproduce the issue:
The last command I used to generate the raw disk VMDK:# fdisk -l
Disk /dev/sda: 250.1 GB, 250059350016 bytes
...
Disk identifier: 0x08aa2b1d
Device Boot Start End Blocks Id System
/dev/sda1 2048 16771071 8384512 82 Linux swap / Solaris
/dev/sda2 * 16771072 121628671 52428800 83 Linux <-- HOST OS
/dev/sda3 121628672 226484223 52427776 7 HPFS/NTFS/exFAT
/dev/sda4 226484224 488397167 130956472 7 HPFS/NTFS/exFAT <-- Target for Raw Disk Access (not mounted by Host OS)
When using the -partitions flag, I notice that two files are created: RawSDA4.vmdk and RawSDA4-pt.vmdk. I chown both of those to my own user account, since I ran the command as root. Next I'll borrow another command line from the manual to attach the storage to my VM:Command (as root):
# VBoxManage internalcommands createrawvmdk -filename "/home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk" -rawdisk /dev/sda -partitions 4
Output:
RAW host disk access VMDK file /home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk created successfully.
I know raw disk access is for experts, and I really do know what I'm doing here (I've used raw partition access in VMWare for years) but I think I've hit a bug in either documentation or VirtualBox itself.Command (as user):
~ VBoxManage storageattach "Windows 7" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /home/bkirsch/VirtualBox/Windows\ 7/RawSDA4.vmdk
Output:
VBoxManage: error: The medium '/home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk' can't be used as the requested device type
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Medium, interface IMedium, callee nsISupports
Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 210 of file VBoxManageDisk.cpp
VBoxManage: error: Invalid UUID or filename "/home/bkirsch/VirtualBox/Windows 7/RawSDA4.vmdk"
Thanks in advance for any advice you can give me.