Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Appendix A. Boot Devices

Automated installation (or kickstart) is an essential part of efficient system provisioning. This appendix describes how to prepare different types of boot media for use with kickstarting clients.
The Red Hat Enterprise Linux CD boot image boot.iso is a required prerequisite for creating boot devices. Make sure that this is available somewhere on the system and take note of its location.

Important

Install the syslinux and syslinux-extlinux packages to use the following procedures.
# yum install syslinux syslinux-extlinux
The syslinux package installs files in /usr/share/syslinux/ for Red Hat Enterprise Linux 6. If using Red Hat Enterprise Linux 5, substitute this directory with /usr/lib/syslinux/.
The syslinux-extlinux package installs tools for USB boot media creation.

Procedure A.1. CD and DVD Boot Media

Note

The backslash "\" is used below to represent a continuation of one line at the shell prompt.
  1. Create a working directory for the boot image:
    # mkdir -p temp cd/isolinux
    
  2. Mount the boot image to the temp directory:
    # mount -o loop boot.iso temp
    
  3. Copy the required files for a Boot Media device to the previously created directory:
    # cp -aP temp/isolinux/* cd/isolinux/
    
  4. Unmount the temp directory and change the permissions on the cd directory to be readable and writable to the user:
    # umount temp
    # chmod -R u+rw cd
    
  5. Change to the ./cd directory:
    # cd ./cd
    
  6. Copy the /usr/share/syslinux/menu.c32 file to the ./cd directory:
    # cp -p /usr/share/syslinux/menu.c32 isolinux
    
  7. Customize any boot parameters and targets in isolinux.cfg as needed for CD booting.
  8. Use the mkisofs to create an ISO to burn to a CD or DVD.
    # mkisofs -o ./custom-boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
        -boot-load-size 4 -boot-info-table -J -l -r -T -v -V "Custom Red Hat Enterprise Linux Boot" .
    
  9. Burn the directory to a CD or DVD to complete the procedure.

Procedure A.2. PXE Boot

  1. Create a working directory for the boot image:
    # mkdir -p temp pxe/pxelinux.cfg
    
  2. Mount the boot image to the temp directory:
    # mount -o loop boot.iso temp
    
  3. Copy the required files for a PXE Boot device to the previously created directory:
    # cp -aP temp/isolinux/* pxe/
    
  4. Unmount the temp directory and change the permissions on the cd directory to be readable and writable to the user:
    # umount temp
    # chmod -R u+rw pxe
    
  5. Change to the /pxe directory:
    # cd ./pxe
    
  6. Copy the /usr/share/syslinux/menu.c32 file to the /pxe directory:
    # cp -p /usr/share/syslinux/menu.c32 .
    
  7. Move the isolinux.cfg file to pxelinux.cfg/default:
    # mv isolinux.cfg pxelinux.cfg/default
    
  8. Remove the temporary files:
    # rm -f isolinux.bin TRANS.TBL
    
  9. Copy the /usr/share/syslinux/pxelinux.0 file to the /pxe directory:
    # cp -p /usr/share/syslinux/pxelinux.0 .
    
  10. Open the pxelinux.cfg/default file in your preferred text editor, and customize any boot parameters and targets as needed for PXE booting.

Procedure A.3. USB Boot Media

Warning

Be extremely careful when carrying out these command as root (required for most critical parts). These commands access device files and using them incorrectly could irrecoverably damage your system. The example below uses /dev/loop0 for mounting, make sure you use the correct device for your system. You can check which is the correct device using the losetup -f command.
  1. Create a working directory for the boot image:
    # mkdir -p temp usb/extlinux
    
  2. Mount the boot image to the temp directory:
    # mount -o loop boot.iso temp
    
  3. Copy the required files for a USB Media Boot device to the previously created directory:
    # cp -aP temp/isolinux/* usb/extlinux/
    
  4. Unmount the temp directory and change the permissions on the cd directory to be readable and writable to the user:
    # umount temp
    # chmod -R u+rw usb
    
  5. Copy the /usr/share/syslinux/menu.c32 file to the ./usb/extlinux/ directory:
    # cp -p /usr/share/syslinux/menu.c32 ./usb/extlinux/
    
  6. Move the usb/extlinux/isolinux.cfg file to usb/extlinux/extlinux.conf:
    # mv usb/extlinux/isolinux.cfg usb/extlinux/extlinux.conf
    
  7. Remove the temporary files:
    # rm -f usb/extlinux/isolinux.bin usb/extlinux/TRANS.TBL
    
  8. Convert the custom-boot.img file and copy it:
    # dd if=/dev/zero of=./custom-boot.img bs=1024 count=300000
    
  9. Discover the correct mounting location for the loopback device:
    # losetup -f
    /dev/loop0
    
    Set up the loopback device with the boot image:
    # losetup /dev/loop0 ./custom-boot.img
    
  10. Open the fdisk utility:
    # fdisk /dev/loop0
    
    Create one primary bootable partition on the device. This can be done by using the following key press combination: n p 1 Enter Enter a 1 p w
  11. Copy the master boot record (MBR) to the loopback device:
    # dd if=/usr/share/syslinux/mbr.bin of=/dev/loop0
    
  12. Add partition maps to the loopback device:
    # kpartx -av /dev/loop0
    
  13. Create the file system:
    # mkfs.ext2 -m 0 -L "Custom Red Hat Enterprise Linux Boot" /dev/mapper/loop0p1
    
  14. Mount the device:
    # mount /dev/mapper/loop0p1 temp
    
  15. Delete temporary files:
    # rm -rf temp/lost+found
    
  16. Copy the usb/extlinux/ directory to a temporary location:
    # cp -a usb/extlinux/* temp/
    
  17. Install the bootloader in the temporary location:
    # extlinux -i temp
    
  18. Unmount the temporary location:
    # umount temp
    
  19. Delete the partition maps on the loopback device:
    # kpartx -dv /dev/loop0
    
  20. Delete the loopback device:
    # losetup -d /dev/loop0
    
    Synchronize the file system changes:
    # sync
    
  21. Open the extlinux.conf file in your preferred text editor, and customize any boot parameters and targets as needed for USB booting.
  22. Transfer the image to a USB device to complete the procedure. Insert the device, and run the dmesg command to check the mounting location. In this example, it is /dev/sdb.
    Unmount the USB device:
    # umount /dev/sdb
    
    Copy the image to the USB device:
    # dd if=./custom-boot.img of=/dev/sdb