NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: External disk (umass) still writing: how to tell?



Hello,

On Fri, Jul 26, 2019 at 01:23:34PM +0200, Johnny Billquist wrote:
> I think it's a serious mistake to use the physical action inside the disk as
> any kind of indication that there is any actual work going on, from the
> perspective of system data transfers.
> 
> The disk can internally be doing various stuff at any point, which is
> totally irrelevant from this perspective. And disks usually also have the
> capacity to complete whatever operation is in progress and then move the
> heads to a safe area in case of power loss.
> 
> So stop thinking that there is data being written out at a later point after
> the disk have been unmounted. If the disk is internally caching things, it
> is still safe to disconnect it. All transfer of data from the OS to the disk
> have been completed. The disk is free to handle this any way it want
> internally. But it has to ensure that all data are retained. If it didn't,
> then essentially it would be useless, as you could not even shut down the
> system.
> 

I'm not an english native speaker so just to be sure: do you mean it is
safe to unplug the board/device connection (this is not what is
bothering me) or do you mean it is safe to cut the power on the disk
(this is bothering me: if there is activity on the disk, since I can't
know what exactly it is doing, it must not be put out of power).

That the OS has done its work and transfer all the data was my
assumption.

My question was: does it mean that the OS can ensure that, when
the umount has been done, all the data it has transfered has been
written finally to the disk (physically) or could the disk still
have the data in cache (for me: memory)---and this is how I interpret
what you write: as far as the system is concerned, the data has been
transferred; what the device does with it is another problem, meaning
that a loss of power will be a loss of data erasing a cache not written
to disk.

Specially: if mounting with "sync" does the OS has the mean to
ensure that the data is written physically to the disk (that could
be powered off), waiting to return from umount until it is actually
done---while without sync, it can return once the data is transferred
as far as it (the OS) is concerned, but not waiting for the device
to tell it has been "committed" actually to disk.

Best regards,
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index