Monday, December 7, 2009

Boot RHEL from USB

The following steps configure a USB pen drive as a boot medium to start the installation of Red Hat Enterprise Linux.
  1. Attach the USB pen drive to a system which is already running Red Hat Enterprise Linux.
  2. Run
  3. dmesg
  4. From the dmesg output, identify the device name under which the drive is known to the system.
    Sample messages for a 1 Gb flash disk being recognized as /dev/sdb:
  5. Initializing USB Mass Storage driver... scsi2 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 5 usb-storage: waiting for device to settle before scanning usbcore: registered new driver usb-storage USB Mass Storage support registered. Vendor: USB 2.0 Model: Flash Disk Rev: 5.00 Type: Direct-Access ANSI SCSI revision: 02 SCSI device sdb: 2043904 512-byte hdwr sectors (1046 MB) sdb: Write Protect is off sdb: Mode Sense: 0b 00 00 08 sdb: assuming drive cache: write through SCSI device sdb: 2043904 512-byte hdwr sectors (1046 MB) sdb: Write Protect is off sdb: Mode Sense: 0b 00 00 08 sdb: assuming drive cache: write through sdb: sdb1 sd 2:0:0:0: Attached scsi removable disk sdb sd 2:0:0:0: Attached scsi generic sg1 type 0 usb-storage: device scan complete
  6. Note: For the remainder of this article, we will assume this device name to be /dev/sdb. Make sure you adjust the device references in the following steps as per your local situation.
  7. At this point, the flash drive is likely to have been automatically mounted by the system. Make sure the flash drive is unmounted. E.g. in nautilus, by right-clicking on the icon for the drive and selecting Unmount Volume.
  8. Use fdisk to partition the flash drive as follows:
    • There is a single partition.
    • This partition is numbered as 1.
    • Its partition type is set to 'b' (W95 FAT32).
    • It is tagged as bootable.
  9. Format the partition created in the previous step as FAT:
  10. mkdos /dev/sdb1
  11. Mount the partition:
  12. mount /dev/sdb1 /mnt
  13. Copy the contents of /RedHat/isolinux/ from the first installation CD/DVD onto the flash drive, i.e. to /mnt.
    Note: the files isolinux.bin, boot.cat and TRANS.TBL are not needed and can thus be removed or deleted.
  14. Rename the configuration file:
  15. cd /mnt/; mv isolinux.cfg syslinux.cfg
  16. Copy the installer's initial RAM disk /RedHat/images/pxeboot/initrd.img from the first installation CD/DVD onto the flash drive, i.e. to /mnt.
  17. Optional step: To configure any boot settings, edit the syslinux.cfg on the USB flash drive. For example to configure the installation to use a kickstart file shared over NFS, specify the following:
  18. linux ks=nfs:://ks.cfg
  19. Unmount the flash drive:
  20. umount /dev/sdb1
  21. Make the USB flash drive bootable. The flash drive must be unmounted for this to work properly.
  22. syslinux /dev/sdb1
  23. Mount the flash drive again:
  24. mount /dev/sdb1 /mnt
  25. Install GRUB on the USB flash drive:
  26. grub-install --root-directory=/mnt /dev/sdb1
  27. Verify that the USB flash drive has a /boot/grub directory. If it does not, create the directory manually.
    cd /mnt
    mkdir -p /boot/grub
  28. Create the grub.conf file. Below is a sample grub.conf:
    default=0
    timeout=5
    root (hd1,0)
    title Red Hat Enterprise Linux installer
    kernel /vmlinuz
    initrd /initrd.img
  29. Copy or confirm the created grub.conf file is on the /boot/grub/ directory of the USB flash drive.
  30. Unmount the flash drive:
  31. umount /dev/sdb1
  32. At this point, the USB disk should be bootable.
  33. Attach the USB disk to the system you wish to install Red Hat Enterprise Linux on.
  34. Boot from the USB disk. Refer to the hardware vendor's BIOS documentation for details on changing the order in which devices are checked for booting from.
  35. Once you are booted in the Red Hat Enterprise Linux installer, continue with your network installation of your choice.
---------
Courtesy: Redhat.com
Reference: http://kbase.redhat.com/faq/docs/DOC-10553

1 Comment:

rax said...

Linux flash drive can provide a communication channel that is safe from a possibly compromised computer. linux flash drive