Manage the Partition Auto Mounting on macOS
Some partitions on your drive are simply not needed for certain work. While PnP is probably one of the most notable inventions which spread personal computing, it is also unavoidably annoying with possible security risks at the same time.
So here’s a drill. We want to make certain partitions either not to mount at all, or mount with Read-Only permission. This will take more than one command in Terminal, so take your time to double check your commands.
- Replace the bracketed part with the name of the drive you are interested and run the command. You are looking for “Volume UUID”, so make sure to copy the address.
diskutil info /Volumes/[Drive Name]
- While we are at it, check for file system of the partition. It is displayed as “Type”, underneath the “File System Personality.”
- Run the following command, and it will open up an editor.
sudo pico /etc/fstab
- Replace the first bracketed part with the copied address and the second with the file system abbreviation per system. And copy one of the following script and add it as a line.
Filesystem abbreviations: HFS = hfs, NTFS = ntfs, FAT32 = msdos
Will not mount automatically: UUID=[Volume UUID] none [filesystem] rw,noauto
Will mount, but Read-Only: UUID=[Volume UUID] none ro
- Deleting the added lines will reverse any changes you have made.
Let me know if there is any issue.