Brool brool (n.) : a low roar; a deep murmur or humming

Installing CentOS On An External USB Drive

 |  coding linux

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


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

Mark Payne | 2011-02-15 07:54:14
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.
Shayne Brandon | 2011-04-03 02:13:31
Hi from me too! I just installed CentOS 5.5 onto a 32GB USB flash drive using step 1. Had to use the "linux expert" since the generic installer didn't show my usb flash drive. Even though I told it to install the OS to the flash drive on sdb, it only wanted to put grub on sda so I opted out of installing the bootloader. Needless to say, it wouldn't boot after the install. Used step 2 to get to a shell. chrooted to the flash drive and used grub-install /dev/sdb1 to get grub on it. Still wouldn't boot because there was no grub.conf. Used step 2 again and created a simple grub.conf. I'm now running CentOS off a flash drive for demos of our work. When demo is over, remove the stick and reboot. Thanks! Shayne
Add a comment