removing external usb hdd without unmounting causes reboot?

Oliver Fromme olli at
Mon Jul 23 14:16:03 UTC 2007

Stefan Esser wrote:
 > Oliver Fromme wrote:
 > > Momchil Ivanov wrote:
 > > > I don`t know how things work, but shutting down the system when some
 > > > mounted fs is no longer present seems like the wrong thing to me.
 > > 
 > > As Josh wrote, it's expected.  The problem is known
 > > to exist for a long time already (probably as long
 > > as FreeBSD itself exists), and if there was an easy
 > > solution, certainly someone would have fixed it.
 > I have to check this, but AFAIK this problem exists only for
 > devices/partitions that are mounted R/W. Do you happen to
 > know this? (I can not risk to crash my box right now for a
 > test ;-)

I'm afraid the problem affects _all_ mounts, including
read-only mounts.

 > There once was an autofs implementation, but IIRC it has
 > later been removed. It could not only automatically mount
 > removable media, but it could also help with the problem
 > of devices that are rarely written to, but still mounted
 > R/W just in case for easy write-access.
 > Long time ago I had the idea that a clean file system could
 > be mounted R/O after a short delay. When all dirty buffers
 > are flushed, the device could be forcefully disconnected
 > without causing inconsistencies in the kernel. If there are
 > no open file descriptors, the super-block could be written
 > with the "clean" flag set, to signal that no fsck is needed
 > when the partition is mounted next time.
 > Internally, the device can be treated as R/O, with the only
 > exeption that an attempted write is not rejected, but that
 > it instead triggers the change back to R/W operation (this
 > means setting the in-RAM copy of the super-block to dirty
 > before the write is allowed to proceed as normal).

That's a very interesting idea.  Unfortunately it doesn't
solve the problem, because read-only mounts have the same
problem, unfortunately.

So, currently the best work-around is to use amd with a
very short timeout.  Or simply remember to umount your
removable media manually.

Best regards

Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:

'Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.'

More information about the freebsd-stable mailing list