Whenever I insert a flash drive, a new Nautilus window opens showing its contents. Is there a way to deactivate "auto-open" option for a specific USB unit?
Dash Home > System Settings -> Removable Media and check "Never prompt or start programs on media insertion"
Figure out its uuid:
Let's start with the current id (not yet uuid)
mount | grep ^/dev
You should somewhere should recognize its actual name here,
/dev/sda4... /dev/sda5 on /boot ... /dev/sdc1 on /media/frank/FancyBackupDrive FX1... <-- assume, its this /dev/sdc2 on /media/frank/some other Drive ...
Now, say, it's sdc1. Let's figure out its truly unique uuid:
$> ll /dev/disk/by-uuid/ | grep sdc1
Should get you a fairly long string (often hex, sometimes with dashes) that symbolically links somewhere (well, to above
lrwxrwxrwx [...] 366A2F886A2F003A -> ../../sdc1
/etc/fstab to never mount
Backup before sounds like a good idea to me.
sudo cp /etc/fstab /etc/fstab.bak
Then open for edit (i.e.
sudo pluma /etc/fstab), enter this to the file (the comment is optional, your uuid and file system may differ)
# Auto-Mount prevents UUID=366A2F446A2F006B none ntfs ro,noauto
Works for me, with an external, two-partition drive!
If you do develop a desire to use that drive:
directory must pre-exist, not taken care of. so generate it (only once, ever):
sudo mkdir /media/myFx
And here we go
mount /dev/disk/by-uuid/366A2F886A2F003A /media/myFX
sudo umount /dev/disk/by-uuid/366A2F886A2F003A
Depending on your specifics, your mount resp. your fstab entry might need additional parameters with your preferred user rights, a ‘rare’ drive format and all that stuff:
sudo mount -t ntfs -o umask=007,gid=046,uid=0,nls=utf8 /dev/disk/by-uuid/366A2F886A2F003A /media/myFX
These times the unity/gnome-based desktop environments have the
gnome-disks utility which you can use for this specific purpose.
Just select your device in the column on the left, then select the partition you don't want to mount (one might expect only one on a common USB disk) and click below the partition bar. Then select
Edit Mount Options... and set there whatever you want. I suppose you are looking for disabling the
Mount at startup option (which is a default on Ubuntu 16.04, but still e.g. not on CentOS 7).
OK you'll be prompted for sudo password and the results will get written into
/etc/fstab where you can see what actually happened.