How to keep root fs read only from start to stop

Disable mounting root fs ReadWrite during boot

Patch file /etc/init.d/checkroot.sh:

checkroot.sh.diff
 
--- checkroot.sh.old	2010-07-11 11:11:34.000000000 +0000
+++ checkroot.sh	2010-07-11 11:11:51.000000000 +0000
@@ -48,7 +48,7 @@
 	rootdev=none
 	roottype=none
 	rootopts=defaults
-	rootmode=rw
+	rootmode=ro
 	rootcheck=no
 	swap_on_lv=no
 	swap_on_file=no

Patch file /etc/init.d/voyage-util:

voyage-util.diff
--- voyage-util.old	2010-07-11 11:05:17.000000000 +0000
+++ voyage-util	2010-07-11 11:07:25.000000000 +0000
@@ -63,30 +63,30 @@
 
 case $1 in
 	'start')
-		echo -n "Remounting / as read-write ... "
+		#echo -n "Remounting / as read-write ... "
 		#/bin/mount / -o remount,rw
-		/usr/local/sbin/remountrw
-		echo "Done."
-		if [ -f /voyage.1st ] ; then
-				echo "First-time installation "
-		        echo -n "Re-generating host ssh keys ... "
-				rm -f /etc/ssh/ssh_host_rsa_key
-				ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' || { echo "Fatal Error: Failed to generate RSA keypair" >&2; exit; }
-				rm -f /etc/ssh/ssh_host_dsa_key
-				ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' || { echo "Fatal Error: Failed to generate DSA keypair" >&2; exit; }
-				
-				depmod -ae
-				
-				rm -f /voyage.1st
-				echo "Done."		
-		fi
+		#/usr/local/sbin/remountrw
+		#echo "Done."
+		#if [ -f /voyage.1st ] ; then
+		#		echo "First-time installation "
+		#        echo -n "Re-generating host ssh keys ... "
+		#		rm -f /etc/ssh/ssh_host_rsa_key
+		#		ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' || { echo "Fatal Error: Failed to generate RSA keypair" >&2; exit; }
+		#		rm -f /etc/ssh/ssh_host_dsa_key
+		#		ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' || { echo "Fatal Error: Failed to generate DSA keypair" >&2; exit; }
+		#		
+		#		depmod -ae
+		#		
+		#		rm -f /voyage.1st
+		#		echo "Done."		
+		#fi
 		
-		echo -n "Removing /etc/nologin ... "
-		/etc/init.d/rmnologin start
-		echo "Done."
-		echo -n "Remounting / as read-only ... "
+		#echo -n "Removing /etc/nologin ... "
+		#/etc/init.d/rmnologin start
+		#echo "Done."
+		#echo -n "Remounting / as read-only ... "
 		#/bin/mount / -o remount,ro
-		/usr/local/sbin/remountro
+		#/usr/local/sbin/remountro
 		echo "Done."		
 		start_leds
 		;;

Stop writing root fs to sync tmpfs

  • Create a dedicated partition for syncing the tmpfs files.
  • It should be large enough to set the size same as the RAM of the system.
  • Can be located on the same CF media as the root fs.
  • Use ext3 is okay, because it is mounted only on use.

Example, using /dev/sda1

mkfs.ext3 /dev/sda1
tune2fs -i 0 -c 0 /dev/sda1

Replace /etc/init.d/voyage-sync file with this script.

voyage/how_to_make_root_fs_read_only_from_start_to_stop.txt · Last modified: 2010-08-30 11:16 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0