Include SystemRescueCD

From FOG Project
Revision as of 18:10, 13 June 2014 by Iana (talk | contribs) (Added configuration information for fog 1.1.0)
Jump to: navigation, search

System Rescue CD

System Rescue CD is a linux live CD which comes with a huge array of tools for examining/recovering/repairing both linux and windows filesystems. These instructions aim to show you how to add it as an option to the fog boot menu so that it is always available without the need to carry a CD around. It offers you the ability to...

SystemrescueCD works at a very low level, so it has tremendous power for god and bad, it is very easy to destroy en existing system if you make a mistake! Be careful and make sure access is restricted as needed!


Fog 1.1.0

System Rescue CD Files

On the fog server, download the system rescue CD from http://www.sysresccd.org/Download. The version used here is 4.2.0, but others should work similarly.

cd /tmp
mkdir sysrescueCD
mount -o loop -t iso9660 systemrescuecd-x86-4.2.0.iso /tmp/sysrescueCD

I'm running Fog on a Centos/RHEL host so the fog installer script put my web root at /var/www/html/fog. If you are running ubuntu the fog web root will be somewhere else (/var/www/fog maybe?), wherever it is, we to copy the systemrescue files to somewhere fog accessible, I stuck them in the ipxe folder but there may be a better location.

cp /tmp/sysrescueCD/rescue32 /var/www/html/fog/services/ipxe/
cp /tmp/sysrescueCD/rescue64 /var/www/html/fog/services/ipxe/
cp /tmp/sysrescueCD/isolinux/initram.igz /var/www/html/fog/services/ipxe/
cp /tmp/sysrescueCD/sysrcd.dat /var/www/html/fog/services/ipxe/
cp /tmp/sysrescueCD/sysrcd.md5 /var/www/html/fog/services/ipxe/

Everything is now accessible over http so we no longer need to do NFS mounts as we did with fog 0.32.

Fog Advanced Menu

The fog web UI has an option under "Fog Configuration"->"PXE Boot Menu" for "Advanced Configuration Options". This is where we will add systemrescueCD. In old fog versions, this option gave you a space to tack entries on to the end of the fog menu. In the new system, this menu item is chain loaded. When you select "Advanced" in the fog menu, whatever is in the "Advanced Configuration Options" textbox will be used to generate a completely new menu. Here is an example...

#!ipxe
cpuid --ext 29 && set arch x86_64 || set arch i386
colour --rgb 0xff6600 2
cpair --foreground 7 --background 2 2
console --picture http://<YOUR FOG SERVER HERE/fog/service/ipxe/bg.png --left 100 --right 80
:MENU
menu
colour --rgb 0xff0000 0
cpair --foreground 0 3
item --gap -- -------------------------------------
item fog.sysr64 Run SystemRescue (64 bit)
item fog.sysr32 Run SystemRescue (32 bit)
item fog.local Boot from hard disk
choose target && goto ${target}
:fog.local
sanboot --no-describe --drive 0x80 || goto MENU
:fog.sysr64
kernel rescue64 scandelay=1 docache netboot=http://<YOUR FOG SERVER HERE>/fog/service/ipxe/sysrcd.dat 
initrd initram.igz
boot || goto MENU
:fog.sysr32
kernel rescue32 scandelay=1 docache netboot=http://<YOUR FOG SERVER HERE>/fog/service/ipxe/sysrcd.dat 
initrd initram.igz
boot || goto MENU
autoboot

Obviously, if you have changed any of the paths to rescue64 or sysrcd.dat above you should update the kernel lines as well.

When you select "Advanced" from the fog boot menu, the menu should reload and give you three options.

  • Run SystemRescue (64 bit)
  • Run SystemRescue (32 bit)
  • Boot from hard disk


Securing

I'm not familiar enough with iPXE to say how this menu option should be secured, ideally I'd like to put a password on the entry but for the moment the "No Menu" option to the PXE Boot Menu restricts it's use.


Fog 0.32

Download system rescue CD 3.3.0 (other versions should work) from http://www.sysresccd.org/Download and loopback mounted it.

System Rescue CD Files

cd /tmp
mkdir sysrescueCD
mount -o loop -t iso9660 systemrescuecd-x86-3.3.0.iso /tmp/sysrescueCD

On the fog server I created /tftpboot/sysrescue and /images/sysrescue

mkdir /tftpboot/sysrescue
mkdir /images/sysrescue

Copy the necessary kernel and ramdisk into place.

cp /tmp/sysrescueCD/isolinux/initram.igz /tftpboot/sysrescue
cp /tmp/sysrescueCD/isolinux/rescue32 /tftpboot/sysrescue
cp /tmp/sysrescueCD/isolinux/rescue64 /tftpboot/sysrescue

Next copy the sysrcd.dat and sysrcd.md5 files into place

cp /tmp/sysrescueCD/sysrcd.md5 /images/sysrescue
cp /tmp/sysrescueCD/sysrcd.dat /images/sysrescue

Ensure that the new nfs directory will be exported by adding the following line to /etc/exports

/images/sysrescue	       *(ro,insecure)

And export it

exportfs -va

FOG Menu Items

The fog menu system can be adjusted manually by editing the file /tftpboot/pxelinux.cfg/default but changes to that file will not be respected when you update fog or if you change one of the PXE configuration settings in the FOG frontend. Instead we can use the frontend to make a persistent change.

  -> Other Information
    -> PXE Boot Menu
      -> Advanced Settings
Add any custom text...

LABEL System Rescue CD "Live Image"
	LINUX sysrescue/rescue32
	INITRD sysrescue/initram.igz
	APPEND scandelay=1 docache netboot=nfs://<IP ADDRESS OF YOUR FOG SERVER>:/images/sysrescue setkmap=us
	TEXT
	SystemRescueCD network boot image (recovery)
	ENDTEXT

LABEL System Rescue CD "Live Image" 64 bit
	LINUX sysrescue/rescue64
	INITRD sysrescue/initram.igz
	APPEND scandelay=1 docache netboot=nfs://<IP ADDRESS OF YOUR FOG SERVER>:/images/sysrescue setkmap=us
	TEXT
	SystemRescueCD network boot image (recovery) 64 bit
	ENDTEXT

When you boot the client you should now be able to see an entry for System Rescue CD "Live Image" which will boot SystemRescueCD with networking (and allow you to start X11 if you wish).

Remember to umount the loopback image from the fog server when you are done

sudo umount /tmp/sysrescue