Make Raspbian run from an external USB hard drive or USB memory stick

Raspberry Pi can ONLY boot from the SD Card. If you want to use your Raspberry Pi from an external USB hard drive or memory stick, either way you have to install Raspbian in an SD Card an boot from it. You can see how to do it with Mac OS X in “Install Raspbian RAW image into an SD Card in Mac OS X“. Once you have Raspbian installed in the SD Card you have to do just the same in the USB hard drive or memory stick of your choice.


Plug-in the SD Card to your computer and edit the file cmdline.txt in the boot partition from this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

To this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait

You only have to change the root option to boot from /dev/mmcblk0p2 to /dev/sda2.

Now you’ll boot from the SD Card but the boot system will load the system in the USB drive. That’s why we also installed Raspbian into it. Plug both the SD Card and the USB drive into your Raspberry Pi and boot normally.

raspi-config will show you all the options you can configure (enable SSH server, configure the timezone, etc.) but unfortunately it can’t resize USB drives so we’ll have to do it ourselves.

Run fdisk:

sudo fdisk /dev/sda

Press p to see the partitions. You’ll see something like this:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/sda2          122880     5785599     2831360   83  Linux

Write down the “Start” number in the /dev/sda2 partition because we’ll need that number when we define the new partition. In my case it is 122880. Press d and then 2 to delete that partition (don’t worry, the data on it won’t be deleted).

Create a new partition pressing n, press p for primary partition and then 2 for the partition number. When asked for the first sector use the number we writed down before (122880) and then when asked for the last sector just press enter. Finish the process pressing w to write the changes.

Reboot your Raspberry Pi:

sudo reboot

When Raspbian boots again the last step is to resize the partition:

sudo resize2fs /dev/sda2


You might also like

Stop Spotlight from indexing external hard drive
If you don't want Spotlight to index an external driver or a USB flash drive you only have to add an...

Enable SSH server in a headless Raspberry Pi
Raspbian come by default with SSH server deactivated so if you have a headless Raspberry Pi you won't...

Install Raspbian RAW image into an SD Card in Linux
First download a Raspbian RAW image from here: your SD...

Split and join large files using cat, split and tar
I was going to store a CentOS DVD iso file into my external hard drive but the image was bigger than...

  1. He seguido todos tus pasos, pero me pregunta después de crear una nueva partición, si la quiero 1 primaria, 0 extendida ó 3 libre. Cual debo poner? Muchas gracias

  2. Hello, I tried something like following your tutorial.
    I copied the entire contents of my sdcard to hd using dd, as (I think) is an exact copy of the sdcard I do not think there would be problems but it happens that whenever I edit the cmdline.txt to /dev/sda2, when I reboot the system does boot from sdcard and the cmdline changes to mmcblk0p2 again :/

    Have you any idea what it might be?
    (sorry my bad english, i’m Brazilian)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.