You are on page 1of 4

How to create a bootable USB disk with RHEL image..

Posted: October 17, 2008 in technorati Tags: rhel image, usb, usb boot 0 Rate This

In this scenario, we will have to format the USB drive, so please double check if you have any valuable data on the USB disk since this would be wiped off while formatting.

Connect the USB drive to the machine. In this case, we do not need the device to be mounted so if it is mounted automatically, it must be unmounted.

You can do it using the command :

(a) # umount /dev/sdX (where /dev/sdX is the device file name)

If the device was detected as /dev/sdb, the command would be umount /dev/sdb. The device could be detected as a different device file on your machine. On connecting the USB, you can do a dmesg | tail to check if the USB device is detected or not.

As the next step, we have to format the USB disk. We are using fdisk to format the disk.

(b) # /sbin/fdisk /dev/sdb (Assuming /dev/sd is /dev/sdb)

On executing the command /sbin/fdisk, you will be presented with the prompt Command (m for help): after a bit of details. If you select m, you will be presented with a list of options by which you can carry out the partitioning process.

From the list of options, we can see that p is used for printing the partitioning table.

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998519808 bytes 62 heads, 62 sectors/track, 1015 cylinders Units = cylinders of 3844 * 512 = 1968128 bytes Disk identifier: 0x59c07261

Device Boot Start End Blocks Id System /dev/sdb1 1 1936 1951456+ 6 FAT16

Command (m for help):

(c) If you see any partitions as above (most probably you would see one in FAT/VFAT), we will have to delete them. For deleting it, we can use the d command in fdisk. From the output of step (b), we can see that the USB disk has one FAT16 partition.

Command (m for help): d Selected partition 1

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998519808 bytes 32 heads, 63 sectors/track, 1936 cylinders Units = cylinders of 2016 * 512 = 1032192 bytes Disk identifier: 0x297029dc

Device Boot Start End Blocks Id System

Command (m for help): -

(d) Write the new partition table to the disk using w.

Command (m for help): w The partition table has been altered!

Calling ioctl() to re-read partition table. Syncing disks.

As the next step, we use the command partprobe to force the kernel re-read the partition table so that we need not re-boot the machine for the partition table to be effective.

(e) # partprobe /dev/sdb

As the next step, copy the diskboot.img file to the USB drive using the dd command. You will be able to find the said file in the isoimages directory of the installation disk. The dd (disk dump) command will dump the contents bit by bit so that its an exact replica.

(f) # dd if=diskboot.img of=/dev/sdb 24576+0 records in 24576+0 records out 12582912 bytes (13 MB) copied, 2.85287 s, 4.4 MB/s

Ensure you have the entire contents on the USB drive by mounting the media to the filesystem :

# mount /dev/sdb /media/ # ls /media/ boot.msg general.msg initrd.img isolinux.bin ldlinux.sys options.msg param.msg rescue.msg snake.msg splash.lss syslinux.cfg vmlinuz

Unmount the USB disk using the command :

(g) # umount /media

Now enable the BIOS option to boot from the USB drive on the machine you intend to install, connect the drive and boot. You must see the boot prompt after this step.

You might also like