Can you make OSX mount just certain partitions when you connect an external HDD?
Yes. You'll need to create a file called "fstab" in /etc if it is not already there:
sudo nano /etc/fstab
Next, we'll need the partitions Unique Universal Identifier (UUID). Open Disk Utility, and highlight the partition you'd like to no have auto-mounted. Then hit CMD+I and you'll be greeted with the following screen (notice the UUID highlighted):
We will then need to enter the following line into our fstab file. The following example will prevent my "Shockwave" partition from auto-mounting:
UUID=27C2148B-1734-3900-B89C-FE3EB7E11DBC none hfs rw,noauto
Hit CNTRL+O to save when you're done. You can add as many as you like; one per line. Reboot and those partitions specified in fstab will not be mounted.
The UUID is the partitions unique identifier (consult the man-page below if you'd like to use device's label instead). The noauto tag tells OS X not to auto mount on load. You can still mount them using Disk Utility, but OS X won't do it for you initially.
If you'd like to learn more about fstab and what you can do with it, you can view it's respective man-page.
You can add entries in /etc/fstab
to prevent volumes from mounting. This is similar to the technique @cksum describes. Here are some example one-liners. They will create an fstab file if it doesn't exist, otherwise they will append. You need admin privileges.
-
Prevent an HFS (Mac) volume named Archive from mounting. If it is mounted manually, it will be Read/Write.
echo "LABEL=Archive none hfs rw,noauto 0 0" | sudo tee -a /etc/fstab
-
NTFS volume named BOOTCAMP. Read-only.
echo "LABEL=BOOTCAMP none ntfs ro,noauto 0 0" | sudo tee -a /etc/fstab
-
FAT32 volume named PMBPORTABLE. Read-only.
echo "LABEL=PMBPORTABLE none msdos ro,noauto 0 0" | sudo tee -a /etc/fstab