Thursday, March 8, 2007

Mount Gigabyte

I'm using an external USB disk as the backup storage device for bacula. As usual, setting it up seemed easy enough at first, but got complicated later: after all, all I needed to do was connect the drive, and let hotplugging magic take over...

This didn't quite work - the file system on the disk is FAT32 and auto-mounting it meant that the user bacula was not permitted to access the disk. I needed to manually specify an entry for the disk in /etc/fstab as follows:

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

This fixed the permissions issue, but caused two other problems. The most obvious problem was that the disk failed to mount during start up. Adding the noauto option to the mount options, and the following lines to do_start in /etc/init.d/bootmisc.sh, fixed it, by postponing the disk mounting very close to the end of the boot sequence:

# mount backup storage device and restart backup storage service

mount /mnt/gigapod
/etc/init.d/bacula-sd restart

The second issue that cropped up was that when other USB storage devices were connected, I would sometimes end up with /dev/sda1 pointing to one of the other storage devices. This was fixed by referring to the persistent device node name (courtesy of udev):

/dev/disk/by-id/usb-ExcelSto_r_Technology_J36_DEF1078555F6-part1 /mnt/gigapod vfat users,rw,noexec,nosuid,nodev,shortname=mixed,uid=bacula,gid=bacula,umask=000,noauto 0 0

It looks innocent enough, but it took me quite a while to get this working, which makes it worth documenting.

[23 Aug. 2007] Update: I now use udev rules to do this.

No comments:

Post a Comment