Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Unmounting Disk Partition at Startup

I have created a partition that I use for emergency startup and to run diagnostics and maintenance utilities for my main HD. I named this partition "Utility HD". Does anyone know how to make this "Utility HD" unmount automatically when startup is complete? I tried writing a script (Applescript), but couldn't find an "unmount" command. Currently, I manually unmount the Utility HD after startup to keep it safe and uncorrupted.

eMac G4 Mac OS X (10.4.5)

Posted on Feb 17, 2006 1:49 PM

Reply
10 replies

Feb 18, 2006 4:06 AM in response to Allen Rubin

You should be able to do this, the command you need is actually "Eject Disk" which works on both disks and volumes.

If you use Automator you can simply select the "Eject Disk" command and enter the name "Utility HD" in to the command then save it as an application.

If you put this in your startup items it should do the job.

Feb 18, 2006 11:59 PM in response to Community User

normnod,

I must be doing something wrong......
I created an Automator workflow as you suggested, saved it as an application, put it in my startup items, but nothing happens. The Utility HD stays mounted,
Even when I run the workflow directly, nothing happens....
I wonder what I'm doing wrong?? The workflow has only two steps..Get the specified finder item (Utility HD) and Eject Disk. But nothing happens when I run the workflow....?????

Al

Feb 19, 2006 11:47 AM in response to Allen Rubin

Hi Allen,

I tried applescripts to disable a backup partition at startup but they were hard to set up for multiple users and were slow.

I have come up with something that does just what I want. It works at startup and affects all users. It is invisible and reversible, but it takes a some work to set up the first time. It assumes you are comfortable with unix. Be careful and use at you own risk, blah, blah, blah. This should not be tried by novices.

Create two text files. The first is named StartupParameters.plist and the second is unmountBackupDrives.

Copy and paste the text between the dashed lines in StartupParameters.plist:
-------------------------------------------------
{
Description = "unmountBackupDrives";
Provides = ("unmountBackupDrives");
}
-------------------------------------------------

Copy and paste the text between the dashed lines in unmountBackupDrives:
-------------------------------------------------
#!/bin/sh

. /etc/rc.common

StartService ()
{
echo "unmounting backup disks if present"

# repeat the following block for each drive/partition to unmount
drive=iMac\ backup
if [ -d "/Volumes/${drive}" ]
then hdiutil unmount "/Volumes/${drive}" -force
fi

drive=G5\ backup
if [ -d "/Volumes/${drive}" ]
then hdiutil unmount "/Volumes/${drive}" -force
fi
}

StopService ()
{
return 0;
}

RestartService ()
{
return 0;
}

RunService "$1"
-------------------------------------------------

In the above script you need to update the lines with "drive=" with names from your system. Note that the backslash is used to precede spaces in the drive name. If you only want to hide one drive or partition then you don't want the second block of code. You can add more blocks to hide other drives.

The rest of the work is done from the terminal:

Go to where the two text files are located and make the script executable:
chmod 755 unmountBackupDrives

Create a place to put your two files where they can be found by OS X:
sudo mkdir /Library/StartupItems/unmountBackupDrives

Move your two new files to this directory:
sudo mv StartupParameters.plist unmountBackupDrives /Library/StartupItems/unmountBackupDrives

When you shutdown and boot up next, your backup drives will be first automounted by the system and then unmounted by your new script. When you want them mounted, go to disk utility and you will see them greyed-out. You can manually mount them and they will be ready to go.

-Steve

Feb 20, 2006 5:41 AM in response to Allen Rubin

Weird, I can do it here - you should be able to select the input fields in there...........I don't know what else to suggest if it won't do it, sorry.

Feb 21, 2006 8:58 PM in response to Allen Rubin

Steve and normnod..........Problem Solved !!

I couldn't get Automator to work, and I'm too chicken to mess with the terminal. However, while browsing Mac OS X Hints, I found the following simple solution.....and it WORKS!

1) First, you have to get the Platypus application. It can be found here:
http://www.macupdate.com/info.php/id/12046

2) Download and launch Platypus (it's free).

3) Click on "New" underneath the script path area. Paste the following text (change "Utility\ HD" to the name of the disk or volume you want to unmount at startup). Note that any spaces in the volume/disk name must be preceded by a \ .

********************************************************************

#!/bin/sh

diskutil unmount /Volumes/Utility\ HD
exit

*********************************************************************

4) Click "Save" and then input your App Name in the space provided ( I used UnmountUtilityHD).

5) Then click "Create" and select wherever you want to save the App. (You may have to re-enter the App Name). Click "Create " again.

6) Finally, add your new app to the login items in the Accounts prefpane, and restart.

THAT'S IT...........

Unmounting Disk Partition at Startup

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.