General TC > Programming & Scripting - Unofficial

NFS storage base scripts mod for PXE booting [split]

<< < (2/6) > >>

neogenesys:
Great idea. So for this solution to work, you need to setup a PXE, TFTP and DHCP services in the same NFS box? What are the booting times that you are getting with this solution? What kind of client HW ? Server Specs?

thanks!

danielibarnes:
The DHCP server specifies the TFTP server in its configuration file, and it can specify a different machine. The NFS server can also be different. How you arrange it is a matter of convenience.

gerald_clark:
Boot time to X is 40 seconds on an 800MHz Via.
A kernel building development system takes 55 seconds.

gerald_clark:
I found that waiting for dhcp.sh to return is not sufficient.
Routing and resolv.conf can take up to 3 more seconds.

Instead I loop until I can ping the server.

Here is the new patch file for tc-config.


--- Code: ---*** tc-config.org       2009-08-25 22:40:34.000000000 -0500
--- tc-config   2009-08-25 22:40:35.000000000 -0500
***************
*** 171,176 ****
--- 171,177 ----
           settime*) SETTIME=${i#*=} ;;
           thm*) THEME=${i#*=} ;;
           bkg*) BACKGROUND=${i#*=} ;;
+            nfsmount* ) NFSMOUNT=${i#*=} ;;
          esac
        ;;
        *)
***************
*** 251,256 ****
--- 252,271 ----
  /sbin/ifconfig lo 127.0.0.1 up
  /sbin/route add 127.0.0.1 lo &

+ if [ -n "$NFSMOUNT" ]; then
+   /etc/init.d/dhcp.sh
+   echo "$NFSMOUNT /mnt/nfs nfs defaults,nolock 0 0" >> /etc/fstab
+   mkdir /mnt/nfs
+   SERVER=`echo $NFSMOUNT | awk -F\: '{ print $1 }'`
+   # dhcp.sh runs udhcpc async, so it exits before network is up
+   CNT=0
+   until ping -c 1 $SERVER >/dev/null 2>&1
+   do
+     [ $((CNT++)) -gt 30 ] && break || sleep 1
+   done
+   mount /mnt/nfs
+ fi
+
  if [ -n "$CHECKFS" ]; then
     touch /etc/sysconfig/checkfs
     wait $fstab_pid
***************
*** 563,569 ****
  if [ -n "$NODHCP" ]; then
    echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
  else
!   /etc/init.d/dhcp.sh &
  fi
  [ -n "$CRON" ] && /etc/init.d/crond start
  [ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
--- 578,584 ----
  if [ -n "$NODHCP" ]; then
    echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
  else
!   [ -z "$NFSMOUNT" ] && /etc/init.d/dhcp.sh &
  fi
  [ -n "$CRON" ] && /etc/init.d/crond start
  [ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"

--- End code ---

gerald_clark:
I have determined that the only things needed are these:
1. Add mount.nfs to /usr/local/sbin
2. Apply the two patches above.

This increases tinycore.gz by 42,223 bytes, and provides for an optional NFS based tce and restore directory.

Another tested but not posted method is to use tftp to install the mount.nfs.
This way only tc-config and tc-functions need patching.

The  first ':' separated value is the nfs directory to mount, while the second is an optional tftp file to process.

  append initrd=../tcl-23/boot/tinycore.gz nfsmount=openvz:/tftpboot/nfs/tc2-music;openvz:/nfs/tc2-music/nfs.tar

This uses tftp to download nfs/tc2-music/nfs.tar from openvz and extracts it to the root directory.
then it mounts openvzL/tftpboot/nfs/tc2-music on /mnt/nfs.

Any chance of getting one of these in RC4?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version