12

..and what are the consequences of the different methods?

I have been trying some things with the mounting of an sda2 partition. Mounting in fstab, not mounting in fstab but from the file manager.

So far, if I am right, I learned that by mounting in fstab, a partition is mounted automatically at startup. But this mounted partition is not shown under 'devices' in the file manager, whereas the root partition and cdrom for example are shown.

When you want to have it under devices in the sidebar, a partition should not be mounted in fstab but by clicking it in the file manager. Is that correct?

But which way to go if you want both? Automatically mounted at startup AND being shown in the sidebar of file manager?

  • 1
    Which file manager and which OS? For me, on Ubuntu, Debian and Arch (all Linux distros), with Nautilus, Nemo, Thunar and the Enlightenment file manager, a drive mounted using fstab is still shown as a device in these file managers. – muru Nov 23 '14 at 18:56
  • I use mint 13 xfce. With thunar as standard file manager. My fstab mounted partitions are not shown under devices... – DutchArjo Nov 23 '14 at 18:58
  • Might be a bug. On Ubuntu 14.04, Thunar 1.6.3: imgur.com/jnwmuzO – muru Nov 23 '14 at 19:06
  • @don_crissti: oke, that confirms my thoughts something with the installation is wrong. And perhaps that causes all my other issues with this installation. Cause I have tried all the suggestions that were made but still it was not working as it supposed to be. – DutchArjo Nov 23 '14 at 19:13
  • 1
    I'm with @DutchArjo on this one. I have /var/www as a separate partition (among others) in /etc/fstab - it doesn't show up under "Devices". If I comment it out in /etc/fstab and then unmount it then it does show up (after restarting the file-manager). If it's in /etc/fstab it doesn't show under "Devices"; if I comment it out, it reappears. That's on Fedora 21 with Gnome Files, thunar and nemo. – garethTheRed Nov 23 '14 at 19:36
11

This is documented (at least for gnome-shell/nautilus) in gvfs-udisks2-volume-monitor:

The gvfs-udisks2-volume-monitor process is responsible for the disks,
media, mounts and fstab entries shown in the desktop user interface.
..........................................
A device is either mounted (in which case its directory is known) or
it's not. If the device is not mounted, then its directory is known
only if it's referenced in the /etc/fstab file.

Further down comes the explanation:

If the directory for a device is known and outside /media, $HOME
(typically /home/foo) or /run/media/$USER then the device is not shown
in the user interface. Additionally, if any of component directories
in its directory starts with a dot ("."), the device is not shown
either. This policy may be overriden by use of the options x-gvfs-show
and x-gvfs-hide.

To sum up:

Partitions listed in /etc/fstab would (by default) only show up if they're mounted under /media, $HOME or /run/media/$USER. If you want a partition to be automatically mounted at system startup and also listed in the file manager sidebar, the easiest way is to mount it via /etc/fstab under one of those three locations.
If you want the partition to be mounted under a different directory (e.g. /mnt) and still be shown in the sidebar, you can override the default behaviour by adding x-gvfs-show to your mount options in fstab:

UUID=5a1615ca-cffd3124917a /mnt/storage ext4 rw,noatime,discard,x-gvfs-show 0 2

Partitions not listed in /etc/fstab are handled by udisks2 and will be mounted under /run/media/$USER/VolumeName or /media/VolumeName depending on the value of UDISKS_FILESYSTEM_SHARED1 hence they will be shown under Devices in the sidebar. However, they are not automatically mounted. A user could automatically mount them at session startup with udisksctl, e.g. adding:

udisksctl mount -b /dev/sdb2 -t ext4

to the session startup scripts.


1
man udisks:

UDISKS_FILESYSTEM_SHARED
   If set to 1, the filesystem on the device will be mounted in a shared directory e.g. /media/VolumeName)
   instead of a private directory (e.g. /run/media/$USER/VolumeName) when the Filesystem.Mount() method is handled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.