This page was exported from phaq [ http://phaq.phunsites.net ]
Export date: Sat Apr 20 3:16:00 2024 / +0000 GMT
Here's a follow-up to my previous posts on sharing Windows 7 in BootCamp and VirtualBox and launching a VirtualBox VM directly through an icon shortcut.

Concerning this topic I was asked if it's possible to have the BootCamp partition only umounted upon startup of the Windows VM.

My original post referred to creating the file /etc/rc.local (or just editing it, if it already existed) and adding these commands in there:


# grant VirtualBox permissions to Boot Camp partition
#
sudo chmod 777 /dev/disk0s3
diskutil umount /Volumes/BOOTCAMP


The method described basically causes the system to grant permissions for raw partition access and permanently umount the BootCamp partition during bootup.
If you however want the BootCamp partition only umounted upon startup of the Windows VM then please proceed as outlined below.

First of all, edit your /etc/rc.local to just include these lines:


# grant VirtualBox permissions to Boot Camp partition
#
sudo chmod 777 /dev/disk0s3


This will cause the permission to be properly set upon boot of OS X, which is still required. The partition however will not be umounted and thus appear on your Finder as usual.

Now, assuming that you implemented the application shortcut method, you need to change the application launcher like this from your Terminal:


cd "VirtualBox VMs/Win7onMBP"

cat > "Windows 7.app/Contents/MacOS/startvm" << EOF
#!/bin/sh
diskutil umount /Volumes/BOOTCAMP
[ ! -d /Volumes/Bootcamp ] && /usr/bin/VBoxManage startvm Win7onMBP
EOF


This will try to umount the BootCamp partition automatically when you click the icon.
However, I've added an additional safety switch in there: I'm checking if the BootCamp partition is still mounted at /Volumes/BOOTCAMP. VirtualBox will only start if the BootCamp partition is not mounted. This will help in preventing ugly issues with partition access.
Powered by [ Universal Post Manager ] plugin. HTML saving format developed by gVectors Team www.gVectors.com