[yocto] [systemd-devel] How to automount

Paul D. DeRocco pderocco at ix.netcom.com
Tue Sep 22 16:42:33 PDT 2015


> From: Fred Ollinger [mailto:Fred.Ollinger at seescan.com] 
> 
> This is in the package: udev-extraconf
> 
> On your system look here:
> 
> /etc/udev/rules.d/automount.rules
> 
> In this file, you'll find the following rules.
> 
> The second one auto unmounts.
> 
> SUBSYSTEM=="block", ACTION=="add"    RUN+="/etc/udev/scripts/mount.sh"
> 
> SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
> 
> SUBSYSTEM=="block", ACTION=="change", 
> ENV{DISK_MEDIA_CHANGE}=="1" RUN+="/etc/udev/scripts/mount.sh"

Well, that started me down a long path. First of all, none of these things
existed because my Yocto build didn't include udev-extraconf. The version
I did two years ago did (although I didn't see it mentioned in my own
metadata), which is why it worked. So I added it back, rebuilt it, and
then tried plugging in a USB flash drive.

The drive appeared as /dev/sdb and /dev/sdb1 (it has a partition table),
The syslog showed the mount.sh script message "Auto-mount of
[/run/media/sdb1] successful", /run/media/sdb1 exists as a directory, but
nothing is mounted there. The next syslog message from FAT-fs said "Volume
was not properly unmounted. Some data may be corrupt. Please run fsck."
When I did that, all I found was that the dirty bit was set, so I
speculated that that caused the mount to somehow be undone.

So I cleaned the dirty bit, synced the file system, unplugged the drive
and plugged it in again. This time the syslog showed the successful mount
message, but no complaint about the drive. Yet it still wasn't mounted.

I can manually mount it, and see its contents. If I then yank the drive,
the mount.sh script doesn't unmount it. I even tweaked the script to log
any attempt to unmount, and it didn't even try.

Whenever I fix the dirty bit, disconnecting and reconnecting logs the
successful mount message, doesn't complain about the dirty bit, but
doesn't mount. Disconnecting again gives me a FAT-fs error "unable to read
boot sector to mark fs as dirty". Connecting again gives me the successful
mount message, and complains about the dirty bit.

Something must be missing here.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at ix.netcom.com




More information about the yocto mailing list