Rainbow Chard

An assortment of indigestible things

Getting rid of automounts that won’t go away

If you delete an automount from a map and restart the daemon, the mountpoint should go away… but sometimes it doesn’t, and you end up with this:

drwxr-xr-x 2 root root 0 Oct 22 11:24 /wibble

The size of zero indicates that the system still sees a mountpoint here, and in /proc/mounts you’ll see something like

/etc/auto.mymap /wibble autofs rw,relatime,fd=5,pgrp=31311,timeout=86400,minproto=5,maxproto=5,direct 0 0

So the mountpoint is both there and not there, and any attempt to access it will hang. Trying to unmount it manually doesn’t work either. This can cause merry hell: on a default system, the updatedb process that locate uses will hang forever when it reaches the mountpoint (even though it’s configured to ignore nfs and autofs), and the rest of cron.daily will never be reached, so no log rotation for you. After a few days you’ll see lots of find processes cluttering up the place.

A reboot will fix it of course, but there is a much simpler and less destructive way:

umount -l /wibble

The ‘-l’ option is described in the manpage as

Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

That suggests a reboot might be warranted at some point to make sure it’s completely gone away, but it certainly does the trick. The entry in /proc/mounts disappears, and the directory now looks like

drwxr-xr-x 7 root root 4096 Oct 22 11:40 /wibble

A much healthier-looking directory, which you can now safely delete. Don’t forget to kill all those backlogged jobs too.

Previous

The fragments of a short and tragic life

Next

Cotswold District Council’s finances laid bare

1 Comment

  1. This just saved my bacon; like 10 rashers of it. Thank you.

Leave a Reply

Powered by WordPress & Theme by Anders Norén