Pressing a button in Linux is too complicated

Jonathan Hutchins hutchins at tarcanfel.org
Thu Jan 13 11:40:33 CST 2005


On Thursday 13 January 2005 07:34 am, Brian Kelsay wrote:

> In order to streamline the OS, all drives are treated the same.  You can't
> pull a hotswap SCSI or eject a CD until it is unmounted.  You definitely
> don't want to eject a CD-R when you are in the middle of burning, so the
> burning process locks the drive.  If you remove a USB HDD or flash drive
> without unmounting, you risk data loss or corruption.

This is pretty easy to understand if you do a little bit of work with a 
floppy, which _can_ be ejected while it's still mounted.

Mount one, do some RW, copy a bunch of files to it.  Observe the indicator 
light.  When the light is off, eject it.  Read it on a different machine.  
What, no change from when it was mounted?

Stick it back in the original machine, unmount it.  Watch the blinkenlight.  
Oooh, that's it, it's writing the data from RAM cache to the disk!  _That's_ 
why you have to unmount drives before you physically disconnect them!

While most workable desktops can and will cache an entire floppy at once, the 
same is true to lesser degrees with other media.

With non-writable media, there shouldn't be any reason to 'lock' the drive and 
prevent it from being ejected.  With writable, ejectable media, it should be 
easy to have the button press send an "unmount" command.

Oddly, I haven't had this problem with USB devices - it seems those aren't 
cached.  Maybe because they're faster?



More information about the Kclug mailing list