Virtualbox Raw Disk Access
In this tutorial I am going to show you how to change the permissions of a /dev/sdx file to allow you to create a vmdk to boot a Windows installation on another HDD. In this tutorial I am going to use ferb as the user.
NOTE: I have not tried this tutorial with a processor that does not support VT-x/AMD-V. Check your bios to make sure that this is enabled.
Raw disk access is for expert users only. Incorrect usage can lead to massive data loss. Never mount a drive that is being accessed by a virtual machine. Doing so WILL cause unrecoverable data corruption.
As always make sure that you have done backups first.
The first step is to figure out which device contains the Windows install. Run the following command
My Windows install is located at /dev/sdc. The next thing we need to do is to give your user read/write access to this file. Use the following code to see the current permissions of the file.
ls -l /dev/sdc
brw-rw---- 1 root disk 8, 32 Nov 9 03:06 /dev/sdc
We can see here that the user root has ownership of the file and the group is disk. Both users have rw permissions on the file. So in order to give your user rw permissions to the file you must add your user to the group disk. Use the following code.
usermod -a -G disk ferb
In order for this to take work you must either reboot or log out after running the above command.
Now that your user has the correct permissions we can continue with the real tutorial. In order to make the vmdk we must use the tool VBoxManage. Run the following command.
VBoxManage internalcommands createrawvmdk -filename /home/ferb/windows_vm/windows.vmdk -rawdisk /dev/sdc
Now that we have a vmdk file for a rawdisk we need to set up the virtual machine. This is much more user friendly because it has a GUI.
Launch Virtual Box. You should see this:
Now click on the icon that says new. You should see this:
Now name your virtual machine and select the type and version:
Click the next button and set the memory. I used 8GB becasue I have 16GB of ram. You will want to set it somewhere in the green space:
Click the next buttona and browse to your vmdk file:
Click create and you should see something like this:
Click on settings:
Click on System:
Click on acceleration and make sure the following are checked:
To change the numbe or processors click on processor:
If your Windows is installed on an SSD click on storage:
Next click on your vmdk and select the use as SSD box:
Then click ok and click on start. My Windows is encrypted with both AES and twofish so I see this screen. (I’ll post a tutorial on Windows full system encryption at a later time):
As you can see the virtual machine has the amount of ram and processors that you specified in the settings. The virtual machine however does not have Aero running. You must install guest additions to use Aero.
Click on Devices at the top of the virtualbox window and click on install guest additions. If it asks you to download the image say yes. Once it has finished downloading click mount. It should come up in Autoplay:
Click on run:
Click next and check the direct3D box:
Then click OK then click install. When you see the following image check the box and click install:
Now it should start installing:
When you see the following screen click finish:
After rebooting you should be able to enable Aero. As always you can ask questions by emailing me at email@example.com or by twitter @ferbylikethetoy.