Connecting unionfs with udev?
Michael R. Head
burner at suppressingfire.org
Sat Mar 24 07:49:10 UTC 2007
Hi, I'm experimenting with unionfs. Here's the setup I'd like to
achieve:
I want a virtual directory that combines all the attached USB drives
into one. As the drives are attached and ejected, I'd like them to be
added and removed from the unioned directory dynamically. What's more,
in the ideal situation, I'd like to only add them if they have a certain
subdirectory on them.
I've got this in my /etc/fstab:
none /mnt/union unionfs dirs=/mnt/union=rw 0 1
Basically, when a usb storage device is attached, I'd like something
like this to run:
if [ -d "$USB_MOUNT_POINT/stuff" ]; then
unionctl /mnt/union --add --mode ro "$USB_MOUNT_POINT/stuff"
fi
And then before the usb drive is removed (presumably when it's ejected
by gnome-volume-maanger), I'd like something like this to happen:
if [ 0 -lt `unionctl /mnt/union --list |grep -c $USB_MOUNT_POINT/stuff` ]; then
unionctl /mnt/union --remove $USB_MOUNT_POINT/stuff
fi
Any ideas where to fit this stuff in? I was thinking somewhere
in /dev/udev/rules.d, but I wasn't sure where the best place would be.
--
Michael R. Head <burner at suppressingfire.org>
http://www.suppressingfire.org/~burner/
http://suppressingfire.livejournal.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070324/d741f59b/attachment.bin>
More information about the ubuntu-users
mailing list