So I am trying to set up raw device access w/ VirtualBox to use a ext4/linux disk as a guest OS within Mac OS X, but haven't succeeded yet.
Following the VirtualBox docs, Chapter 9.9.1.1, https://www.virtualbox.org/manual/ch09.html#rawdisk will Mac OS X allow raw disk access for VMs? How do I set this up?
Things done so far: (don't try this at home)
Created a raw vmdk file:
$ sudo VBoxManage internalcommands createrawvmdk -filename /Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk -rawdisk /dev/disk0
RAW host disk access VMDK file /Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk created successfully.
make me the owner:
$ sudo chown me /Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk
see if VirtualBox can see anything on the Xub_raw_disk.vmdk file:
$ VBoxManage internalcommands listpartitions -rawdisk /Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
Since nothing shows up here for sectors or partitions, this must be a symptom of the problem...
Problem is when I try to add the .vmdk file from the GUI or with the command below, I get an error:
$ VBoxManage storageattach "Xub_raw_testing" --storagectl "SATA" --port 0 --type hdd --medium /Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk
VBoxManage: error: Could not find file for the medium '/Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk' (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp
VBoxManage: error: Invalid UUID or filename "/Users/me/VirtualBoxVMs/Xub_raw_disk.vmdk"
UPDATE: Here, disk0 is the dedicated linux drive. disk1 (not used) is for Mac OS X. Making myself the owner of the /dev/disk0 and /dev/disk0s2 with
$ chown $USER /dev/disk0
$ chown $USER /dev/disk0s2
per the Froggard howto made it so I could add the image to a VM. Also, /dev/disk0
is now readable from VBoxManage:
$ VBoxManage internalcommands listpartitions -rawdisk /dev/disk0
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x00 0 /0 /0 0 /0 /0 976 2048
2 0x00 0 /0 /0 0 /0 /0 227959 2000896
Now, when I start the linux guest OS, I get the FATAL: No bootable medium found! System halted.
message. Any ideas what's wrong?