Booting a Pi from USB has been a bit of a ‘Holy Grail’ for us geekanoids – in the main because of increased read/write speeds and larger capacity drives. As a very general comparison a good quality USB ‘memory stick’ will achieve at least twice the speed of an equivalent SD card (see more stats in links below). With the launch of Raspberry Pi 3 it became possible to achieve just this – although  it requires a workaround of booting to  SD card; altering boot configuration – then duplicating SD card to a USB stick. I will here take you through the process of setting up a bootable USB memory stick in parallel with the SD card setup.

⚠️              Warning – as of yet this ONLY works on a Raspberry Pi 3B                 ⚠️

I am here assuming you have written or ‘baked’ an SD card for your Pi before if NOT go here. You do NOT have to alter your existing SD card at this point – you MIGHT want to duplicate it to your USB stick using Etcher or similar though. Bake your flavour of Raspbian or backup to your USB memory stick following instructions here – although I will recommend using Etcher for ease of use. When finished writing .img to the memorystick we need to locate the boot partition of the USB – it looks like this  ;

boot partition mounted on Mac desktop ( Computer —> Devices with Removable Storage on a PC)

We are now going to edit 2 files ; config.txt and cmdline.txt, and depending on what platform ; Mac/PC/Linux – use a plain text editor like TextEdit or WordPad.

It is good practice to MAKE a BACKUP / COPY of both files first.
Step1: open up config.txt add this code at the bottom of the page;

 program_usb_boot_mode=1

Save and close the file – then open cmdline.txt (Step 2); comment out or DELETE  root=/dev/mmcblk0p2 (use hashtag to disable code) and ADD root=/dev/sda2 instead;

Step2: I have here DELETED  root=/dev/mmcblk0p2) and ADDED root=/dev/sda2 instead

Save and close – we are now going to  open a new , blank textfile with no code in it – and save it as ‘ssh’ ;

Step 3: save a blank file as ‘ssh’ into the boot partition of the USB stick

This will enable ssh-tunnelling at boot (headless) which means we can use a program like putty, terminal or cyberduck to go in and do the rest of the configuration without having to connect to a monitor or screen. We need to ensure that there is NO extension attached to the ssh file we just created – remove this by going to rename / get info;

remove ANY extensions to the ssh file we just created

Now this is IMPORTANT ; we need to insert the SD card used with our Raspberry Pi 3 and repeat Step 1  and Step 3 – ONLY !!

We then need to save, close – eject BOTH SD-card and USB stick and plug this into our Raspberry Pi. After we have powered the Pi up we will immediately do a reboot – either from desktop or ssh (sudo reboot) and check our configuration. Once rebooted we will now either via terminal/ssh or terminal from Pi Desktop do the following command;

vcgencmd otp_dump | grep 17

if we see something like the pic below  we can power our Pi off, remove the SD card and Voila  – we have a mean, lean, USB Pi machine – congratulations.

on entering the command vcgencmd otp_dump | grep 17  we should see the return ; 17:3020000a

 

Hardware used in this tutorial; Raspberry Pi3 (DietPi OS) + 32Gb Sandisk Ultrafit + 8Gb Sandisk HC microSD

⚠️              Warning – as of yet this ONLY works on a Raspberry Pi 3B                 ⚠️

tomshardware memory-card benchmarks

raspberrypi.org-documentation

ste wright’s blog

. . . share the geek love . . .Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on Pinterest