I am replacing my internal HDD with an SSD. I am going to mount the older 1TB HDD on a HDD Caddy in my laptop. However that will only be used for time machine backups and long term storage of files. Is there a way to mount the drive only on request. I think that would save energy as well as prolong the drive's life.
2 Answers
This is the method I use.
Create a file /etc/fstab with the following contents.
# fstab
#
# Identifier mount point fs type options1
#
UUID=3CA41C88-3E86-3A39-88CE-9379FF44B6A5 none hfs rw,noauto
The alphabet soup after the = sign can be found with diskutility.
Launch DiskUtility, select the volume, right click, More Information Universal ID
or on El Capitan, select the volume, then the Info button, top right, File System UUID.
FS tab needs the following ownership and permissions:
bash-3.2# ls -l /etc/fstab
-rw-r--r-- 1 root wheel 71 29 Aug 2011 /etc/fstab
To create the file try this:
sudo nano /etc/fstab
The noauto option causes it to not mount at boot. In a terminal window type man fstab for other options
Source: Ask Different - How can I tell OSX NOT to mount some of the drives in my computer?
If you only need to mount the drive occasionally, you can mount from Disk Utility. It will not re-mount at next boot, or you can unmount manually the same way.
On my old Mac Pro I having 4 HDD inside and I having a loginhook
script at launch to unmount somes drives (for the noise).
On my MacBook Pro I have a HDD on a caddy, I just let it sleeping.
Create a Shell script like
#!/bin/bash
diskutil umountDisk /Volumes/YourDriveName &
Test it
chmod +x yourloginhookscript.sh
./yourloginhookscript.sh
And install it as a LoginHook
sudo defaults write com.apple.loginwindow LoginHook "/Users/dragon/the/path/to/your/shell/script"
And next to remount your drive, on a terminal
diskutil list
diskutil mountDisk /dev/disk1
If you want to mount a network drive, I know that is not your question:
osascript -e 'mount volume \"afp://192.168.0.100/backup/\"' &>/dev/null &
You can also create a file in LaunchAgents
to start your script.