Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 296
Wes Avatar asked Jun 18 '12 23:06

Wes


1 Answers

The answer should now be updated (at least for Ubuntu 12.10). You don't have to write this anymore (as was originally written in the other answer):

KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sdb2", ENV{UDISKS_PRESENTATION_HIDE}="1"

Instead, you should write this:

KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
KERNEL=="sdb2", ENV{UDISKS_IGNORE}="1"

The rest is the same :)

like image 104
Kurt Bourbaki Avatar answered Sep 22 '22 01:09

Kurt Bourbaki