For performance reasons, you may want to use a dedicated disk for your virtual machine.
This was not straightforward to do with VirtualBox on MacOS, so I decided to write it down and share it with others that may be interested.
In this example, we will use disk3 as raw device for a Windows virtual machine.
- Start by unmounting the disk you want to use:
diskutil umountDisk /dev/disk3
- Then use the Disk utility GUI to create a new ms-dos style partitioned disk with 1 partition of type MS-DOS. Label it “WINDOWS”. The partition will be mounted automatically by default.
- Use vifs to configure Mac OS to not automatically mount this partition. The partition must not be mounted when using it with VirtualBox.
LABEL=WINDOWS none msdos rw,noauto00
- Unmount the disk again
diskutil umountDisk /dev/disk3
- Create a VirtualBox storage device:
VBoxManage internalcommands createrawvmdk -filename /Users/perchrh/win7-raw.vmdk -rawdisk /dev/disk3
- Make the raw device accessible to the admin group:
sudo chown root:admin /dev/disk3*
sudo chmod 660 /dev/disk3*
- Use that disk (the vmdk-file) when creating the virtual machine in Virtualbox
That’s it!
Happy IO 🙂