Thursday, August 23, 2007

Mount Gigabyte - Update

As part of my daily system update, I've upgraded udev to version 0.114-2. I usually take the time to go over the change logs of updated packages, but I haven't done it this time. I probably should have.

I discovered that the disk id format has changed, i.e. the entries in /dev/disk/by-id have changed. This meant that my /etc/fstab settings for my external USB disk, stopped working. The device name that was used to refer to the disk did not exist anymore.

My first reaction was to use a different method of referencing that drive (e.g. /dev/disk/by-uuid), but I figured I really should handle it the udev way:

  1. use the following to detect the disk serial number (attached as /dev/sda1):

    udevinfo -a -p /sys/block/sda | grep serial

  2. add a specific udev rule, in /etc/udev/local.rules

    KERNEL=="sd?1", ATTRS{serial}=="DEF1078555F6", SYMLINK+="gigapod"

    (this adds a symbolic link /dev/gigapod that points to the disk's first partition).
  3. create a symbolic link in /etc/udev/rules.d/

    ln -sf ../local.rules z99_local.rules

  4. modify the mount point specification in /etc/fstab as follows

    /dev/gigapod /mnt/gigapod vfat users,rw,noexec,nosuid,nodev,shortname=mixed,uid=bacula,gid=bacula,umask=000,iocharset=utf8,noauto 0 0

  5. unmount and disconnect the USB disk
  6. restart udev:

    /etc/init.d/udev restart

  7. connect the USB disk
This way the disk is correctly mounted during the boot process, and there's no need to mount the disk in /etc/init.d/ Furthermore, Gnome seems to like it better this way (it was creating two disk icons on the desktop, one named gigapod and the other named backup60g which is the disk label - I now get only the latter).

Total control. Brrr.


  1. If you want the drive mounted at boot, you don't want "noauto" in your fstab, right?

  2. Correct.

    Actually, when I wrote this I used to mount the disk at boot in /etc/init.d/ (see this post).

    I no longer do that. Currently, the disk is mounted from a script that the backup daemon runs.

    At any rate, in a desktop environment I guess a volume manager is the way to go.