[yocto] [systemd-devel] How to automount

Mike Looijmans mike.looijmans at topic.nl
Thu Sep 24 03:55:24 PDT 2015


On 23-09-15 12:09, Daniel. wrote:
> I think that sync just flushes data to disk and umount clears the dirty bit.
> There is no sync.vfat that I know.
>
> Em 23/09/2015 05:31, "Paul D. DeRocco" <pderocco at ix.netcom.com
> <mailto:pderocco at ix.netcom.com>> escreveu:
>
>      > From: Mike Looijmans
>      >
>      > This only serves to remove a mounted directory after
>      > "yanking" the device. It
>      > doesn't really do anything useful though, you'll still get corrupted
>      > filesystems, because Linux is way too lazy in writing out dirty data.
>      >
>      > Proper solution would be to have the system mount a removable
>      > device as
>      > read-only, and promote it to r/w once someone tries to write
>      > to it. And then
>      > after a timeout, it should go back to readonly.
>      >
>      > Supposedly, "autofs" can accomplish this, but I've never met
>      > anyone who got
>      > that to actually work.
>
>     In my system, the removable drive is used only for backing up or restoring
>     various data files in response to user commands. If I do a sync after each
>     such command, shouldn't that be enough to guarantee the file system
>     doesn't get corrupted when the drive is removed? Will it also ensure the
>     dirty flag is clear, or does that get set anyway?

Nope, "sync" does not clear the flag. Only umount does that (the same for any 
filesystem, this is not fat specific). Actually, sync is no guarantee that 
it's actually safe to yank the stick, data could still reside in buffers 
somewhere. Only umount (sort of) guarantees that.

The only thing that would really work is to unmount the device.

You could try mounting it read-only by default, and remount it before (rw) and 
after (ro) writing to it. Since it's under your control, it's possible to 'get 
it right' here and always have clean media.



Kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
Telefax: +31 (0) 499 33 69 70
E-mail: mike.looijmans at topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail








More information about the yocto mailing list