Kernel 2.6.34 does not add my external disk to /etc/mtab???

Andrew Benton b3nton at
Sat Jun 12 05:36:26 PDT 2010

On 12/06/10 11:16, Jeremy Henty wrote:
> I have  an external  USB disk that  I mount  with a custom  udev rule.
> This has worked perfectly for ages, through many kernel versions.  But
> since I upgraded my LFS 6.5  system to 2.6.34 the disk does not appear
> in /etc/mtab, and  therefore not in the output  of mount either (which
> is annoying since it breaks my backup script).  The disk definitely is
> mounted; I can  see its contents in the mount point  and it appears in
> /proc/mounts.  What on earth has changed in this kernel version?
> Here's the udev rule:
> # cat /etc/udev/rules.d/01-local-external-disk.rules
> KERNEL=="sd?1", SUBSYSTEMS=="usb", ATTRS{product}=="Seagate External Drive", ATTRS{serial}==" SW063611533", RUN+="/sbin/udev_local_external_disk"
> And here's the mount script that rule runs:
> # cat /sbin/udev_local_external_disk
> #!/bin/sh
> mount -t ext3 -o nodev,noexec,nosuid,ro "$DEVNAME" /media/disk/number/0
> The weird  thing is that  if I unmount  the device and run  the script
> manually:
> # DEVNAME=/dev/sdd1 /sbin/udev_local_external_disk
> ...then the device does appear in /etc/mtab and the mount output.  Now
> SysV must  be running  the script at  boot time, otherwise  the device
> would not  mount at  all.  Why does  the script behave  differently at
> boot time rather than afterwards?
> Any ideas?  I'm stumped.

My guess is that when udev is first run the kernel has mounted the root 
filesystem read only. When you run the script by hand the root 
filesystem is read/write so mount can update /etc/fstab. have a look at 
the /etc/rc.d/init.d/mountfs bootscript. Try adding a line like
mount -f /media/disk/number/0
Does the udev rule work properly if you plug the external disk in after 
you've booted?


More information about the lfs-support mailing list