# Installing CentOS On An External USB Drive

I decided to get a dedicated server for my project and passion of the moment (more on that later, maybe). As a result, I wanted to set up a CentOS installation so that I could work out all the bugs before uploading. Unfortunately, it turns out that getting CentOS working on a USB drive is not as easy as, say, Ubuntu or Slax, and it took some googling before I got it to work.

## Installing CentOS To An External USB Drive

1. When you boot CentOS and get to the initial screen, type “linux expert”. This will enable you to format/partition your external USB drive.
2. When you reboot, reboot to the CentOS CD AGAIN and type “linux rescue”. This (should) mount your USB drive.[1]
3. Navigate to the /boot directory of your USB drive and rebuild the initrd for USB support with: mkinitrd --with-usb --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod --preload=sd_mod ./usbinitrd-X.X.XX-X.XXXX_LLL X.X.XX-X.XXXX_LLL. The right X.X.XX-X.XXXX_LLL codes can be seen under /lib/modules, just choose the appropriate one.[2]
4. Change your grub configuration to point to your new USB initrd.

Voila! CentOS goodness on an external USB drive.

[1]If your drive isn’t automatically mounted (or the wrong one is mounted), do a mkdir /mnt/usb; mount /dev/sda1 /mnt/usb, substituting the appropriate device for /dev/sda1. [2]See this forum thread for more details [3]Simon’s guide to USB booting is the canonical guide for RH

## Discussion

Comments are moderated whenever I remember that I have a blog.

Mark Payne | February 15, 2011
Hi there, Just installed CentOS 4.8 on a 16Gb OCZ Rally and it just worked out of the box! I didn't have to rebuild the initrd at all... hope this info helps someone.