This is a headless server special. I'm whipping up a server for one of
my buddies. He expressed strong interest in using the USB ports. The
server is headless, and offers samba and netatalk services. The user has
no intention using a shell and unix commands to do mounts.
So I brushed on my autofs and udev skills.

- Udev: I came up with a fixed naming scheme for the usb devices,
based on the location of the physical USB plug they are connected to.
Away with /dev/sde, returning as /dev/sdf after wake-up. The names are
no longer linear (sda ... sdn), a hierarchy is respected: Front/Back
plane, and plug 1, 2 ... n on each plane. Inside, e.g. a
"Front/2-Orange/" directory, a flat list of devices named disk-1 ...
disk-n is generated when a multivolume device was plugged-in.
- Autofs: There is a set of autofs rules to reflect the device
hierarchy into the same hierarchy of folders. Only paths to devices
actually plugged-in are shown: you don't see the -in my case- 8 usb
plugs all the time. There is a short timeout, so if all goes reasonably
well the devices mount and unmount automagically, and you can pull a
plug on the headless server without destroying the filesystem of the
device.
- Mount script: When mounting the "USB" share from a Finder or
Explorer, a script is called that scans the devices hierarchy and
executes "ls" commands into the automount path. So the share is
automatically populated, and you have as much time as the timeout delay
to navigate to a disk. From there autofs will see the path is in use and
will not unmount.

The end product looks like this picture: plug 2 devices, then navigate.
Get out of the share and wait for the timeout, and you can unplug
safely. (Works with windows explorer, too)

I can package the various files I am using if someone is interested.
All this relies heavily on the specific hardware of a machine, so that
would be for inspiration only. My platform is debian/lenny, kernel
2.6.28.


+-------------------------------------------------------------------+
|Filename: usb.jpg                                                  |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=8480|
+-------------------------------------------------------------------+

-- 
epoch1970
------------------------------------------------------------------------
epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711
View this thread: http://forums.slimdevices.com/showthread.php?t=69926

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to