See the reference script
#! /bin/sh # # brc This file is executed by init(8) when the system is being # shutdown (i.e. set to run at level 0). It usually takes # care of un-mounting al unneeded file systems. # # Version: @(#)/etc/brc 2.01 02/17/93 # # Authors: Miquel van Smoorenburg, <firstname.lastname@example.org> # Fred N. van Kempen, <email@example.com> # PATH=/bin:/etc:/usr/bin echo Unmounting file systems..... umount -a echo Done.
The special case in the kernel allowed this script, simply unmounting all filesystems in reverse order, finishing with the root filesystem.
umount -a is not ideal on modern systems. E.g. it is simpler to leave a
/proc filesystem mounted so that
/proc/mounts can still be used. And
/dev is usually a separate mounted filesystem, which will show an unmount error because
/dev/console is still open.
The old script contrasts with current init scripts, for example in Debian.
/etc/init/umount_root explicitly remounts
/ as readonly. The rest of the mounts are processed individually, by