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 Thu, Jul 25, 2019 at 12:04:52PM -0400, Greg Troxel wrote:
> tlaronde%polynum.com@localhost writes:
>
> > It's then clear that writes are differed (the write cache is not
> > settable with dkctl(8)) and that the disk gets a lot in its cache
> > memory and writing only after.
>
> Does it write things within a few seconds?
It can be a matter of minutes! It's a constatation done precisely
because the disk is "out" and "hearable". I never thought the delay
could be that important... (I'm wondering if in order to advertise good
throughput, some disks are not made so that the cache should be almost
full for write-back to start.)
>
> > 2) Is there a way to query the status of the disk in order to give a hint
> > to the user about if it's safe or not to unplug the external device?
> > The problem is that the commands are terminated while data is perhaps
> > not (in my case: aren't) written yet to disk.
>
> It seems that unmount should invoke some sort of sync flag, so when
> unmount returns it should be safe.
>
The answer is no: the wedge mounted without the "sync" flag, I could
unmount to hear, a few minutes after, the disk writing (without anything
else writing to it of course).
> Another question is if your disk is following the specifications....
>
It's a not used disk but not new that I'm using as a guinea pig because
I don't trust it. It was in a Iomega enclosure with an ARM board, that I
bought several years ago (because I wanted to play with ARM and, at that
time, there were no Raspberry, Olimex and so on, at least sufficiently
known), it was cheap (and having seen one in---short---production even
too expensive for the cheap price) but totally unreliable. So even this
"not used" disk might be special (it already advertises bad sectors...).
> > 3) If 1) was guaranteed, wouldn't it be safer to automatically mount
> > with "sync" whatever wedge (written to) is found on an umass drive?
>
> Perhaps, but it would be vastly slower. From what I understand, your
> concern is not about consistency in the case of power loss. So really
> you just need to arrange that after someone unmounts, data is written
> and then it can be powered off.
My problem is to be able to provide an user with a hint about when he
can unplug for sure the external disk (BTW, I saw a couple of days ago
an USB drive connected to a Windows node, when a command to remove files
was done---returned---and the device was still writing a couple of
minutes after---request for "ejecting" did say that the device was busy;
but nonetheless, a uninformed user could have unplug it right aways).
>
> Or are you talking about writing other than via the filesystem?
>
No: all done with a (FFS) mounted filesystem.
> With eSATA instead of USB, support for command queuing is probably
> different (but I can't explain either).
>
I have the test the differences between the connection of the same disk
with USB and with eSATA. To my surprise, dkctl(8) doesn't publish the
same cache information depending on the type of connection.
It could make sense: in the USD (with SCSI other USB I think?), one can
not change the write cache policy (and it is obviously with a write
cache enable when it should not) while with SATA (SATA <-> eSATA) there
is a write cache and no read cache (mounting without "sync").
>
> > 5) In what limit is Sata (or eSata) hot-pluggable? Never? Depends on the
> > controler? Would the kernel panic if a SATA connected disk (unmounted)
> > would be unplugged? (If the theoretical answer is not none, I could
> > always test...)
>
> As I understand it, hot plugging requires not only logical support but
> electrical support to avoid damage. So if you controller is not labeled
> for that, it's not ok.
>
> As for panic, that was the way it was in the early days. These days, I
> think a missing disk should not be a panic, but simply an IO error on
> all accesses. Except perhaps on the root filesystem.
All goes for the ergonomy: to be able to give a hint for the user about
when he can unplug. For USB, one could unplug the system still
running---if I can ensure that the data is written and the wedges
unmounted.
With SATA (eSATA), I will need to power down the ARM board. (In some
sense, it might be the best signal to user).
Thanks for the answers!
--
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