Boot from SSD

Time: 15 minutes

Since September 2020 it is possible to boot your Pi from an SSD instead of the microSD. Booting this way gives better performance. In addition, this circumvents the hassle of mounting and telling every piece of software to use the SSD. Since we have the SSD anyway, why not do it?

Insert the microSD and network cable into the Pi after which you connect the power. After about a minute, the Pi has booted up and will get an IP address from your router. Log into your router, because you'll need this IP address. Most routers can be accessed by going to 192.168.1.1 in your browser, but you know best how your network is set up.

SSH

Secure Shell is an encrypted protocol for logging into another computer and remotely executing commands on the other computer via a terminal. Through this protocol it is possible to control the Pi from our computer.

Open a terminal and type:

ssh pi@IP.ADDRESS.OF.PI

Replace in the command IP.ADDRESS.OF.PI with something like 192.168.1.6 (the IP address of your Pi). Once you press enter you will get a question that you can answer YES/NO. Type yes and press enter. You will now be instructed to enter a password. The password was set by you during flashing. This is raspberry.

Now what did we just do? You have indicated with the command that you want to use SSH. Next, you specify a user name and a computer. The computer can be reached via an IP address.

Update

Run the following commands to update the Pi:

sudo apt update
sudo apt full-upgrade -y
sudo reboot

Your Pi will now reboot after which you need to SSH into it again.

Boot configuration

By default, the Pi boots from the microSD. The Pi must be configured differently to boot from the SSD. First, the Pi must be provided with the latest firmware. Run the command below:

sudo rpi-update master c8fffcda5ae0f923857a73fedbeb07e81d2eb813

Your Pi will now update its firmware after which you need to reboot it.

sudo reboot

SSH into your Pi again. It is time to configure the Pi in such a way that we can boot from the SSD. Run the following:

sudo raspi-config

A screen appears which makes it look like you've landed in the 1980s. Choose Advanced Options.

Raspi config advanced options selection

Go next for Boot Order.

Raspi config boot order selection

Choose USB Boot and press Ok.

Raspi config USB boot selection

Choose Finish to finish the settings.

Raspi config finish selection

And finally Yes to reboot.

Raspi config reboot

Your Pi will now reboot. After the reboot, you need to SSH into your Pi again. You need to do this in order to shut down the Pi properly.

sudo shutdown now

Booting

Now that we have the bootloader set up correctly, we can boot from the SSD. Remove the microSD from the Pi and plug in the SSD. Put the power and it should work! You now need to SSH your Pi in with a different username and password. Do this as follows.

ssh ubuntu@IP.ADDRESS.OF.PI

The default password is ubuntu.

It might happen that you get the following error message as soon as you try to SSH to your Pi again:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
(...)

Something like this is easily solved by entering the command nano .ssh/known_hosts on your computer. The screen that follows lists known computers for your computer. Delete the line with the IP address of your Pi. Save the file with Ctrl + X and confirm with Y. You have now told your computer that it may forget the previous relationship with the Pi and establish a new one.

The first time, Ubuntu will ask you to set a new password. Choose a strong password and remember it well. It is the password for the user ubuntu and this user will later manage everything in the guide. If Ubuntu doesn't ask you to set a new password, you can do it yourself with the command passwd.