[arch-projects] [initscrupts][RFC] umount tmpfs and ramfs on shutdown

Tom Gundersen teg at jklm.no
Sat Apr 23 10:32:46 EDT 2011

Hi guys,

On shutdown we unmount/remount most filesystems. However, we make
exception fro the "api" filesystems as they might still be useful and
they are anyway not backed by a block device.

The problem is that umount does not easily let us make exception based
on mountpoints, but we have to use mounttype instead. For /sys and
/proc this is ok, but /dev might be tmpfs, so we have until now
avoided unmounting any tmpfs filesystems.

This might be a problem if a tmpfs system is a submount of a
blockdevice, as this will block the unmounting of the parent device.

The attached patch (originally by Gerardo) fixes this problem when
/dev is mounted as devtmpfs and keeps the old behavior if /dev is

I made some adjustments, as noted in the commit message (Gerardo,
please let me know if this looks ok with you).

If someone knows of any reason not to unmount tmpfs or ramfs on
shutdown, please speak up.




Our kill and unmount logic is very fragile, and could do with a
refactor, but that is a project for another day...

>From d6650a257eac676b70fe2de9a679b6f223ea2673 Mon Sep 17 00:00:00 2001
From: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
Date: Sun, 4 Jul 2010 17:16:35 -0300
Subject: [PATCH] umount tmpfs on shutdown if devtmpfs is used

This fixes FS#19783.

some adjustments:
 - always umount ramfs as we never mount /dev as ramfs; and
 - don't umount /dev/pts as it might still be useful.]

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
Signed-off-by: Tom Gundersen <teg at jklm.no>
 rc.shutdown |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/rc.shutdown b/rc.shutdown
index 7bc2243..3ee354a 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -48,7 +48,11 @@ if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d
/sys/block ]]; then

 stat_busy "Unmounting Filesystems"
-/bin/umount -a -r -t noramfs,notmpfs,nosysfs,noproc,nodevtmpfs -O no_netdev
+if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
+	/bin/umount -a -r -t nosysfs,noproc,nodevtmpfs,nodevpts -O no_netdev
+	/bin/umount -a -r -t notmpfs,nosysfs,noproc,nodevpts -O no_netdev

 # Kill non-root encrypted partition mappings

More information about the arch-projects mailing list