It is quite a three pipe problem

This case study illustrates the (lack of) rules better than almost any other I have. From early Fedora to latest Fedora the rules have changed many times.

I've got a usb disk on my system I use for backups. I don't want it corrupted if I can help it, so I don't want it automounted in every gnome session (which gnome really wants to do). I also don't want it showing up as a disk device in every file browser ayone opens on the system (which gnome also likes to do).

With help from the folks on the hal mailing list I was able to construct the /etc/hal/fdi/policy/10-stop-hal-stop.fdi file which I use to recognize the volume label I happen to know is on this disk (the highly original label BACKUP :-) and tell hal to ignore that particular disk:

<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
  <device>
    <match key="volume.label" string="BACKUP">
       <merge key="volume.ignore" type="bool">true</merge>
    </match>
  </device>
</deviceinfo>

Now it only gets mounted when I want it to get mounted (in the cron script which does my nightly backups).

But wait! Fedora 8 changed the way hal is configured so that all fixed disk partitions get mounted by default (even partitions you deliberately left out of the /etc/fstab file because you didn't want people fooling with them). Now I need to add /etc/hal/fdi/policy/10-no-fixed-drives.fdi to put back the policy removed in Fedora 8 and once again hide the fixed drives:

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">
  <device>
    <match key="@block.storage_device:storage.hotpluggable" bool="false">
      <match key="@block.storage_device:storage.removable" bool="false">
        <merge key="volume.ignore" type="bool">true</merge>
      </match>
    </match>
  </device>
</deviceinfo>

Just a moment, just a moment... Now it is Fedora 12, and hal is no longer the solution to all problems. The cognoscenti have now declared that hal is obsolete, and udev is the solution to all problems.

Fedora 12 has DeviceKit-disks and it wants udev rules instead of hal policy files. After much googling, I finally managed to discover the new gibberish and put it in the file /etc/udev/rules.d/99-zzz-local.rules:

# tell annoying tools on system there is a friggin reason I didn't mount
# these things and they shouldn't go mounting them either.
#
ENV{ID_FS_LABEL}=="BACKUP", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F12ROOT64", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="MAINBOOT", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F12ROOT32", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F11ROOT64", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F11ROOT32", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F10ROOT64", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F10ROOT32", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="ZOOTY", ENV{DKD_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="SPARE", ENV{DKD_PRESENTATION_HIDE}="1"

But wait! Now it is Fedora 13 and the fashion police have decided that using Kit in the name of every project in the universe out of favor, so in Fedora 13, DeviceKit-disks became udisks, and naturally that means I need to change all the DKD_ names to UDISKS_ names in the ENV references in the rules file:

/etc/udev/rules.d/99-zzz-local.rules

# tell annoying tools on system there is a friggin reason I didn't mount
# these things and they shouldn't go mounting them either.
#
ENV{ID_FS_LABEL}=="BACKUP", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F12ROOT64", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="MAINBOOT", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F12ROOT32", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F11ROOT64", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F11ROOT32", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F13ROOT64", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="F13ROOT32", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="ZOOTY", ENV{UDISKS_PRESENTATION_HIDE}="1"
ENV{ID_FS_LABEL}=="SPARE", ENV{UDISKS_PRESENTATION_HIDE}="1"

That still works in Fedora 16 today, but I figure it is quite likely to change again soon...

 
Game of Linux Entry Game of Linux Site Map Tom's Fabulous Web Page
 
Page last modified Sun Feb 12 14:38:15 2012