[PATCH] speed up NFS boot

Post there if you plan to contribute to this SystemCd
gvegidy
Posts: 3
Joined: 01 Oct 2015, 15:27

[PATCH] speed up NFS boot

Postby gvegidy » 01 Oct 2015, 15:48

Hi,

when you currently boot sysresccd over NFS, the whole sysrcd.dat is downloaded over the network
for doing the MD5 check. This takes several seconds to minutes, depending on the network speed.
There is no other need to download the complete file during boot, as squashfs is able to download
just the bits over NFS that are really needed.

Here is a patch allowing you to disable that check with the new "nocheck" option.

Please consider applying it. The other option would be to disable the MD5 check for NFS by default, like
it is done for local media like CDROM or USB memory stick, it can always be enabled again by the already
existing "docheck"-option. If you prefer that, just say so and I'll prepare the patch.

Thanks.

Code: Select all

From 11acfe9e7ca7f64cbd74aa20e267eaa883eac1d5 Mon Sep 17 00:00:00 2001
From: Gerd von Egidy <[email protected]>
Date: Thu, 1 Oct 2015 17:37:30 +0200
Subject: [PATCH] new "nocheck" kernel commandline parameter: disables checking
 sysrcd.md5 to speed up nfs boot

When you currently boot sysresccd over NFS, the whole sysrcd.dat is downloaded over the network
for doing the MD5 check. This takes several seconds to minutes, depending on the network speed.
There is no other need to download the complete file during boot, as squashfs is able to download
just the bits over NFS that are really needed.
---
 mainfiles/init | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/mainfiles/init b/mainfiles/init
index 1a5b8cd..a05e95d 100755
--- a/mainfiles/init
+++ b/mainfiles/init
@@ -758,13 +758,16 @@ sysresccd_stage1_nfs()
         sysresccd_panic "Cannot find the \"${SUBDIR}/${LOOPDAT}\" boot file."
     fi
 
-    md5now=$(/bin/busybox md5sum ${BOOTPATH}/${SUBDIR}/${LOOPDAT} | cut -d ' ' -f1)
-    md5orig=$(cat ${BOOTPATH}/${SUBDIR}/${LOOPMD5} | cut -d ' ' -f1)
-    if [ "$md5now" = "$md5orig" ]
+    if [ "${DOCHECK}" != '0' ] # option to disable checksum to increase boot speed
     then
-        good_msg "Successfully checked md5 sum of ${BOOTPATH}/${LOOPDAT}"
-    else
-        sysresccd_panic "md5sum checksum is invalid on the root filesystem image"
+        md5now=$(/bin/busybox md5sum ${BOOTPATH}/${SUBDIR}/${LOOPDAT} | cut -d ' ' -f1)
+        md5orig=$(cat ${BOOTPATH}/${SUBDIR}/${LOOPMD5} | cut -d ' ' -f1)
+        if [ "$md5now" = "$md5orig" ]
+        then
+            good_msg "Successfully checked md5 sum of ${BOOTPATH}/${LOOPDAT}"
+        else
+            sysresccd_panic "md5sum checksum is invalid on the root filesystem image"
+        fi
     fi
 
     # load system rescue modules (srm files)
@@ -1585,6 +1588,9 @@ sysresccd_parsecmdline()
         docheck)
             DOCHECK='1'
             ;;
+        nocheck)
+            DOCHECK='0'
+            ;;
         lowmem)
             LOWMEM='1'
             ;;
--
1.9.3

Return to “Contributions”

Who is online

Users browsing this forum: No registered users and 1 guest