Install and run Raspbian from a USB Flash Drive

In this tutorial, I’m going to talk you through running Raspbian from a USB connected drive instead of from an SD card. If you run Raspbian from a USB Flash drive, you will enjoy performance boosts, speed and reliability improvements just to name a few benefits.

SD Cards have a limited read/write cycle, and when hosting a site with a MySQL database from a SD card, it won’t take long before you start getting corruptions and failures. USB Flash drives provide a cheap and reliable alternative. I’ve tested several USB Flash drives, and found Sandisk and Corsair to be the best for speed and reliability. This site is run off a 16GB Corsair Voyager 3 USB Flash drive.

Assumptions before we begin

I’m going to assume that you know your way around Terminal, and are using a Mac to perform these steps. You will still need an SD card to store the boot instructions to tell the Raspberry Pi to launch the OS from the USB; the Raspberry Pi’s can’t (yet) boot directly from a USB storage device.

Step 1 – Download Raspbian from Raspberry Pi

You will need the standard Raspbian OS image, you can download this from the official Raspberry Pi website. Once you’ve downloaded it, unzip it. It’s around 400mb in size, so should only take a couple of minutes over a broadband connection.

Step 2 – Install the Raspbian OS to your USB Flash drive

Plug in your USB stick and launch Terminal. The first thing we’re going to do is get the device identifier for your USB Flash drive. To do this run the following command:

diskutil list

The list of attached disks will show up with their identifiers. Important – make a note of the correct identifier, you can do some serious damage by choosing the wrong one!

Boost Raspberry Pi Performance

In the screen shot above, I can see that /dev/disk2 is the correct identifier for my Sandisk USB Flash Drive. Yours may be different so change to suit your configuration. Next we’re going to unmount the USB Flash Drive. To do this enter the following command:

diskutil unmountDisk /dev/disk2

Yet again, be really careful to change disk2 to whatever your computer identifies the USB Flash Drive as. You will get a message saying

“Unmount of all volumes on disk2 was successful”.

Now we can begin the copy. For ease, I’ve changed the directory in Terminal to where the Raspbian image is located, which in this case is my downloads folder. If you’ve downloaded and unzipped the disk image to your downloads folder, running this command should take you there:

cd ~/Downloads/

Now run this command to begin the copy:

sudo dd bs=1m if=2013-02-09-wheezy-raspbian.img of=/dev/disk2

As with before, make sure you change disk2 to whatever your computer identifies as being the USB Flash Drive, and change 2013-02-09-wheezy-raspbian.img to whatever your image file is called. The blocks will now begin moving to your USB Flash Drive from the Raspbian OS image. This takes anything from 5 to 20 mins depending on the speed of your USB Flash Drive. Go stick the kettle on and have a brew!

Run Raspbian from a USB Flash Drive

Eventually, you will see something similar to the above, and it probably took a while too. The next step is to configure your SD Card to give the correct boot instruction to start the OS from the USB Flash Drive

Step 3 – Configure your SD card

Using Disk Utility, format your SD Card using FAT32. It’s dead easy, choose your SD Card from the devices listed on the right, then click on ‘Erase’, choose FAT32 in the Formats list and click on ‘Erase’.

Boost Raspberry Pi Performance tutorial

Raspberry Pi boot from USBOnce you’ve done this, you’ll notice on your Desktop, there are two mounted volumes; one is your USB Flash Drive, the other is your SD Card.

Open up the USB Flash Drive volume and copy all the files from that onto your SD card. This copies the all-important files and instructions to tell your Raspberry Pi to boot from the USB Flash Drive. We’re almost done at this point, only one more step to go.

Step 4 – Change the boot path on your SD card

Once you’ve completed step 3, you need to change the default boot path to tell the Raspberry Pi to boot from your USB drive. Open a new Finder window and go to your SD card. Open up the file called cmdline.txt in TextEdit or similar and amend the line which reads:


To this:


This will instruct your Raspberry Pi to boot from the USB Flash Drive instead of from the SD card. Save the cmdline.txt file and close the Finder window. We’re almost done!

Step 4 – Boot from your USB Flash Drive on your Raspberry Pi

Now unmount both your USB Flash Drive and your SD card and pop them both into your Raspberry Pi and switch it on. If all goes well, it should boot from your USB Flash Drive which you’ll find substantially quicker than your SD Card.

Step 5 – Expand the Raspbian partition on your USB Flash drive to fill it

Finally, we’re just going to do a little housekeeping to utilise all the available space on your USB Flash drive as the method using raspi-config doesn’t work on USB Flash drives. This isn’t essential, but if you have the extra space on a USB Flash Drive, why not use it all?

From your Raspberry Pi, type the following command to start FDisk:

sudo fdisk /dev/sda

Then press p and enter to see the partitions. There should only be 2. What we’re going to do now is delete the Linux partition, but before we do this, we make a note of the start position for the linux partition sda2. Press d and then when prompted type 2 and then hit enter. This will delete the partition.

Now we’re going to create a new partition, and make it large enough for the OS to occupy the full space available on the USB Flash Drive. To do this type n to create a new partition, when prompted to give the partition type, press p for primary. Then it will as for a partition number, press 2 and hit enter.

You will be asked for a first sector, set this as the start of partition 2 as noted earlier. In my case this as 12280 but this is likely to be different for you.

After this it will ask for an end position, hit enter to use the default which is end of disk. Now type w to commit the changes. You will see a message about the Kernel using some table yaddah yaddah, just ignore this. Type the following to reboot:

sudo reboot

Once your Raspberry Pi has rebooted, we need to resize the partition. To do this type the following command:

sudo resize2fs /dev/sda2

Be patient, this will take some time. Once it’s done reboot again. Then type:

df -h

This will show the partitions and the space, you’ll see the full USB Flash Disk has all the space available now.

Run Raspbian from a USB Flash Drive

That’s it! You’re now up and running from a USB Flash Drive. This is a quick, cost effective way of improving the performance of your Raspberry Pi. Hopefully in later models, you’ll be able to do this natively without a boot SD card. Any questions or thoughts, please comment below.


Web Developer living in Manchester, working for Studio Skylab ( Views and thoughts are my own.

You may also like...

124 Responses

  1. Physics_Dude says:

    Thank you Ste!
    Your tutorials are always the best!

    • Ste W says:

      Why thank you! Sorry it’s taken so long for me to write this. Next up – install WordPress without having to install a FTP server.

  2. Ebullient says:

    Thank you so much for this! I use the Pi as an offline wireless server for meetings and events. It will be better to serve the web apps out of USB.

    • Ste W says:

      Hi glad you found it useful, sorry its taken so long to write up! How have you found the raspberry pi for acting as a router performance wise?

    • Rod says:

      @Ebullient: How is that working for you? I’m considering using my pi for the same function. A web/file server for meetings where we need to share files or engineers need to download the latest releases, etc.

      • ebullient says:

        I have used the wireless media server — not connected to the Internet — at various events and most recently with the Pi, to serve a website as a program guide to theatre attendees at an arts festival.

        That was using Lighttpd, but currently I use the somewhat simpler-to-configure Pancake webserver for Pi from

        Also hostapd which enables use of a USB Wi-Fi dongle connected to Pi. (The dongle must be capable of acting as an access point — not all such devices are capable).

        Attendees tell me they prefer this over printed materials. It has amazed me how quickly they discover the site on their phones and tablets, even before announcements about it..

        All connections are redirected to the internal webserver. Going forward I am working on a control panel that enables the admin to change the Wi-Fi SSID, transmission channel, see a list of connected users and edit the website that is broadcast. And — shut down the Pi properly without SSH or access to the desktop GUI.

        Such servers could be used in situations where content and interactive apps should be broadcast in the immediate area, and Wi-Fi Internet connectivity is not provided, often for cost reasons. Other projects such as LibraryBox, PirateBox,, Byzantium Linux and OccupyHere are working on various pieces of this puzzle from other approaches.

        Thank You to the Dingleberry editor for focus on servers.

  3. Nathan says:

    Ste, If only you had done this a few weeks ago. Would have solved a lot of hassle.

  4. mruczek says:

    Great tutorial 🙂

  5. Kevin Bray says:

    This is a great guide, which I used and it worked really well. The idea behind this is to avoid wearing your SD card out from the IO required to run the OS, so you offload that to the USB stick instead – so it’s ironic how my USB stick died on me only 2 weeks later 🙁

    For anyone else attempting this – I’d suggest you avoid Kingston DataTraveler Micro’s. They are really small and convenient for this purpose, but have a shorter lifespan than an SD card!

    • Ste W says:

      Choosing the right USB Flash is important, I tried a few and found the Corsair Voyager III to be the best. They were quick and rock solid. The Sandisk flash are reliable, but not as quick.

      I’d say its really worth spending a little more on getting the Corsair for this purpose.

  6. Matthew Poertner says:

    Awesome, thanks for the great write-up. I can see a huge performance increase using a USB flashdrive for my OS. Question though. Can we delete the old boot, FAT32 partition and take advantage of the whole disk?

    • Ste W says:

      Yea, you could do, there’s no reason not to! I think I should include this step in the tutorial. Glad you found it worked for you to get performance gains from your Pi

  7. Jesse says:

    First off, I would like to say that this site was the final push that got me to buy and set up a Pi to replace an older PC I was using as a personal Linux server. Bought it, configured it, and love it.

    Second off, thanks for this guide. I didn’t have a Mac but the steps are similar enough that I was able to use Ubuntu to do it.

    So here’s my current challenge. I have two USB disks plugged into my Pi: a USB flash drive from which the OS is run (per this guide) and a USB hard drive to store mass quantities of data. I find that it is impossible to say consistently which device will be sda and sdb when the Pi boots. I would love to be able to say “root=[UUID]” in cmdline.txt however Raspbian’s boot loader doesn’t work that way.

    Has anybody else encountered this challenge, or come up with a good solution?


    • Luke Gaddie says:


      I haven’t tested this yet as I’ve just followed this tutorial myself, but I wonder if it would be possible to use a udev rule to create a symlink to the correct device on /dev.

      More information regarding udev rules on debian can be found on the Debian Wiki.

      I know in the past I’ve used a udev rule to make sure that any flash drive plugged in was automatically mounted to a specific position.

      KERNEL=="sd*", SUBSYSTEMS=="usb", SYMLINK+="customer_drive"

      ACTION=="add", SUBSYSTEM=="block", RUN+="/usr/bin/ add"

      ACTION=="remove", SUBSYSTEM=="block", RUN+="/usr/bin/ remove"

      #Accepts the input "add" or "remove" and accordingly mounts the
      #customers flash drive to /media/customer_drive or unmounts it.
      #The remove option may not be needed, but it has been kept in case
      #we decide to prompt the customer to remove it.

      usb_add() {
      mkdir /media/customer_drive
      mount -o uid=kiosk,gid=kiosk /dev/customer_drive /media/customer_drive

      usb_remove() {

      umount /dev/customer_drive /media/customer_drive
      rm -rf /media/customer_drive

      case "$1" in








      echo -e "usage $0 add|remove"


      exit 0

      In addition, I’ve also used this one-liner to make sure that a specific device (in this instance, a USB MagStrip reader) is always symlinked to the same position:

      KERNEL=="hidraw*", SUBSYSTEMS=="usb", ATTRS{manufacturer}=="IDTECH", ATTRS{product}=="IDTECH MiniMag II USB-HID Reader", SYMLINK+="cardreader", MODE="0764"

      Hope that helps,

    • jacobmob says:

      Use the PARTUUID instead, so root=PARTUUID=XXXXXX

  8. Clucksworth says:


    I think there may be a typo

    “sudo dd bs=1m if=2013-02-09-wheezy-raspbian.img of=/dev/disk2”

    barfs..I used “sudo dd bs=1M…”. Seems the m needs a cap. (dd:invalid number “1m”)

  9. Do you need to plug the USB thumb drive into the Pi or will it work from an external USB hub as well?

    • Ste W says:

      Don’t quote me on this but I think that if the USB hub was a powered one, this may work. Never tried it though, but will give it a blast some time.

  10. Victor says:

    Hi, great tutorial. Just one thing: Why is dd image so slow? Normal copy speed ~30MB/S for my usb but dd bs=1m only transfer at 1.6MB/s stable. How to fix it?

    • munky dragger says:

      dd3 works a lot faster and shows you the progress. If you have heard of, that is as easy as it gets. Just my 2 suggestions. As far as dd goes though, it may be slow, but it is reliable.

  11. graham brown says:

    do you need to change /etc/fstab at all for this to work properly? it appears to but i’m a sucker for doing things the linux way

  12. Anahata says:

    My Raspberry Pi (which I’ve only had for about a month) has an external USB hard disk – but it never occurred to me that I could make it boot from a USB device.

    I’d question the logic based on SD cards’ limited write cycle life time – that’s quite true, but I think a USB flash drive uses exactly the same technology and therefore also has limited write cycle lifetime. Are you sure you’re any better off from the reliability point of view?

    I’ve mounted my external HD on /home, also put a small swap partition on it, and intend to put any frequently written directories on it, so the SD card won’t be written to much – mostly log files. If it breaks, I’ll consider putting the whole system on HD, especially after reading this article.
    The HD data transfer is nearly twice as fast as the SD card, which makes such a change quite tempting.

  13. Pomeroi says:

    I agree with Anahata on this as aren’t they they same memory and tech on both the SD and USB stick? My thoughts however were on this matter as I have 1 coming and another being delivered a week after that. Would I be able to remove to SD card once the USB stick has booted and is running ? (This to start the process on a second pi ) I think this is a good question as in theory you could run multiple pi’s with only the one sd card for initial start-ups. I also wonder why the pi isn’t looking for a start-up disk on start up but that’s another already asked discussion I’m sure . Thanks for the tasty condiments to go with my pi.

    • Ste W says:

      You’re both absolutely right, they are based on the same technology, except are intended to be used differently. USB Flash drives tend to be more reliable inherently as they are intended for regular data movement in a way that’s more irregular in size than SD. With SD, generally it tends to be the reading that lets them down, they’re designed for fast write due to their use predominantly in digital cameras.

      In my own tests on the Raspberry Pi, USB flash drives are considerably quicker. I tried several high-end SD cards, and found nothing to be a patch on the Corsair Voyager USB flash, and it didn’t take long for MySQL corruptions to occur on the SD cards either.

      As for not being able to directly boot from USB instead of having to rely on SD for the instruction, I haven’t a clue why this is, but I see it as a slight oversight of the Pi foundation, surely more people have a spare USB flash floating around than a SD? card!

      • Wiredsage says:

        It’s not an oversight on the Pi foundation. To be able to boot from USB or SD, you’d need some type of firmware or bios on the Pi. One of the Pi’s unsung strengths is it’s lack of firmware! Nothing for the NSA to corrupt and root. I’ve got a ton of old 64MB SD cards that are just the perfect size for a boot SD only. Hardware write protected = Invulnerable to malware.

  14. Charlie says:

    How would you go about removing the unnecessary FAT32 /dev/sda1 and expand /dev/sda2 to take over the space? I know it’s only, what, 58MB? Out of 32GB in my new USB flash drive… But it’s 58MB that could be in my main filesystem and instead is cluttering the partition table.

    I suppose we could install to a 2GB SD card temporarily, create a new blank partition on the USB drive, and dd it over. But that means starting over – I’m using a 128MB card for boot currently.

    For those who get confused about how to run the commands when the initial text-based setup menu is displayed: Alt-F2 and use the default pi login. Alt-F1 to go back to the menu.

  15. Charlie says:

    Yeah, I have to wonder about the requirement for booting from SD also. Maybe there’s a chipset-enforced rule. Would make more sense to me if they dropped the SD slot entirely and populated the physical space with another pair of USB ports.

  16. buhala says:

    Any way to do this on Windows? I don’t have a mac handy.

  17. Luke Gaddie says:


    Great tutorial! Very well thought out and written.

    Just wanted to let you know that I was able to follow your directions to also install Pidora, merely replacing the Raspbian image with the Pidora one.


  18. Dams says:

    Thanks for this great tutorial, its exactly what i was looking for !
    So due the fact that the Raspbian OS is on the USB flash drive, if i am using the command “install” to install let say PHP or something else, its going to be installed on the USB flash drive and not the SD card ? Or i need to use a more complex command line ?
    My concern is that i would like to install PHP and MySQL on the USB flash drive not the SD card.

    Thanks again.

  19. De La Pommeroi says:

    Help ! But I hope I help first with my shortcut if indeed it is. My error was tiny but my questions after are huge thats why I’d like a little help. I hope this shortcut is as good as I think. I had another sd card of wheezy so let that be a warning for fellow new guys if you try this easy approach. I opened the cmdline.txt in leaf pad in a root folder from the wheezy desktop and changed it to /dev/sda1 (by mistake the first try ! It needs to be 2 as 1 is the boot ) and saved it. I then put my other working sd card in a reader and it worked. I can edit that cmdline.txt file to go back to the original sd card later if I edit it. I did try a raspbmc install after I dd ‘d the image to a usb flash drive but had a fatal error after user pi set up. My thoughts are to try again with a dd’d sd to usb drive. Any thoughts though ? Can I have a drive partitioned say with multiple OS ‘s ? I did notice python not starting up on the raspbmc sd card I have through the a usb reader but it did run well as did wheezy. Any thoughts on all this guys ? I hope my questioning why not try this is a shortcut but is it problematic ?

  20. fboteroh says:

    I haven’t tried it yet. However I got a question: Would you need the SD card any ways? I mean, even if you boot from USB flash drive? Tks.

    • mark5616 says:

      yes you still need sd card. because RPI always boot primary from it, and sd card is configured to boot from usb flash drive … so to this boot redirection purpose you can use slow, old, small sd card …

  21. Megan M says:

    I wonder what size flash drive would be big enough to hold Raspbian comfortably and allow for future expansion. I plan on having all the operating system files on the flash drive and then using a hard drive attached to the Pi as storage to share over the network. Do you think 8GB would be enough or would 16GB or 32GB be better?

  22. Jesse says:

    The presence of an SD card is required in order for the Pi to boot. This is just an inherent nature of the Pi’s design. As long as the SD contains the appropriate boot configurations, Raspbian can then be loaded off of anything, such as a USB drive as in this tutorial.

    @Megan M,
    I was able to get by just fine using an 8GB USB drive. With all said and done I have the OS occupying only 3GB of that. Because I use a USB hard drive to store the bulk of the data that my Pi serves (same as what you are describing), 8GB is plenty of breathing room for the OS.

  23. Lawrence says:

    Very nice! Thanks a bunch! My Pi is rebooting as I type this after the last step and I’m as happy as can be! Super nice tutorial! Easy to follow and bang on!


  24. Oscar Meanwell says:

    Very well written guide! Many thanks. Worked perfectly

  25. vincent says:

    is it possible to apply this using windows command line?

  26. advait says:

    nice!! but i think that berry boot is better as it helps to multi boot from a single source be it a usb drive or hard disk or sd card so u don’t need to do this

  27. Pea says:

    fdisk -l doesn’t work for me (OS X 10.7.5) to list the partitions. I use:

    diskutil list

  28. Elliott says:

    I plan to build a music server with the Pi and a 1TB hard drive. Could I install the OS on this hard drive, or can you think of any reason why it would be better to use a second drive, a small USB stick? I will make regular backups of the 1TB drive either way.

    • Julian says:

      If you use a USB stick you probably can do energy saving stuff with the hard drive which you can’t do if your system runs on the drive 😉

  29. virre says:

    thank you very much for this tutorial! It realy speeded up my pi!!! 😀

  30. Markus says:

    Thanks for the tutorial- I used an external 2,5″ HDD enclosure and a powered USB hub.
    With a 64GB Hard disk thePi works really nice, boot time is much shorter than from the SD card. I now use a 512MB SD card for booting (It could be even much smaller but this was the smallest one on the scrap pile).
    Under Linux if you have a working install of your raspi you can simply do the following:
    Take an USB external HDD, create 1 partition on it, mkfs.ext4 this partition and then copy everything from the Data partition of your SD card onto the USB harddisk.
    Change the cmdline.txt on the SD and the /etc/fstab on the disk and it simply works 🙂

  31. Kaba says:

    TX very much for this tutorial. I followed step by step and its works like a charm. I am running Redmine on it and use a 64GB USB Sandisk FlashDrive. I am now looking to find a proper backup solution.

  32. Ryan Plant says:

    Fantastic tutorial. Went swimmingly for me. Been battling sd card corruption for months now, on one of the Raspi’s. Really looking forward to not having to reinstall Raspbian every two weeks, here on out. Thanks!

  33. Philip Reitz says:

    I have followed the instructions carefully, but neither the SD card nor USB flash drive (Verbatim Store-n-Go, 16gb) would boot (only the red pwr light ever shows up). When I restore cmdline.txt to original, the SD card boots fine and the USB drive appears fine also, although not mounted (of course). I do notice, however, that when the USB dive is plugged into my Win7 laptop, the file system shows as EXT3, not EXT4 as in the fstab config file. Could this be a problem?

    I have tried with various SD cards and USB flash drives and instructions from other websites, but all with same non-results. Any clues or things to look at such as log files, config files, etc.?

    • Ron says:

      I had no success for the first half dozen attempts. The way I finally made it work was to format my flash drive using gparted under Ubuntu. Delete all existing partitions from your usb stick, and then format the entire thing as one partition to ext4. Then follow the guide on this website verbatim – again using Ubuntu Linux – to ‘burn’ the .iso image of Raspbian to the usb stick. Most of the commands in the bash terminal in Ubuntu are very similar to the ones for Macs (or at least I gather from this article, I’ve never owned a Mac). Once the image is on the usb stick, the rest proceeded as advertised in this guide. Just change the cmdline.txt file per the instructions and away it goes.

  34. Ron says:

    Great guide. This is the only one on the web I was able to make work. The one thing missing that you might want to include is that the USB stick should be formatted to ext4, because most of them come formatted xfat. I used gparted in Ubuntu to prepare the usb stick and it worked great.

  35. Jesse D. says:

    1. If you use this the the speed and size of your SD card matter?
    2.Will improve web browsing speed?
    3. Will this improve video speed?

  36. Julian says:

    Thank you for this tutorial.
    Probably you want to change your example for the offset of the second partition from 12280 to 122880.

  37. dave says:

    This has worked perfectly for me, thank you for a great tutorial! However, if I add a second USB flash drive (to use for general storage) the pi won’t boot. I assumed this was because it was allocating “sda” to the second USB drive and not the one I wanted to boot from. So to try and get around this I edited /etc/fstab and added two lines – one with the UUID of the partition on the flash drive I wanted to use as my root filesystem and the second line with the UUID of the general storage flash drive which is mapped to a mount point in my home directory. This still hasn’t worked unfortunately 🙁

    Is there a solution to this? Thanks in advance!

  38. jo says:

    In the case of a GPT based partitioning:
    Run parted on your device: parted /dev/sdX
    Change display unit to sectors: unit s
    Print current partition table and note the start sector for your partition: p
    Delete your partition (won’t delete the data or filesystem): rm
    Recreate the partition with the starting sector from above: mkpart primary -1
    Exit parted: quit
    Check the filesystem: sudo e2fsck -f /dev/sdXX
    Resize filesystem: sudo resize2fs /dev/sdXX

  39. Matt says:

    I don’t understand the instructions for resizing the USB drive. The instructions say to delete the Linux partition and create a new one but don’t we want to delete the FAT32 partition? Isn’t that the point to reclaim the space it takes up?

  40. Connor says:

    Awesome little tutorial, thanks! Only thing I’d change is I ran into an issue where fdisk said my sector was already allocated… to fix this I just simply hit ‘w’ after deleting the partition and then continuing the steps from there. Also rebooting couldn’t hurt.

    Thanks so much


  41. Ray Sattaur says:

    Hi, I’ve just bought a RPI 2 and would like to boot from a USB thumb drive. So I’ll try this out when the new PI arrives. I ‘m new to RPI and Linux so forgive what may appear to be a naive question. Would I have to do anything additional whenever I update or Upgrade the PI?

  42. tschaerni says:

    Open a new Terminal, use the oneliner:
    sudo watch -n 1 kill -USR1 $(pidof dd)
    to show the progress of dd 😉

    PS: the output will be on the first Terminal

  43. Alex Ellis says:

    Just a thought, but there’s nothing to stop you running the system from your magnetic HDD or SSD. If you’re running a NAS or blog then chances are you also have one connected. I guess a USB pen drive will also have a relatively limited number of write cycles compared to HDD etc.

  44. scott kellerman says:

    Just a note, when you change cmdline.txt to point to usb drive and then reboot, ths rpi is actually still “booting” from the sdcard. The difference now is that once the rpi is booted, it now uses the”root” partition on the usb drive. Essentially, all your programs are in the root partition, which is where most disk reads and writes occur, saving your sdcard from wear and tear and potentially speeding things up if you usb drive is faster than your sdcard. The take away here is that the rpi MUST always, always, “boot” from the sdcard by design so, you cant go and erase the boot partition of your sdcard. If you do, your rpi will fail to boot! You can, however, erase and reformat the sdcards root partition, but i don’t recomend it in case you ever want to return to your old configuration.

    One other thing, remember to change cmdline.txt on the sdcard but the fstab should be modified on the usb drive! -cheers!

  45. semundja says:

    thanks for the instruction

  46. buchninja says:

    It worked! Awesome! Do you have an idea on how to backup this setup now correctly? Might be an idea for another tutorial. cheers

  47. Dazbobaby says:

    I’ve just had something strange happen after I did this.
    My Router reports the IP of .87 for the Pi.
    Yet my Pi reports and IP of .90

    And I can only connect to the Pi via SSH on .90

    Is there a head scratching smilie on here, because that’s me?

  48. Great tutorial. The SD card was being a headache and now my Raspberry seems to work properly. Great job!

  49. BeRk CaN says:

    can we use same command lines on ubuntu?

  50. Jay Mee says:

    yer to start with you load into linux from say a laptop and dd onto the usb stick right? i wana be able to boot without needing any micro sd (i can use a 64 mb one if absolutely nesessery)?

  51. Jay Mee says:

    so i dont need a sd card at all and i should use linux to install the rasperian onto usb right?

  52. Jay Mee says:

    so i dont need a sd card at all and i should use linux to install the raspbian onto usb right?

  53. Jacob says:

    > sudo dd bs=1m if=2013-02-09-wheezy-raspbian.img of=/dev/disk2

    Will not run because the M needs to be capitalized.

  54. Wobbe says:

    This works great on the raspberry B with 2 disks!
    I used a 2Mb SD-Card with Raspbian jessie lite image and also Raspbian jessie lite on the disk1.
    I also installed Mosquitto mqtt-broker on disk1
    The rest of disk1 is NTFS-formatted and is used as fileserver with Samba.
    Disk2 is used as NTSF-formatted mirror.
    Thanks for this great tutorial.

  55. Erkki says:

    I can not run the Suso command in step 2

  56. Matt Toynton says:

    Great tutorial – works a dream ! not sure if anyone has tried this or if its just me but after running a sudo apt-get update and upgrade, i can no longer boot the Pi. Restoring the OS to the Flash fixes but worth a mention. I will of course try to brick it again to make sure it wasn’t an error applying the update and leave a comment. ( never used rasberian before though so maybe i shouldn’t be doing this, normal distro is Kali Linux

  57. Steve says:

    Some of these posts are ancient. It’s now April 2016 and I would like to know what the fastest/most reliable USB drive there is. Please do not quote posts from 2013. Thank you.

    • Ste says:

      Having looked at a few recently I’d still say the Corsair Voyager are still the best, but I’ll update as it is a valid point. I could do with doing an article on actual read/write tests.


  58. Ernesto W says:

    Thank you for your tutorial …

    You know if there is a way to do this and avoid ext4lazyinit process on my hard drive.

    Thank you. Regards!

  59. Sam says:

    This tutorial is fantastic. I wanted to get Ubuntu Mate booting off a USB (3) drive onto a Pi 3. I substituted the Ubuntu Arm image for the Raspian image and that was the only difference. THANK YOU!!!!!

  60. Howard says:

    I have done everything up to this point :

    Step 4 – Change the boot path on your SD card
    Once you’ve completed step 3, you need to change the default boot path to tell the Raspberry Pi to boot from your USB drive. Open a new Finder window and go to your SD card. Open up the file called cmdline.txt in TextEdit or similar and amend the line which reads:

    But i can’t see or find the file called cmdline.txt on the SD card or am i creating the file?

    ScanDisk class 10 16Gb
    2016-05-27-raspbian-jessie.img (Full Disk Version)
    My OS is El-Captain
    My target drive is Seagate 1TB SSHD (Hybrid Drive)

    Any suggestion from anyone?


  61. Shira says:

    Thanks to you and many others who provided such a tutorial, my old 64MB card has a good reuse since 2012, i really appriciate it haha =)

  62. Ducducsue says:

    Hi. I have followed the steps and got it boot from my usb flash stick. Can someone confirm if I managed expand the full size of my usb stick (16GB) correctly? Thanks,

  63. Sam says:

    With the recent upgrades to the diskutil on mac which format should we format both usb and sd. (MS-DOS(FAT)/exFAT) and what scheme should we use? (GUID Partition MAP or Masterboot Record)

  64. Hollywood says:

    This documentation works, if you replace in the /etc/fstab and /ets/.fstab the mmcblk0p with sda.
    You need to mention, that raspi-config and rpi-update needs also to replace mmcblk0p with sda.

    You should partly add your documentation. Thank you!

  65. Petter Neumann says:

    I think it also is smart to change /etc/fstab to reflect that the system is now located on dev/sda2


    proc /proc proc defaults 0 0
    /dev/mmcblk0p1 /boot vfat defaults 0 2
    /dev/mmcblk0p2 / ext4 defaults,noatime 0 1
    # a swapfile is not a swap partition, so no using swapon|off from here on, use $


    proc /proc proc defaults 0 0
    /dev/mmcblk0p1 /boot vfat defaults 0 2
    /dev/sda2 / ext4 defaults,noatime 0 1
    # a swapfile is not a swap partition, so no using swapon|off from here on, use $

    It might be important to speed up the USB drive and avoid wearing it out.

  66. Hello. Very interesting tutorial!

    I was just wondering if there isn’t any way of just installing the mySQL server on the USB disk or simply letting it’s database reside on the USB disk. Is this possible and if so would it still tear on the SD-card?

    I was also wondering if this tutorial would still apply to the more recent Raspberry Pi 3 or if there could be any complications?

  67. Thad says:

    You have been plagiarized at

  68. Mariofrombelgium says:

    Thx for a clear and complete tutoral! Great work Ste!!

    But as usual I have some minor questions. If followed the tutorial with the jessie-version OS. I believe all is working great since the rasp1 is popping up in my network. I actually believe it is booting from the usb-drive…why…well if I start the rasp without the flashdrive it doesn’t pop up in the LAN. With flashdrive is does.

    All guessing because I want it work headless and connect over ssh via putty. In Jessie all you have to do is put a file called ssh on the sd-card. When it boots the fact that the file is there initializes ssh. I have put an ssh-file on both the flashdrive and the sd-card but that doesn’t seem to get ssh up.

    Any idea how to solve this problem?

    • Mariofrombelgium says:

      Hi Ste,

      Solved the problem! Tried a few things but the only route that works for me is to start with an image of an OS with Ssh allready enabled.
      In other words
      1) write jessie-os image to sdcard
      2) put a file named ssh in the boot partition
      3) boot the pi (ssh is enabled due to the presence of the file named ssh)
      4) I have through rasp-config enabled ssh a second time, probably not necessary but I did it.
      5) make an image of the sdcard
      6) follow your tutorial but than with the just created image

      Et voilà!


  69. carol says:

    Can u please explain why use /dev/sda2 on cmdline.txt on the sdcard and then you delete sda2 partition ? i dont undestand my mind is blown away . please explain to me what this does .

  1. 20th May 2013

    […] from a USB Flash Drive Posted on May 20, 2013 by News Collector — No Comments ↓ By Ste W In this tutorial, I’m going to talk you through running Raspbian from a USB connected drive […]

  2. 11th July 2013

    […] Pocket Share this:TwitterFacebookPinterestGoogle +1Like this:Like […]

  3. 8th August 2013

    […] this has filled up the 4GB disk on the rPi. Lovely. Google google google… Bingo! A guide on running the rPi from a USB flash drive. Reinstall Pidora, update, install java and devel package, and try […]

  4. 1st September 2013

    […] card. I can’t find any guide to boot it from USB key without SD card. Anyway is possible to use it as main drive. To burn it on SD on Mac o Linux you can use […]

  5. 2nd September 2013

    […] but quickly switched to a flash usb drive to improve stability. I followed the directions from Dingleberry Pi to transfer my root directory to the usb flash drive. After following those directions and […]

  6. 25th October 2013

    […] tmpfs 98M 0 98M 0% /run/shm /dev/mmcblk0p1 1.9G 19M 1.9G 1% /boot If you have question refer to Dingleberry […]

  7. 1st November 2013
  8. 5th November 2013
  9. 20th January 2014

    […] B: install-and-run-raspbian-from-a-usb-flash-drive […]

  10. 23rd March 2014

    […] Ref: […]

  11. 2nd April 2014

    […] May 20, 2013Tutorialsraspberry pi uses, Raspian web server, Tutorial, USB […]

  12. 20th January 2015

    […] blog noted how to do it in 2012, but without the step-by-step breakdown. Many other sources (like this blog, and this blog) outline how to modify the boot partition to mount the root filesystem from a USB […]

  13. 13th February 2015

    […] I have my raspbian OS located on a 3TB external harddrive only some bootmanager stuff left on the SD Card. (if i remember right i followed this guide) […]

  14. 18th April 2015
  15. 11th August 2015
  16. 8th March 2016

    […] quickly fill. To overcome this, I changed the boot device to be a high-quality USB flash drive (find out how in this tutorial) where swap took over once the memory was […]

  17. 22nd March 2016

    […] the best results, I recommend running Raspbian from a USB Flash drive rather than a MicroSD card. See my tutorial on how to do […]

  18. 30th March 2016

    […] but here’s a cheatsheet. Note that you still need an SD card. I used instructions I found here and […]

  19. 21st May 2016

    […] As mentioned in my replies to a few comments, I don’t recommend running MySQL Server on a Raspberry Pi unless you have a high-quality, high-speed USB flash drive (preferably) or a UHS1/UHS3 class MicroSd card from which you run Raspbian OS. You might want to look at a previous tutorial to learn how to run your Raspberry Pi from a USB Flash drive. […]

  20. 23rd June 2016

    […] The following article gave me most of the information I needed, but I adapted it to my own set-up which I am documenting in this post – Install & Run Raspbian from a USB Flash Drive […]

  21. 3rd July 2016

    […] Install and run Raspbian from a USB Flash Drive […]

  22. 7th January 2017
  23. 30th January 2017

    […] Source: Install & Run Raspbian from a USB Flash Drive – boost Performance […]

  24. 14th February 2017

    […] Install & Run Raspbian from a USB Flash Drive – boost … – In this tutorial, I’m going to talk you through running Raspbian from a USB connected drive instead of from an SD card. If you run Raspbian from a USB Flash drive … […]

Leave a Reply