Assume I have a linux system with the following partitions mounted (beside root):

  • proc on /proc
  • devtmpfs on /dev
  • devpts on /dev/pts
  • tmpfs on /dev/shm
  • sysfs on /sys
  • tmpfs on /var/run
  • tmpfs on /tmp

What should I do before halt (very last script executed, just before issuing the halt command)? Should I umount all these filesystems, leaving only /dev and /proc mounted? May leaving these filesystems mounted cause any problem? Is there a best practice about this?

UPDATE: I'm currently using sysvinit (latest) with own-written scripts.

1 Answer 1


On Debian, and likely its derivatives, the script which handles unmounts before halt/reboot is /etc/init.d/umountfs.

For me, the script does not umount any of the filesystems you have listed apart from tmpfs. The reason is given in the following comment:

# Make sure tmpfs file systems are umounted before turning off
# swap, to avoid running out of memory if the tmpfs filesystems
# use a lot of space.

Given the maturity of these scripts, I guess this is best practice, although it might be a good idea to investigate what other distros do.

It is also possible that the halt/reboot commands actually require some of the above mount to work (most likely /proc, but also /sys and /dev) and the command may fail without them.


To add a little more on this, the next script called after umountfs, before the actual halt script itself is umountroot. Contrary to what the name suggests, the script actually remounts root readonly. Note the actual syntax for this:

mount    $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \
  || mount $MOUNT_FORCE_OPT -n -o remount,ro              dummydev / 2>/dev/null \
  || mount $MOUNT_FORCE_OPT -n -o remount,ro                       /

Seemingly just doing a straight mount -no remount,ro / can fail if there are other mount points bound to root. See this bug for a full discussion of this. The MOUNT_FORCE_OPT is only set for FreeBSD, so this is not necessary for Linux.

  • This just raises another question. Why do they bother turning off swap?
    – phemmer
    Commented Feb 24, 2014 at 1:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .