automounting with busybox?

Natanael Copa natanael.copa at gmail.com
Mon Aug 7 13:26:10 UTC 2006


On Mon, 2006-08-07 at 13:44 +0100, Chris Steel wrote:
> Is there any way to automount (for example a usb stick) with Busybox?
> 
> I've built a rootfs containing busybox 1.2.1 using mdev rather than
> udev, uclibc 0.9.28, and autofs 4.1.4. Autofs kinda works, but the
> mounted directories don't show up with 'ls' though I can 'cd' to them
> and 'mount' shows them. Given that busybox already contains a udev
> replacement, it would be really nice to have a version of automount in
> busybox too.

I have been playing with mdev this weekend too. I managed to mock up a
script that created and deleted links to usb disks. It is attatched.

For example:

 /dev/usba -> /dev/sdc
 /dev/usba1 -> /dev/sdc1
 /dev/usbb1 -> /dev/sdf1

In theory you could just extend that script and add a

mkdir -p /media/$MDEV
mount -o sync /dev/$MDEV /media/$MDEV

unmounting cleanly before you pull the usb device is harder though...
You can mount with -o sync to disable cashing. (anybody knows how to
make the cache flush more aggresively for a certain device?)

I was planning to post all my mdev stuff here when I had got all things
working and after testing it a bit more.

You need this in your mdev.conf:

sd[a-z][0-9]*	root:disk 0660	*/lib/mdev/sd_links


--
Natanael Copa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sd_links
Type: application/x-shellscript
Size: 1732 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060807/acc804a1/attachment-0002.bin 


More information about the busybox mailing list