Subject: Re: Detaching live sd devices
To: None <tech-kern@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-kern
Date: 07/26/2005 00:18:42
On Mon, Jul 25, 2005 at 12:24:57PM -0700, Bill Studenmund wrote:
> On Mon, Jul 25, 2005 at 01:26:24PM -0400, Steven M. Bellovin wrote:
> > In message <20050725171652.GA26608@kyyhky.embedtronics.fi>, Jukka Marin writes:
> > >On Mon, Jul 25, 2005 at 09:32:14AM -0700, Bill Studenmund wrote:
> > >> Why not just unmount the stick before disconnecting it?
> > >
> > >No modern operating system should have the user do things like this unless
> > >he/she has a specific reason for it.  The users don't even know what
> > >mounting a disk means.
> > 
> > Of course, DOS/Windows has gone the other way -- you never needed to 
> > tell the OS anything when you removed a floppy drive, but you do need 
> > to "stop" a USB disk or PCMCIA device before removal.  I believe the 
> > same is true on MacOS.
> > 
> > In other words, maybe people shouldn't have to do it, but on most 
> > modern systems they do; it's not a new concept except, perhaps, for the 
> > word "unmount".
> 
> I agree. While I think the user should have to go through a manual step, I 
> think that we can make it easy for them. The "eject" command will do an 
> unmount if you pass it the -f option. So it shouldn't be hard to create a 
> tool that can help users eject media. :-)

Bill,

Why do you think the user should go through a manual step before they
remove media or unplug a device, if we can conceive of a system where
we save the user both the time and the effort?  I would say that there
is pretty good evidence (both concepts and prior art) in the discussion
that we can save the time and effort:

        (1) improve visibility: indicate whether the media is in a "safe"
            condition or not, by displaying a "dirty buffers meter" or a
            "do not remove media" indicator

        (2) anticipate hasty ejection: flush s/w buffers, h/w caches
            to the media after 1-2s

        (3) recover gracefully: if the user removes the media (or unplugs
            the device) prematurely, tell them so; hold the unwritten
            buffers; detect when the media/device is replaced using a
            unique media/device ID; flush the buffers

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933