How to Make a Bootable CentOS 6 USB Drive

When making a bootable USB drive to install CentOS 6 from, you will need two primary partitions, one of them marked with the boot flag. One partition will be the boot partition and one will be a data partition that has the ISO file on it. As of this blog post, to make a CentOS 6 bootable USB drive, you’ll need a USB drive that has a little more than twice the space that your ISO file itself takes up. There is a bug that requires the ISO’s contents to be on the boot partition and the .iso file itself to be on the data partition. In essence you’re duplicating the ISO file and you still need some space left over for bootloader information. In my case, I’m using the minimal CentOS image, so space requirements are under 1GB.

At this point, go out and grab the CentOS ISO that interests you. Have it on your filesystem because we’ll be mounting it and copying some files from it. Once you’ve got the ISO you can move on to partitioning the drive.


First, you’ll want to partition the USB drive. We’ll be using plain ol’ MBR style partition tables and two primary partitions. I’m not going to hand-hold you through this part of the process. Use whatever partitioning tool you want and follow the guidelines below. GParted is fine if you use Gnome, parted is great if you want to use a shell, and fdisk works on both Windows and *NIX environments.

The partition layout will be thus:

  1. A primary partition that uses the FAT16 filesystem and is at least as big as your ISO plus about 50MB. You need to give it the boot flag.
  2. A primary partition that uses ext2 and is at least as big as your ISO. Preferably you’ll just use up the rest of your USB drive’s free space for this partition.

Once your partitions are set up, we’ve got some file moving to do.

Setting the Filesystems Up

You’ll want to mount your two partitions so that you can access them. In my case, the first partition (the FAT16 boot partition) is /dev/sdc1 and the data partition (the one formatted in ext2) is /dev/sdc2. I’ve mounted sdc1 as /mnt/usbboot and sdc2 as /mnt/usbdata. I will be using that nomenclature throughout the rest of this post.

You’ll also want to mount your CentOS ISO as a filesystem because we need to copy some files off of it. In my case, I ran mount -o loop /path/to/iso/file.iso /mnt/centosiso and will be using /mnt/centosiso in my examples below. Now that we’ve got all of our filesystems mounted, we’ll start the procedures.

First, go to the mounted CentOS iso and copy the /isolinux directory to the boot partition of the USB drive.

cp -r /mnt/centosiso/isolinux /mnt/usbboot

Rename the isolinux folder on the USB drive to syslinux

mv /mnt/usbboot/isolinux /mnt/usbboot/syslinux

Rename the isolinux.cfg file to syslinux.cfg

mv /mnt/usbboot/syslinux/isolinux.cfg /mnt/usbboot/syslinux/syslinux.cfg

Now we need to copy the contents of the /mnt/centosiso/images folder to the USB boot partition. Notice that I emphasis that this is a copy of the contents within the ISO’s images folder. A little later on we’ll be copying over the entire ISO as a file.

cp -r /mnt/centosiso/images /mnt/usbboot

Finally, we copy the .iso file itself to the data partition (not the boot partition that we were just working with!):

cp /path/to/iso/file.iso /mnt/usbdata

Once all that is done, we have to install a bootloader. I’ll use the simple syslinux loader. We want to use our smaller volume (the one that we set the boot flag on up in the partitioning section) as the target for the syslinux command.

syslinux -i /dev/sdc1

Now, we dismount our USB drive and test it out by booting from it on another system!



You should now have a bootable CentOS 6 USB drive. CentOS 6 is somewhat unique as a result of the bug that requires the images directory to be included on the boot partition, but other than that it’s relatively straight forward.


  1. Pete Gandy

    August 22, 2012 at 4:33 pm

    Had to comment just because you did such a good job on this and I like cats. As a matter of fact I just lost one lowering my population to just nine of them. Several of mine obey some commands. The one right here right now immediately lays down on command. She learned it by standing front of my monster and I pressing down lightly on her back while saying: “lay down GiGi.”

    Several of my cats used to lay on my monitor, “warm you know.” You should have seen this one when she attempted to just hop on top of the monitor the day I upgraded to LCD flat panel. I was sure the screen was going to be destroyed with only ten minutes use. However she managed to gain some somnolence of balance enough to hop down behind it. Strangely enough her back claws didn’t destroy or damage the screen either. Must have been my lucky day!

    I too am self employed and unfortunately I do support Micro$not laptops. Need the money. Hard to make converts but do get a few. I’m retired but Mr. Obama Bin Lyin destroyed my retirement so I contract to make a little as no one will allow a very healthy old man to work. Yet I do contract to fly commercially. Oh well. Here’s hoping Obama Bin Lyin doesn’t declare Marshal Law and forbid voting in November.

    I run Fedora on my Eee PC laptop and I’m sure it has a root kit on it but it is so well hidden that no way can I find it with any of the root-kit finders. I tried RK hunter and others as well as an update ClamAV or Clamscan. Guess it modify the files fast as I install them. I had the boot problem last night when attempting to make a boot USB to run clean scanners from. I’m now at my email server going to make the USB again. This time I’m going to use your method rather than the BOOTUSB maker file I used. It’s probably compromised too.

    This server is behind two NAT servers with an iptables firewall on each as well as from the AT&T DSL box. The server it’s self is CentOS-6 up to date running nothing but Postfix and Dovecot with arno-iptables-firewall heavily modified by………. yup me. Hopefully it’s clean.

    I run Fedora on the laptop because Centos is way way slow on it. Fedora goes nicely! The laptop is, “as I said” Eee with dual core, 2GB RAM and a 4GB hd. I buy them on Ebay “for parts only” and build system for me and friends from them. Bought two of them for $40.00 each and made one for my wife. Later had to use the keyboard from the spare for mine. Stuck number 9 key was killing me as my passwords all include at least one number 9. My personal password has five number 9’s in it. All passwords are long. All except one are 16 or more. Again had to say thanks foe the nice little write up and the cat.

    Pete Gandy
    Cleveland, TX

    P.S. Here’s hoping Obama Bin Lyin doesn’t declare Marshal Law and forbid voting in November.


    • Wesley David

      August 22, 2012 at 10:26 pm

      You are a hero among legends.

      Hope the boot USB works out. It was an irritating experience for me. Hopefully less so for everyone else. =)


      • JaymesJ

        January 2, 2013 at 11:34 pm

        I successfully completed all steps; however, when I reboot and select “Install or Upgrade an existing partition” it just reboots. Same for the 2nd option.
        Any ideas where I went wrong?
        Thanks a ton for the write-up.


        • Wesley David

          January 4, 2013 at 1:03 pm

          I… I got no ideas. =(


  2. Angel

    April 28, 2013 at 8:54 pm

    How could you add a kickstart file to boot from the network? What is the big picture?



    • Wesley David

      April 29, 2013 at 11:34 am

      That I don’t know, sorry. =(


Leave a Reply

Follow TheNubbyAdmin!

follow us in feedly

Raw RSS Feed:

Contact Me!

Want to hire me as a consultant? Have a job you think I might be interested in? Drop me a line:

Contact Me!

Subscribe via Email

Your email address is handled by Google FeedBurner and never spammed!

The Nubby Archives

Circle Me on Google+!

Photos from Flickr

Me on StackExchange

The IT Crowd Strava Group

%d bloggers like this: