Subject: Re: accessing IDE hard drive via pcmcia card (redirected from netbsd-users)
To: Steve Bellovin <>
From: Daniel Carosone <>
List: tech-kern
Date: 05/22/2004 04:58:30
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, May 21, 2004 at 02:10:19PM -0400, Steve Bellovin wrote:
> I did, however, encounter another problem that I worked around but=20
> haven't fixed; this problem requires more thought, which is why I've=20
> redirected the thread to tech-kern: on a device like this, on the last=20
> close(), power is removed from the drive before any final writes can=20
> finish.  Thus, if I unmounted a file system, the superblock wouldn't be=
> marked clean, and fsck would run the next time.


> I finally worked around the problem by running
> 	sleep 99999 </dev/rwd1a
> in the background.

Another workaround, and interesting test, would be to turn off
write-cache on the drive:

	dkctl wdX setcache r

and then try the unmount.  I'm hoping/assuming this would wait for the
superblock write to complete.  Could you try this?  If it does, then
building the moral equivalent of

	dkctl wdX synccache force

into the close is the right way to fix this.  It even seems to me like
if we don't do this, there might be other similar lossage cases
lurking than the pcmcia one you found.

(For removable devices that might get unexpectedly yanked, running
without write cache, and perhaps mount -o sync, might also be a good
idea - but that should remain a user preference for appropriate


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.4 (NetBSD)