Diskwipe

From FGVwiki

Jump to: navigation, search

Diskwipe

Diskwipe on a single system image NFS booted Ubuntu. It runs the fg-test suite by default.

Rebuilding

As root

 debootstrap lucid /srv/netboot/utility
 cp /etc/resolv.conf /srv/netboot/utility/etc/resolv.conf
 echo "fg-test" > /srv/netboot/utility/etc/hostname
 echo 'Acquire::http { Proxy "http://apt.shop.lan:3142"; };' > /srv/netboot/utility/etc/apt/apt.conf.d/30proxy
 chroot /srv/netboot/utility
 aptitude install linux-kernel-image
 cat << RO_ROOT_HOOK > /etc/initramfs-tools/hooks/ro_root
 #!/bin/sh
 PREREQ=
 prereqs() {
   echo "$PREREQ"
 }
 case $1 in
 prereqs)
   prereqs
   exit 0
   ;;
 esac
 . /usr/share/initramfs-tools/hook-functions
 manual_add_modules aufs
 manual_add_modules tmpfs
 copy_exec /bin/chmod /bin
 RO_ROOT_HOOK
 cat << RO_ROOT_SCRIPT > /etc/initramfs-tools/scripts/init-bottom/ro_root
 #!/bin/sh
 PREREQ=
 prereqs() {
   echo "$PREREQ"
 }
 case $1 in
 prereqs)
   prereqs
   exit 0
   ;;
 esac
 
 ro_mount_point="${rootmnt%/}.ro"
 rw_mount_point="${rootmnt%/}.rw"
 # Create mount points for the read-only and read/write layers:
 mkdir "${ro_mount_point}" "${rw_mount_point}"
 # Move the already-mounted root filesystem to the ro mount point:
 mount --move "${rootmnt}" "${ro_mount_point}"

 # Mount the read/write filesystem:
 mount -t tmpfs root.rw "${rw_mount_point}"

 # Mount the union:
 mount -t aufs -o "dirs=${rw_mount_point}=rw:${ro_mount_point}=ro" root.union "${rootmnt}"
 # Correct the permissions of /:
 chmod 755 "${rootmnt}"
 # Make sure the individual ro and rw mounts are accessible from within the root
 # once the union is assumed as /.  This makes it possible to access the
 # component filesystems individually.
 mkdir "${rootmnt}/ro" "${rootmnt}/rw"
 mount --bind "${ro_mount_point}" "${rootmnt}/ro"
 mount --bind "${rw_mount_point}" "${rootmnt}/rw"
 RO_ROOT_SCRIPT
 chmod +x /etc/initramfs-tools/hooks/ro_root /etc/initramfs-tools/scripts/init-bottom/ro_root
 
 # YOU NOW NEED TO EDIT /usr/share/initramfs-tools/scripts/functions and add a 'sleep 1'
 # after         'dhcp|bootp|rarp|both)' around line 393
 # AND EDIT /etc/initramfs-tools/initramfs.conf and configure it for a nfs boot with net modules
 update-initramfs -u
 aptitude install dialog lshw pcmciautils bsdmainutils fortune fbi scsitools hdparm smartmontools klogd dosfstools
 #REPLACE THE LAST LINE OF /etc/init/tty1.conf with
 # exec /sbin/getty -8 -n -l /opt/fg-test/testmenu 38400 tty1
 exit

The nfs share should now be configured. Setup an export of /srv/netboot/utility as read only. Then copy the kernel and initrd from /srv/netboot/utility/boot to your tftpboot folder and configure pxe to serve them.

Personal tools