Monday, November 28, 2011

A Patch to Keep the Resizing of tmps Surviving Through Reboot

After a fresh installation of RHEL 6.1, I needed to adjust the size of tmpfs. However, I found it is a little more complicated than just add "size" option in /etc/fstab for tmpfs. The setting of "size" in /etc/fstab doesn't keep through system reboot. Then I found following patch against /etc/rc.d/rc.sysinit which can make it persistent:

[root@bbrh6u1src ~]# diff -u /etc/rc.d/rc.sysinit.orig /etc/rc.d/rc.sysinit
--- /etc/rc.d/rc.sysinit.orig   2011-04-19 10:04:51.000000000 -0400
+++ /etc/rc.d/rc.sysinit        2011-11-28 08:33:53.166819280 -0500
@@ -487,7 +487,7 @@
        mount -f /proc >/dev/null 2>&1
        mount -f /sys >/dev/null 2>&1
        mount -f /dev/pts >/dev/null 2>&1
-       mount -f /dev/shm >/dev/null 2>&1
+       #mount -f /dev/shm >/dev/null 2>&1
        mount -f /proc/bus/usb >/dev/null 2>&1
 fi

@@ -495,7 +495,7 @@
 # mounted). Contrary to standard usage,
 # filesystems are NOT unmounted in single user mode.
 if [ "$READONLY" != "yes" ] ; then
-       action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
+       action $"Mounting local filesystems: " mount -a -t tmpfs,nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
 else
        action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
 fi

References:
https://www.redhat.com/archives/rhelv6-list/2011-February/msg00081.html

No comments:

Post a Comment