Mac – Unmounting Windows (or any other) volume at startup

To umount a Macintosh volume at start-up (for example the windows bootcamp volume) you can create a startup item …

In:

/Library/StartupItems

Create a directory “Unmount”  in that directory you want to put 2 files:

Unmount

and

StartupParameters.plist

 

Unmount file is a shell script with the following contents:

#!/bin/sh
. /etc/rc.common
if [ “$1” == “start” ]
then
/usr/sbin/diskutil unmount /dev/diskXXX
fi

The /dev/diskXXX in this file you need to change.  My unmount command is actually …

/usr/sbin/diskutil unmount /dev/disk0s3

To find the correct information for your system run the command:

“diskutil  info /Volumes/Windows/”     —- or whatever the volume name is …

in the output you need to look for the “Device Node” .  Whatever it says for that Device Node is what you should put in the Unmount command in the shell script above.

 

StartupParameters.plist is a plist file that contains:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
“http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>Description</key>
<string>Try to unmount the old disk</string>
<key>Provides</key>
<array>
<string>Unmount</string>
</array>
</dict>
</plist>

 

 

After creating the files, chmod them so that they are:

-rw-r–r–     StartupParameters.plist
-rwxr-xr-x   Unmount

Also, I set the owner and group to “root” and “wheel” respectively to match the other items in the /Library/StartupItems directory … (“chown -R root /Library/StartupItems/Unmount/” and “chgrp -R wheel /Library/StartupItems/Unmount/”)

 

For additional details see:

http://hints.macworld.com/article.php?story=2005052804075538

 

This entry was posted in Articles, Labs and tagged , , . Bookmark the permalink.

Comments are closed.