Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Aug 2020 09:42:59 -0600
From:      Gary Aitken <freebsd@dreamchaser.org>
To:        Manish Jain <bourne.identity@hotmail.com>, Polytropon <freebsd@edvax.de>,  Christoph Kukulies <kuku@kukulies.org>
Cc:        Ruben via freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Correct way to disconnect/eject an USB hard disk ?
Message-ID:  <b9b46ecb-b1ef-8f67-7b41-ae3cf0d3864b@dreamchaser.org>
In-Reply-To: <DB8PR06MB64427319E175193D1B828135F65D0@DB8PR06MB6442.eurprd06.prod.outlook.com>
References:  <C6B11926-65BE-4A05-B421-9F3E9C9AACF6@kukulies.org> <20200819142952.3686baa8.freebsd@edvax.de> <DB8PR06MB64427319E175193D1B828135F65D0@DB8PR06MB6442.eurprd06.prod.outlook.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 8/19/20 6:42 AM, Manish Jain wrote:
> 
> 
> 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.

Can you explain why I have seen umount commands return, and then the
USB device "activity" light keeps blinking?  I have on occasion waited
for a while and it keeps blinking, and eventually I just unplugged it.

Gary



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?b9b46ecb-b1ef-8f67-7b41-ae3cf0d3864b>