File:  [NetBSD Developer Wiki] / wikisrc / projects / project / disk-removal.mdwn
Revision 1.6: download - view: text, annotated - select for diffs
Fri Jan 18 16:34:49 2019 UTC (4 years, 10 months ago) by maya
Branches: MAIN
CVS tags: HEAD
remove drochner as a mentor, as he passed away.

[[!template id=project

title="Graceful USB disk detach/reattach"


duration="3 months"

Make NetBSD behave gracefully when a "live" USB/FireWire disk drive is accidentally detached and re-attached by, for example, creating a virtual block device that receives block-read/write commands on behalf of the underlying disk driver.

This device will delegate reads and writes to the disk driver, but it will keep a list of commands that are "outstanding," that is, reads that the disk driver has not completed, and writes that have not "hit the platter," so to speak.


* Provide a character device for userland to read indications that a disk in use was abruptly detached.
* Following disk re-attachment, the virtual block device replays its list of outstanding commands. A correct solution will not replay commands to the wrong disk if the removable was replaced instead of re-attached.

Open questions: Prior art? Isn't this how the Amiga worked? How will this interact with mount/unmount—is there a use-count on devices? Can you leverage "wedges" in your solution? Does any/most/all removable storage indicate reliably when a block written has actually reached the medium?

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb