Rescuing Linux when it won't start
Published: 01 Aug 2007 15:41 BST
…can be used to create ISOs as well. Here's how.
If you're using Mandriva, as root:
mkrescue --iso --initrd /boot/initrd-KERNEL-NUMBER.img –kernel
/boot/vmlinuz-KERNEL-NUMBER
Note: where KERNEL-NUMBER is the actual release number of the kernel.
If you're unsure what kernel release you're using, the numbers for intrd and vmlinuz can be found with the following command:
uname –r
After running the command, you will find a rescue.iso file in the directory where you ran the mkrescue command. You can now burn the image with the following commands:
First, check for the number of the CD burn device with:
cdrecord –scanbus
Now burn the images with:
cdrecord dev=0,0,0 rescue.iso
Note: where dev=0,0,0 is number discovered with the scanbus command above.
If you're using Slackware, use these steps to make a boot CD:
mkrescue –iso
Note: Slackware automatically knows what kernel to put in the ISO.
You will then burn the image with the same means as you did with the Mandriva image.
SystemRescueCd
SystemRescueCd is a Linux system on a bootable CD-ROM for repairing your system and your data after a crash. It also aims to provide an easy way to carry out admin tasks on your computer, such as creating and editing the partitions of the hard disk. It contains a lot of system utilities (parted, partimage, fstools) and basic utilities (editors, Midnight Commander, network tools).
It aims to be very easy to use. Just boot from the CD and you can do everything as if you booted from a hard drive. The kernel of the system supports most important file systems (ext2/ext3, reiserfs, reiser4, xfs, jfs, vfat, ntfs, iso9660), and network ones (samba and nfs).
SystemRescueCd is probably the best of all the rescue systems out there. Not only can you use this rescue method from CD, but you can also place the rescue system on a USB flash drive.
To create a SystemRescueCd on a USB flash drive you will need a drive greater than 256MB. Download the iso image from SourceForge and burn the image onto CD. Now you will have to create the file systems on the drive. Find the name of the drive using the dmesg command, and then erase the drive with:
dd if=/dev/zero of=/dev/sda
Note: where /dev/sda is the actual name of the drive.
Now install a master boot record on the drive with:
install-mbr /dev/sda
or, if the command complains:
install-mbr --force /dev/sda
Now create the partition with parted by issuing:
parted /dev/sda
(parted) mkpartfs primary fat32 0 100% // use help or help mkpartfs command to see help
(parted) print // check if the write was ok
(parted) quit
Now that the filesystem has been created, copy the files to the flash drive from the CD burned from the SystemRescueCd image. Make sure you copy the files in the same hierarchy as they appear on the CD.
Now make the flash drive bootable with the syslinux command as such:
syslinux /dev/sda1
Note: where /dev/sda1 is the actual name of the drive.
Now you have a rescue thumb drive you can carry with you all day. Hopefully, since you are running Linux, you won't need to use it that often.
Final thoughts
Linux is a very stable environment but, because there are so many systems within the system, things can go wrong. Although it's very easy to become complacent about Linux (due to its numerous strengths), it's always a good idea to know how to rescue a machine from an untimely demise. Of course, all of the rescue systems in the world will not recover your system 100 percent of the time, so you might want to consider implementing a disaster-recovery programme for your Linux servers and desktops.
Full Talkback thread
3 comments







