Sunday, August 16, 2009

Easy Boot Flash Drive for Linux installs

I recently needed to install a CentOS image from a flash drive. Since it was a bit of a hassle to figure out how to make a flash drive bootable I figured I would document it here so others could benefit. This method assumes you have a Redhat or CentOS Linux machine available for this process and intermediate knowledge of Linux.

Things you will need:

• A thumb drive
• A bootable image “.img”
• A computer with Linux installed on it.

You can create an image using a utility such as DropDMG, or download one from the Internet. For this exercise we will use a CentOS (diskboot.img) image that I downloaded from http://mirrors.liquidweb.com/CentOS/5.3/os/i386/images/

Follow these steps to move the image onto your flash drive:

1. Save your image file to your home directory on your Linux machine.

2. Place the flash drive into the USB port on your Linux machine and use the dmesg (alternatively use fdisk –l) command to determine the device’s location.

sd 8:0:0:0: Attached scsi removable disk sda
sd 8:0:0:0: Attached scsi generic sg0 type 0
Vendor: SanDisk Model: U3 Cruzer Micro Rev: 8.02
Type: CD-ROM ANSI SCSI revision: 00
sr0: scsi3-mmc drive: 48x/48x tray
sr 8:0:0:1: Attached scsi CD-ROM sr0
sr 8:0:0:1: Attached scsi generic sg1 type 5
usb-storage: device scan complete

Note that the device location is sda

3. Using the dd command and the flash drives specific location (e.g. /sda) move the image to the flash drive

[root@newcastle ~]# dd if=diskboot.img of=/dev/sda bs=4096
3072+0 records in
3072+0 records out
12582912 bytes (13 MB) copied, 2.81418 seconds, 4.5 MB/s
[root@newcastle ~]#

You should now have a bootable flash drive that you can use to install Linux or run a Live CD image from USB.

Resources
Here is a great Ubuntu tutorarial for creating an Ubuntu flash drive install:

https://help.ubuntu.com/community/Installation/FromUSBStick

Windows Flash Drive Utility:

http://sourceforge.net/projects/unetbootin/files/

No comments:

Post a Comment