LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Turn off Automatic Mounting of FAT32 and NTFS partitions (https://www.linuxquestions.org/questions/linux-newbie-8/turn-off-automatic-mounting-of-fat32-and-ntfs-partitions-4175448469/)

sysbox 02-03-2013 10:15 AM

Turn off Automatic Mounting of FAT32 and NTFS partitions
 
I have an external USB hard drive with several partitions: ext3, FAT32, NTFS. Whenever I plug this drive into my CentOS machine (running Gnome), it automatically mounts the FAT32 and NTFS partitions. I don't want that to happen. How can I configure it to not automatically mounts the FAT32 and NTFS partitions.

ps. It doesn't automatically mount the ext3 partition because I used e2label to label the partition and set it to 'noauto in /etc/fstab.

Philip Lacroix 02-03-2013 03:31 PM

I'm not a Gnome3 user and I installed it just to try, so I might be wrong, but I can't see anything, in the "System settings", to configure the behaviour of removable drives. I also looked in the Nautilus settings and it's the same (while Xfce's Thunar, for example, has a fine-tuning section in its preferences manager).

I would personally edit fstab (first making a copy of it) adding explicit entries for the partitions you'd like to leave unmounted. If you want to try this, first you'll need to get the UUID (universally unique identifier) of each partition and append it to fstab, using blkid (as root). For example, for an hypotetical /dev/sdc1 partition, type:

Code:

blkid /dev/sdc1 >> /etc/fstab
Pay attention to type >> and not > (otherwise you'll overwrite fstab instead of appending to it). Open fstab and you'll see something like this at the end of the file:

Code:

/dev/sdc1: UUID="D34TG678RGRT564" type="ntfs"
Now, clean the line a little bit, leaving the partition's UUID only, without "" :

Code:

UUID=D34TG678RGRT564
Then complete the line adding a valid mount point for the partition, the filesystem type ("vfat" for FAT, "ntfs-3g" for NTFS), the "defaults", "user" and "noauto" options (the latter will prevent the partition from being automatically mounted) separated by comma with no spaces. Finally, set the dump and pass options to 0. The result will be like the following:

Code:

UUID=D34TG678RGRT564 /home/user/mnt ntfs-3g defaults,user,noauto 0 0
The line will affect that partition only, thanks to the UUID. You'll have to do the same work for the other partitions you want to control through fstab.

Regards,
Philip

John VV 02-03-2013 04:04 PM

CentOS 6.3 uses Gnome 2

but the above will work

sysbox 02-03-2013 04:38 PM

Thanks! That worked.

Philip Lacroix 02-03-2013 05:34 PM

Glad it did!


All times are GMT -5. The time now is 12:10 AM.