From Mageia wiki
Jump to: navigation, search

Make an emergency boot CD, DVD or USB stick for all systems

In addition to the conventional manual methods listed below, here is a script which will do it for you!

Make your own emergency Boot CD (for legacy grub !)

How to make a bootable CDRom - as an alternative to, or in addition to a bootable floppy disk (see Formatting floppies ).

As it is sometimes difficult to fit a modern kernel on a floppy, and because more and more machines do not have a floppy drive at all, it is usually a good idea to have a bootable CDRom if for any reason your machine does not seem to be able to complete the boot process by itself. The following describes the steps to make a bootable CDRom containing the kernel that is running at this time.

It should be borne in mind that when actually using the Boot CD in case of need, some operations require the presence on the system of files relative to the kernel that is on the CD. In other words, the best possible boot CD is one for a kernel that is actually installed on the system. When upgrading or adding another kernel to your system, it is advisable to make a new boot CD. When you are already satisfied that the newest kernel does everything it should with your hardware, you can use a CDRW and burn the bootable CD over an older kernel. If not, a separate disk is advisable.

Steps to take:

  • Start any console or terminal.
  • Give the commands shown:
    1. su - # to become root; enter root password when prompted
    2. cd /tmp # some temporary files will be created here
  • Insert a blank, writable CDRom or a fresh, unformatted CDRW.
  • In my experience it is best to check that the disk has not been automounted or 'supermounted':
    1. umount /media/cdrom0 # change 'cdrom0' as needed ¹)
  • (Skip for cdrom): Blank any CDRW with the following command (or with your preferred burnware):
# wodim blank=fast dev=/dev/sr0

in which '/dev/sr0' is the mount point of the CDwriter, change as needed ¹)

Create the ISO file or image from the currently running kernel, that will be needed to burn to disk later (lilo)

# mkrescue --iso

Or: create an ISO file from any kernel on your system, other than the one currently running (lilo)

# mkrescue --image LABEL --iso

in which you must replace 'LABEL' with the label name as it appears in your /etc/lilo/conf . For example if your lilo.conf contains the line: label="kernel-server-3.8.13-1" in the paragraph describing the kernel that you want to make a bootable cd from, you should use the command:

# mkrescue --image kernel-server-3.8.13-1 --iso.

Burn the image to disk:

# wodim speed=16 -eject dev=/dev/sr0 rescue.iso

in which /dev/sr0 is an example; change to same as above ¹); 'speed' may be changed to a proper number for your burner and -eject is not necessary, but I believe a burned disk can better cool off outside than inside the box :)

Remove the temporary files from your hard drive (not needed if your system is set to remove temp files).

# rm rescue.iso 
# rm mkrescue-flp/boot.bin
# rm mkrescue-flp
# exit

Create a bootable CDRom with the same choices as your GRUB (1) menu

Copy /lib/grub/.../stage2_eltorito to /boot/grub , because if you ever put /boot and /usr on different partitions you'll want it, and you need it for making this bootable cd every time you update you kernel.

Put a blank(ed) CDR(W) in your burner (in the example below /dev/sr0) and:

cd /tmp

mkdir -p iso/boot/grub

cp /boot/grub/stage2_eltorito iso/boot/grub

cp /boot/grub/menu.lst iso/boot/grub

cp /boot/* iso

mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso

wodim speed=4 -eject dev=/dev/sr0 grub.iso

Remove the temporary files from your hard drive (not needed if your system is set to remove temp files).

# rm -rf /tmp/iso
# rm grub.iso

¹) Usually the easiest way to remind yourself which is which is to insert a finished CD in the drive and give the command: df

dvgevers Imported 2013 05 31 from http://wiki.mandriva.com/en/Docs/SysAdmin/Config/MakeBootCD (by same contributor)