Correct way to disconnect/eject an USB hard disk ?
Manish Jain
bourne.identity at hotmail.com
Wed Aug 19 12:56:38 UTC 2020
On 2020-08-19 17:59, Polytropon wrote:
>> After unmounting, are there any other measures to cleanly disconnect
>> the device?
> Usually not. If umount has been executed, and you wait a few
> seconds in order to let the command be finished successfully
> by the USB drive's firmware (last things to be written are
> _actually_ written), disconnect is possible at any time. The
> important thing to consider is that the filesystem should
> always be in a consistent state - that's what umount will
> accomplish. Due to the fact that "things need some time",
> waiting a few seconds is never wrong. After that, disconnecting
> power is no problem.
A note: it is perfectly safe to disconnect device any time after umount
has returned. The one problem is umount may take anything between a
second and a few hours (!) to return. This depends on whether the
filesystem was mounted as sync or async (the default).
When fs is mounted with sync option on, I/O is very slow - ~10x slower
than with async.
With async option on at the time of mount, I/O is much faster, the
algorithmic complexity of the code dealing with the I/O is much higher,
and a whole lot of data may remain unflushed even after an I/O command
(cp for instance) has returned. It is at the time of umount all this
data gets flushed - although you can manually force the flush yourself
with `sync`, in which case `umount` will return quickly.
Hope this helps,
Manish Jain
More information about the freebsd-questions
mailing list