See the reference script `etc/rc.d/rc.0` in the old `SysVinit-2.4.tar.z` / `SysVinit-2.4.tar.gz`.

    #! /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, <>
    #		Fred N. van Kempen, <>
      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 scripts for SysVinit, for example in Debian.  `/etc/init/umount_root` explicitly remounts `/` as readonly.  The rest of the mounts are processed individually, by `/etc/init/umountfs` and `/etc/init/`.