How to set up an SSD with the Raspberry Pi 4
So you've got yourself a Raspberry Pi 4, a shiny new SSD and one of our SSD adapter cables - now you need to get it all set up!
The Raspberry Pi OS is a Linux-based operating system, so plugging in USB 'things' isn't always as plug n' play as Windows. New drives need to have partition tables and partitions created, and these need to be 'mounted' to be able to use them.
We also need to tell the Pi to automatically mount the drive when it boots.
Luckily this guide will show you how to do all of those things - let's get started!
You will need
- A working Raspberry Pi setup connected to the internet (a starter kit is a great way to grab everything you need)
- A 2.5" SSD (SATA connection)
- A USB to SATA Cable*
* A word on USB SATA cables - they're not all equal when it comes to Raspberry Pi compatibility! We tested lots (as many just didn't work properly) before choosing the cable we supply.
Install Raspberry Pi OS
As with all projects, you should make sure you're using the most recent Raspberry Pi OS and also ensure this is fully updated.
You can install Raspberry Pi OS on to a micro-SD card using the super-simple Raspberry Pi Imager software - or grab one of our pre-formatted micro-SD cards for convenience.
Once you have Raspberry Pi OS installed you'll want to make sure it's all up to date. Open a new terminal window and type in the following commands and press Enter after each:
Don't connect your SSD yet - we'll get to that bit soon.
GParted is a really nice tool for managing storage and partitions as it comes with an easy to use interface which works well on Raspberry Pi OS.
In a new terminal window, install GParted using the following command:
sudo apt-get install gparted
Once it's completed, open GParted from the Raspberry Pi OS menu which you'll find under 'System Tools':
Connecting the SSD
Note: this guide assumes you're using a new out-of-the-box SSD
Your current view in GParted will show the information and partitions for the micro-SD card in your Pi. There's a drop-down box in the top-right corner to select other devices, but you shouldn't have any others showing yet.
Go ahead and connect your SSD (via the cable) to one of the Pi's USB 3.0 ports (the blue ones).
Wait 30 seconds then, in GParted, select 'GParted > Refresh Devices' from the top menu. This process takes a minute or two.
Now your drop-down should show a new option - your new SSD! Select that option and wait for the information to display:
Your new SSD likely won't have any partitions or even a partition table, so let's go ahead and set those up now.
Create Partition Table
Select 'Device > Create Partition Table' from the top menu:
Keep the default settings, select 'Apply' and then leave it to do its thing for a few minutes. It may look like nothing is happening or that the application has crashed - it hasn't - it just doesn't give you a lot of feedback whilst it's working.
Once complete (or if nothing happens after a few minutes), move on to the next step.
Now that we have a partition table, we can go ahead and create a partition. This tutorial will create a single partition for the entire SSD capacity.
Select 'Partition > New' from the top menu:
Keep all of the default settings as they are (including the ext4 filesystem), but add a sensible label to help you identify it later on - we've used 'WDSSD':
Now select 'Edit > Apply All Operations' from the top menu and click yes to the warning once you've checked everything:
Once again, leave it to do its thing. We found the interface appeared to stall at times, but it is working away in the background. This part can take some time depending on the size of the SSD.
Once completed, a box will show confirming the action. Close this box and GParted will automatically refresh and show your new partition:
Next - mounting and auto-mounting!
Find the SSD's UUID
We need to find our SSD's UUID (an identifier number) to tell our Raspberry Pi exactly which SSD we want to mount and where (extra-important if you use multiple SSDs).
Enter the following command into a terminal window:
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
You should see something like this:
You're looking for devices on 'sda' or 'sdb'. The label field can help you identify your SSD too as you set the label earlier. In our example, our SSD is on 'sda1'.
Make a note of the long number in the UUID field - that's your SSD's UUID! We copied and pasted it into a text editor.
Create a Directory for Mounting the SSD
We also need to create a directory to mount the SSD to (this is where you'll access your SSDs files).
For ease, we're going to make a new directory in the usual /home/pi/ folder. In a new terminal window enter the following command to make a new directory called 'myssd':
Now set permissions for the directory:
sudo chown pi:pi -R /home/pi/myssd/
sudo chmod a+rwx /home/pi/myssd/
Set up Automatic SSD Mounting
Now that we know the UUID of the SSD and we have a directory to mount it to, we can now set up auto mount for every time we boot our Pi.
In a terminal window, enter the following command:
sudo nano /etc/fstab
At the end of the file that opens, add a new line containing your SSD's UUID and the mounting directory (change the xxxxxx to your UUID):
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home/pi/myssd/ ext4 defaults,auto,users,rw,nofail 0 0
It should look something like this (our example below has a slightly shorter line but use the example above for the best results):
Select Ctrl+X and Y to save and exit.
Mount the SSD
We can now mount the SSD very easily using the following command:
sudo mount -a
Give it 10 seconds and then take a look in your File Manager - your SSD should now be showing (with a Lost + Found sub-directory) too:
Reboot & Test
Reboot your Raspberry Pi (you can use terminal command sudo reboot) to test that the SSD auto-mounts.
If there are any issues, go back and check the steps above to make sure you've done everything correctly and in order.
Remember this guide is based on using a brand new unformatted SSD - if you're using an existing/used/formatted SSD you may need to adjust your approach a little - there's a good Raspberry Pi resource on external USB storage here to help with that.