[Ilugc] Automount USB drives
Kapil Hari Paranjape
kapil at imsc.res.in
Tue Apr 7 23:32:54 IST 2009
On Tue, 07 Apr 2009, Ashok Gautham wrote:
> Data is not written immediately. It is written asynchronously. You
> can force it to be written to the disk by using the sync call.. This
> call will exit only when all data waiting to be written has been
> written (This works even when you have two or more disks where data
> remains unwritten)
Not really! See the recent discussion on sync, fsync and so on on
LKML or the kernel page of LWN. For example,
All [sync] does is preëmpt the normally delayed flushing of dirty blocks by
expiring them all. It does *not* write them. They just go on the
various disk queues to be written to each device, but that doesn't get
them there -- yet. Once upon a time, and on some systems still, there
was a user process called update(8) that did this sort of thing every 30
seconds or so.
Then there are "write-caching" disk-controllers etc. ...
To ensure that data gets written to a removable device you should
"umount" it. Then wait for the activity light on the device to go off
(if it is not broken!) before unplugging/remove the device.
More information about the ilugc