[yocto] [systemd-devel] How to automount

Daniel. danielhilst at gmail.com
Tue Sep 22 17:30:36 PDT 2015


If there is any process using the mount point the umount may fail. If you
have a bash running in a folder from the mounted filesystem is the
sufficient to umount fail.

You can use the fuser -m MOUTPOINT to check this. Adding -k would kill all
process using that mount point.

"udevadm monitor" should show you udev events interactive.

Cheers,
-dhs
Em 22/09/2015 20:49, "Fred Ollinger" <Fred.Ollinger at seescan.com> escreveu:

> You can see what udev thinks it will do for a given drive by using:
>
>  $ udevadm test /sys/block/sdb1
>
> Given that your drive is in /sys/block/sdb1 (could be sda1, etc).
>
> As for the dirty bit, we had to clear it ourselves.
>
> Frederick
>
> ________________________________________
> From: Paul D. DeRocco <pderocco at ix.netcom.com>
> Sent: Tuesday, September 22, 2015 4:42 PM
> To: Fred Ollinger; 'Mantas Mikulenas'; yocto at yoctoproject.org
> Subject: RE: [yocto] [systemd-devel] How to automount
>
> > 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
>
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20150922/e029514c/attachment.html>


More information about the yocto mailing list