Run a Raspberry Pi on a SSD or a USB Drive of any kind.

Well… technically it won’t boot from a hard drive, it has to be the boot partition on the SD card, but that’s actually just a small script setting up the root partition of the SD card.

The raspberry Pi is brilliant and every iteration has made it better and faster, all except one thing, the SD card. It still requires an SD card to boot up and run, but now you can run Linux from an SSD!

What I will show you is how to copy the contents of this root partition to an external drive, be it a USB memory stick, USB hard drive or like I have, an external USB Solid state drive.

This is actually a VERY VERY easy thing to do and aside from copying the contents from one drive to another, very quick too.

So the first thing to do is attach the USB drive to the Pi. For easy install I’ve already partitioned and formatted the drive to linux EXT4, all I need to do is discover where it is in the file system.

sudo fdisk -l

The result is /dev/sda1 – So now I know where the drive is, simples 🙂
If you have more than one drive attached it could be another letter, eg. sda1 is mine, sdb1, sdc2 and so on. Make sure you have the correct one.

Next you need to copy the files from the SD card to the external drive.

sudo dd if=/dev/mmcblk0p2 of=/dev/sda1 bs=512

 

Now this will take about 30 minutes to complete, but when it’s done there are a few things we need to do to finish the preparation of the drive
1. sudo e2fsck -f /dev/sda1
2. sudo resize2fs /dev/sda1

The first line checks the filesystem the second resizes the new drive and makes it use the full amount of space, the copy just copied the SDCARD sector by sector, so the new drive size will also match the SD CARD, resize2fs opens the drive up

Just two edits now stand between you and a faster pi.

First edit:

sudo nano /boot/cmdline.txt

change the part that says root=/dev/mmcblk0p2 to root=/dev/sda1

Next we need to make a directory to mount the USB Drive for easier access, you don’t technically need to do this but I did.

sudo mkdir /home/60GB

you can call the folder what ever you want, I had a spare 60GB SSD so I called it 60GB

The final edit and job is to edit the fstab so it’ll be correctly mounted at boot.

sudo nano /dev/sda1/etc/fstab

edit the line that says /dev/mmcblk0p2 to /dev/sda1

At this point you can safely reboot the Pi and welcome to a way faster Raspberry Pi.

About The Bionic Cyclist

Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

This website.
View All Posts

Dylan Thomas, 1914 - 1953

Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

Though wise men at their end know dark is right,
Because their words had forked no lightning they
Do not go gentle into that good night.

Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.

Wild men who caught and sang the sun in flight,
And learn, too late, they grieved it on its way,
Do not go gentle into that good night.

Grave men, near death, who see with blinding sight
Blind eyes could blaze like meteors and be gay,
Rage, rage against the dying of the light.

And you, my father, there on the sad height,
Curse, bless, me now with your fierce tears, I pray.
Do not go gentle into that good night.
Rage, rage against the dying of the light.

5 thoughts on “Run a Raspberry Pi on a SSD or a USB Drive of any kind.

  1. I’ve recently seen a daughterboard for for the Rasperry Pi that adds mSATA to the Pi.
    https://www.scan.co.uk/products/lycom-pi-102-raspberry-pi-usb-to-msata-converter-board-supports-sata-i-ii-iii-msata-ssds-includes-mo

    It may seem like a brilliant idea, but it connects to the Raspberry Pi via USB, this will reduce the data rate to USB 2 speeds (50MBs max). The Raspberry Pi only has USB 2 ports.

    So installing an mSATA will yield almost no benefit at all over hard drive (random seek will improve, consecutive reads would show no improvement), and no benefit over a solid state drive connected to a USB.
    Save your money people, don’t bother.

    The price of a 60GB 2.5inch SSD is around £30-£40 and a USB SATA adapter is around £10
    https://www.amazon.co.uk/gp/product/B011M8YACM/ £8.99
    https://shop.pimoroni.com/products/sata-hard-drive-to-usb-adapter £6

  2. Pingback: Setup Asus Tinkerboard to boot from a Hard Drive – The Bionic Cyclist E-Bike Rider

  3. I wish they (the Raspberry Pi people) had made this process easier, but thank you for taking the time to explain. I shall try this soon.
    Cheers

    Geoff

  4. Pingback: In the Wake of WannaCry, how to be secure? – The Bionic Cyclist E-Bike Rider

Leave a comment

Your email address will not be published. Required fields are marked *

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