Search code examples
linuxbashnautilus

Hiding a mounted device in nautilus


I am running Ubuntu Precise. In my /etc/init.d I have a bash script that, does the following on startup:

  1. loop mounts an image on an NTFS drive. That image contains an ext2 file system with a directory named home

  2. It then does a mount with a --rbind option that mounts the home within the image file onto /home.

Works well so far, although having open files in /home doesn't prevent the loop mount from being unmounted.

Unfortunately, Nautilus displays the loop mount in the list of removable drives with an icon that allows a user to unmount the loop mount. Unmounting the drive on which /home is mounted is not conducive to a well running system.

How can I keep Nautilus from displaying this loop mounted device?

man udisk(7) says that one of the 'Influential device properties in the udev database' is:

UDISKS_PRESENTATION_HIDE

If set to 1 this is a hint to presentation level software that the device should not be shown to the user.

I assume that setting this property on the /dev/loop would tell Nautilus not to show the device.

How would I set the UDISKS_PRESENTATION_HIDE in a bash script?


Solution

  • Another approach is to mount the device somewhere other than under /media. I chose under /run, which allows /mnt to be used for temporary mounts.