Use the diskutil Tool Using diskutil to mount and unmount volumes is easier than using the Unix mount and umount commands. It takes care of creating. To quickly and easily access a network drive from your Mac you can configure OS X to automatically mount the volume after booting up. That way, after you turn on or restart your Mac, you will be.
![]()
I have a second disk inside my G4 desktop, but don't want users to see it when they log in. So I want to unmount it at system boot time. Here is one way; maybe someone will tell us a simpler way. An does something similar during login, but this one does it for all users during startup. Here's how:. Find out what the device name is (using Disk Utility for example). I'll assume it is /dev/disk0s5.
As root, create a directory named Unmount in /Library/StartupItems/, containing two files ( Unmount and StartupParameters.plist, as shown below). Use any name in place of Unmount, but make sure to use the same name twice.
![]()
Set protections and ownerships like this: drwxr-xr-x root wheel Unmount -rwxr-xr-x root wheel Unmount -rw-r-r- root wheel StartupParameters.plist. Reboot to see if it works!Read the rest of the hint for the two scripts.The file Unmount is a shell script (change disk0s5 to whatever your device name is): #!/bin/sh. /etc/rc.common if '$1' 'start' then /usr/sbin/diskutil unmount /dev/disk0s5 fiThe file StartupParameters.plist is a properties list:
It is not true that disk0 is always the boot disk. Mine is disk1 right now. I'm guessing that the startup code assigns numbers in some sort of hardware order: my two internal hard disks are numbered in the order that they appear on the ATA bus and the numbering was constant over many restarts. However, you are right in that we shouldn't assume anything not clearly documented. The solution is to use the mount point name, as jitterbugboy suggested. So the diskutil line in the original hint can be changed to /usr/sbin/diskutil unmount '/Volumes/Whateveritscalled'I knew there were possible solutions using fstab and similar, but fiddling with things like that will just give trouble at the next OS upgrade.Brendan. My setup is this: 3 Devices (1 Firewire, 2 SCSI), the Firewire device has only one volume, and each SCSI device has 3 volumes each.I would like to unmount one volume from each SCSI device at login.
I will create a Platypus App to execute a simple SH script. Then I will add this App to my Login Items in the Accounts PrefPane in System Preferences.Here is Platypus' link:and install Platypus (its free).Launch Platypus.Input your App Name (I used UnmountVolumesLogIn), then click on 'New' underneath the script path area. Paste the following text (change MyVolume1):############!/bin/shdiskutil unmount /Volumes/MyVolume1exit###########Then click 'Save'Then click 'Create' and save the App to wherever you desire.Then add your new app to the login items in the accounts prefpane, and restart.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |