safely remove USB hard drive
Mikkel L. Ellertson
mikkel at infinity-ltd.com
Thu Apr 24 17:58:47 UTC 2008
Patrick O'Callaghan wrote:
>>> According to the standard specification (e.g., POSIX.1-2001),
>>> sync() schedules the writes, but may return before the actual
>>> writing is done. However, since version 1.3.20 Linux does
>>> actually wait. (This still does not guarantee data integrity:
>>> modern disks have large caches.)
>>>
>> If I am reading this correctly, it is talking about the buffers on
>> the drive itself, if you have write buffering enabled on the drive.
>> To get around this, you would have to send a command to the drive
>> telling it to write its buffers to disk, and have some way to know
>> that it has done this. A work around would be to make sure that
>> write caching is disabled on any removable hard drive.
>
> It's possible that 'eject' can handle such a drive-specific command, but
> again the man page doesn't say so. Disabling write-caching may not
> always be possible, it depends on the drive itself. Some drives may even
> do caching without telling you (many of them already mess around with
> the internal geometry so what they present to the outside world is not
> always the truth). Designers trying to be clever make it harder for
> driver software to be clever.
>
It may be possible for HAL to manage turning off the write caching
on the drive as part of mounting the drive, at least when HAL is
mounting the drive. It may also be possible to have HAL take care of
making sure the drive flushes its buffers before telling you that it
is safe to remove the drive. HAL can have different rules for
different drives.
This does not help with drives that you mount manually, so you will
have to count on the user there for now. On the other hand, if you
are mounting the drive manually, you should know a bit more about
what you are doing. You either have to be root, or have an entry in
/etc/fstab to do it... So HAL could be configured to help prevent
users from shooting themselves in the foot.
The hardest part of configuring HAL to do this would be writing
rules for specific drives or drive families.
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080424/0dbd6b4c/attachment-0001.sig>
More information about the fedora-list
mailing list