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

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Wed, 19 Aug 2020 09:42:59 -0600, Gary Aitken wrote:
> 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.

The "OS-side interface" to external USB-connected storage
does not exactly know what happens inside the controller.
The LED activity is defined by the firmware, which is not
disclosed by the manufacturer. While the OS, upon "umount",
basically says: "Here's the last chunk of data, sync it,
I'll detach /mnt from my VFS tree when you said you're
done." The USB controller accepts and confirms the last
chunk of data, reports back "Got it, everything is fine."
Now the umount command does what it says on the can, it
unmounts the medium, and returns control to the user.
Now _internally_ the USB stick is still busy _actually_
writing the last chunk of data to its storage, and the
firmware says: "Whenever you access the internal storage,
for whatever reason, make the LED flash." That's probably
what you're observing.

The idea of "just give it a few seconds after you physically
remove the USB stick" relies on the assumption that such
kind of activity takes place outside the control of the OS,
and the OS has no real way of discovering what's really
happening at that point. A few seconds are commonly enough
to make sure the processes internal to the controller and
its firmware have successfully finished, and the filesystem
(and data in general) on the USB stick is in the expected
state.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20200820044352.678a588e.freebsd>