Mac – Ejecting USB-Partitions on boot – works but not entirely

bootejectmacsuperduperusb

I have an USB drive with four partitions. SuperDuper uses these partitions to back up my mac. Since SuperDuper is scheduled, I have the USB drive constantly connected. But quite frankly the noise of the USB drive is driving me nuts. So I eject the partitions every time I boot the mac up. SuperDuper is configured so that it mounts the partition when it is scheduled to back up and unmounts it again.

I am trying to find a way so that I do not have to manually eject the partitions. I have two methods that work. I edited the /etc/fstab file with the UUIDs and prevent the partitions from mounting and I tried the method of making a logon script that calls a "do shell script "diskutil unmount….."". Both methods work. The partitions do not get mounted. BUT the drive motor does not "turn off". I have to go into Disk Utility and eject the unmounted (light-gray) drive again for the USB drives motor to be quiet. It doesn't really matter which one of the four drives I choose to eject again, ejecting one does the trick.

I also noticed that if I automatically eject three of the drives on boot and then manually eject the fourth one that the USB drive powers down. So there seems to be a difference between ejecting via script and right-mouse click "eject".

Does anyone know why this is? Is there a way to eject the partitions so that the USB drive understands this?

Thanks

Best Answer

As Harald suggested the solution is to use "diskutil eject" not unmount.

For anyone else looking at this thread, my login script looks like this:

delay 5
try
   do shell script "diskutil eject \"/Volumes/MYPARTITION\""
end try

Thanks again!