This will be very useful for recovering Linux systems. Here we add the systemrescuecd iso to grub2 on Ubuntu 15.04. It’s really easy and I recommend adding it to every Linux systems!
Download the iso from sourceforge, I save it under /recovery/systemrescuecd-x86-4.5.3.iso. This filesystem is on my root filesystem which is not on RAID or LVM. Just plain ext4 on /dev/sda3.
Then edit /etc/grub.d/40_custom
[code]
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the ‘exec tail’ line above.
menuentry "Recovery with sysrescuecd" {
insmod loopback
insmod iso9660
set isofile="/recovery/systemrescuecd-x86-4.5.3.iso"
loopback loop (hd0,msdos3)$isofile
linux (loop)/isolinux/rescue64 setkmap=us isoloop=$isofile
initrd (loop)/isolinux/initram.igz
}
[/code]
Remember to run update-grub2 after modifying files in /etc/grub.d.
The obvious variable to change is where you store your iso file. A more subtle variable is the loopback line, where we need to tell grub2 where to find that iso file. /dwv/sda3 is known as (hd0,msdos3) for strange reasons. To find out the right name on your systems, reboot to grub2 prompt and do a ls
[code]
grub2> ls
grub2> ls (hd0,msdos3)/recovery
[/code]
When the 2 variables are set, that’s really it. If you wish to boot other iso files, the linux and initrd lines will need to change to the correct images. google is your friend.