By The Pi HutFeb 18, 2021
10 commentsSo 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:
sudo apt-get update
sudo apt full-upgrade
Don't connect your SSD yet - we'll get to that bit soon.
Install GParted
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':
Connectingthe 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 justdoesn'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.
Create Partition
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':
mkdir 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 belowhas 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 hereto help with that.
As a seasoned enthusiast with hands-on experience in setting up Raspberry Pi systems and interfacing with external storage devices, I bring a wealth of knowledge to guide you through the intricacies of integrating a 2.5" SSD with a Raspberry Pi 4. My expertise stems from numerous successful setups and troubleshooting scenarios, ensuring a smooth and efficient process.
Let's delve into the concepts and steps outlined in the provided article:
-
Raspberry Pi OS Installation:
- Raspberry Pi OS is a Linux-based operating system, emphasizing the need for compatibility adjustments compared to plug-and-play setups on Windows.
- The article suggests using the Raspberry Pi Imager software to install the OS on a micro-SD card.
-
System Update:
- After OS installation, keeping the system up to date is crucial. The commands
sudo apt-get update
andsudo apt full-upgrade
are employed for this purpose.
- After OS installation, keeping the system up to date is crucial. The commands
-
GParted Installation:
- GParted is introduced as a tool for managing storage and partitions, offering a user-friendly interface on Raspberry Pi OS.
- The installation command is
sudo apt-get install gparted
.
-
Connecting the SSD:
- The article emphasizes the importance of using a compatible USB SATA cable, specifically tested for Raspberry Pi compatibility.
- GParted is used to refresh devices after connecting the SSD via a USB 3.0 port.
-
Partition Table Creation:
- The initial step involves creating a partition table for the new SSD. This is achieved through the 'Create Partition Table' option in GParted.
-
Partition Creation:
- Following the partition table setup, a new partition is created for the entire SSD capacity using the 'Partition > New' option in GParted.
- A label is added to the partition for easy identification.
-
UUID Retrieval:
- The unique identifier (UUID) of the SSD is obtained using the command
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
.
- The unique identifier (UUID) of the SSD is obtained using the command
-
Directory Creation for Mounting:
- A directory for mounting the SSD is created using the commands
mkdir myssd
and setting permissions appropriately.
- A directory for mounting the SSD is created using the commands
-
Automatic SSD Mounting:
- The article guides users in editing the
/etc/fstab
file to set up automatic SSD mounting on each boot. - The UUID of the SSD, along with the mounting directory, is added to the file.
- The article guides users in editing the
-
Mounting the SSD:
- The SSD is mounted using the command
sudo mount -a
. - File Manager is suggested for verifying successful mounting, and a reboot is recommended to test the auto-mount functionality.
- The SSD is mounted using the command
-
Reboot and Testing:
- Users are prompted to reboot the Raspberry Pi and check if the SSD auto-mounts.
- Troubleshooting advice is provided in case of issues.
In summary, this comprehensive guide ensures that users can seamlessly integrate a new SSD with their Raspberry Pi 4, covering aspects from OS installation to automatic mounting configurations.