4

I have a big USB disk with 3 partitions: one for backup and two other bootable ones for installing and testing new distros. I want the backup partition automounted on boot. But I don't want the two test partitions automounted. Despite my use of "noauto" in /etc/fstab, something (gnome?) seems to be mounting them when I plug the drive it.

LABEL=mybook            /srv/backup     ext4    defaults        0       2
LABEL=mybook-root       /media/mybook-root ext4    user,noauto  0       2
LABEL=mybook-spare      /media/mybook-spare ext4   user,noauto  0       2

In previous Ubuntu distributions it seems that it was possible to configure gnome so it would avoid mounting particular partitions on removable drives like USB:

gnome-mount --write-settings --mount-options noauto --device /dev/sda1

This is no longer available in Lucid (when did it go away?)

Is there another way to do this now?

4
  • From Oct 24, 2009 gnome use nautilus instead of gnome-mount to provide the automounting feature, see /usr/share/doc/nautilus/changelog.Debian.gz.
    – enzotib
    Apr 29, 2011 at 9:32
  • Thanks for that, @enzotib. But from what I've seen, nautilus doesn't provide an option to avoid automounts.
    – nealmcb
    Apr 29, 2011 at 16:53
  • @nealmbc: there is a global option in gconf-editor: /apps/nautilus/preferences/media_automount, but it is global, not per partition.
    – enzotib
    Apr 29, 2011 at 17:14
  • 1
    The noauto switch cannot work because that specifies not to mount on bootup and not on connecting the drive.
    – To Do
    Jun 5, 2012 at 13:48

3 Answers 3

3

for this purpose I'm using the following line in /etc/fstab and i've not done any modification in gnome... it works in ubuntu 11.04

# Prevent mounting specific partition on external hd
UUID=57f8f4bc-abf4-0000-675f-946fc0f9f25b none ext4 ro,noauto

there are two differences between my fstab and yours:

  1. I use partition UUID instead of LABEL
  2. I set 'none' as mount point

I don't know which is the difference that makes my config working, but I'd bet the second one..

(if you want to get the UUID of the partition you can use the command sudo blkid)

4
  • 2
    Interesting. Providing a nonexistent mount point surely should prevent automounting, but it also prevents convenient and consistent on-demand mounting. So I'm looking for something that still lets me mount it based on fstab info.
    – nealmcb
    Apr 29, 2011 at 15:45
  • It works fine for me. I'm doing mount LABEL=BACKUP /media/BACKUP in a script, and I have this: LABEL=BACKUP none ext4 ro,noauto in my /etc/fstab. It is ignoring the "none", and "ro" in the fstab, because the mount command above works, and it is mounted "rw".
    – dgrant
    Dec 27, 2014 at 8:14
  • Alternatively you can equally get the uuid for a current specific mount (mount | grep ^/dev to get an overview) then without sudo by ls /dev/disk/by-uuid/
    – Frank N
    Feb 25, 2017 at 7:38
  • The mount point set to none causes udisk2 to interpret it as a swap partition. This breaks manual mount using udiskctl mount --block-device /dev/disk/by-uuid/....
    – Lucas
    Apr 20, 2018 at 12:56
1

gnome-mount was replaced at some point by gvfs-mount, and the use case described in the original question seems to no longer be supported in gnome.

So here is a workaround, following on the experience described by @clemmy. It involves simply listing a nonexistent directory as the mount point for partitions you don't wan't to be automatically mounted. E.g. in this case, it would work to simply delete the relevant directories listed in the fstab, e.g. "/media/mybook-spare". Unfortunately, when the user does want to mount that partition, it of course requires that the user re-create the directory (or edit the fstab).

1
  • This is part of the disastrous status quo created by RedHat/Gnome which we are forced to deal with. Year of Linux Desktop? With RedHat around, never gonna be.
    – Pa_
    Dec 17, 2017 at 12:19
0

1) Start up your respective partition manager depending on the desktop enviroment installed: Gparted for gnome or KDE Partition Manager for kde

2) Under devices select the flash drive that you want to modify

3) Right-click on the flash partition that you don't want to auto-mount, and set it with "hidden" flag property

1
  • I can't get gparted to mark it hidden (using precise). I can toggle e.g. the "boot" flag fine, but clicking on the "hidden" flag just spins for a few seconds and leaves it unchecked. It also seems based on this article that this won't allow me to mount it without unhiding it, so it doesn't match what we could do before: Hidden partitions tips - JustLinux Forums
    – nealmcb
    May 21, 2012 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .