For the 2 large home servers I have built, I have used a unioning system
that works at file level. I used aufs v1 and more recently mhddfs
(fuse-based, much simpler but more reliable in my application.)
I use it to join directories in different drives. The idea behind this
is being fault tolerant: if a drive goes belly-up the system will
continue showing the usual shares, only with less files. 
I also use bind mounts, to further uncouple device mounts/data
organization on the drives, from the media library made available by
servers such as samba, nfs, etc.

Of course, when a drive fails: 
- boot or wake-up can get slow, depending of the failure,
- when all drives are not here, the unioning code will be unhappy
(aufs doesn't care, but mhddfs crashes) and bind mounts will fail with
errors (possibly making nfs et al. fail in turn.)

I ended up with something like this in fstab:

Code:
--------------------
    ...
  LABEL=SYSTEM / ext3 defaults 0 0
  ### MY_MARK_BEGIN ###
  /dev/sda /mnt/drive1 ext3 noauto,nodev 0 2
  /dev/sdb /mnt/drive2 ext3 noauto,nodev 0 2
  mhddfs#/mnt/dummy,/mnt/drive1/shared,/mnt/drive2/shared /mnt/union fuse 
noauto,allow_other 0 0
  /mnt/union/audio /var/media/Music none bind,noauto 0 0
  ### MY_MARK_END ###
  ...
--------------------

At boot time, fstab is processed as usual, and "noauto" mounts are left
off. Then much later in the boot process, I have a piece of code that
reads /etc/fstab, parses the lines between "### MY_MARK_* ###" and
cautiously executes the mounts if the devices are indeed present in the
system.
For example, it will see a mount for /dev/sda, check that device sda is
really alive in the system, and if so, will execute the mount with the
"noauto" option stripped out.
For the union/binds, it will check the dirs are all here before running
the mounts.

As fragfutter suggests, I could have used an entirely bespoke script,
but I thought better to keep all mounts into fstab, and use a custom
parser. Retrospectively, I think that was a good decision.
(and this parser is surely the ugliest piece of perl I have ever
written, please do not ask me to share.)


-- 
epoch1970

Daily dose delivered by: 2 SB Classic (fw 130), 1 SB Boom (fw 50) •
SqueezeCenter 7.3.4 (Debian 5.0) with plugins: ContextMenu,
SaverSwitcher by Peter Watkins • Server Power Control by Gordon Harris
•  WeatherTime by Martin Rehfeld • IRBlaster by Gwendesign (Felix) •
FindArt, CDplayer by bpa • BBC iPlayer, SwitchPlayer by Triode •
PowerSave by Jason Holtzapple • TrackStat by Erland Isaksson.
------------------------------------------------------------------------
epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711
View this thread: http://forums.slimdevices.com/showthread.php?t=79161

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to