You are using a Raspberry Pi, maybe as a server or for retro gaming. Maybe you are using this for Kodi. The thing is, you need extra storage outside of the microSD card.
It doesn’t matter how big your microSD card is; Sooner or later, your Raspberry Pi will need more storage space. Also, no matter how good the error correction on your small piece of flash memory is, sooner or later it will get corrupted.
The solution is the hard drive. But how do you connect a hard drive to a Raspberry Pi? And what are the benefits of this? Here’s everything you need to know.
How to mount and read a hard drive on Raspbian
If you have an external hard drive with a USB cable and its own power supply, you should be able to use it with your Raspberry Pi. (If your drive does not have a power source, you will need to connect via a powered USB hub.) All you have to do is plug the drive into a USB port and turn it on.
By default, the hard drive will not be available immediately. This is due to several factors: the file system on the disk and Raspbian’s lack of automatic mounting.
If the drive is not formatted with the EXT4 file system, it cannot be read. One way to solve this problem is to delete the data from the disk, reformat it to EXT4, and then replace the data. Once this is done, it will become available, but you have spent a lot of time and effort.
More convenient is to use the ntfs-3g software so that the Raspberry Pi can read the NTFS file system:
sudo apt install ntfs-3g
Note. If the drive is in FAT32 format, you need to install vfat.
Make sure the drive is plugged in and turned on, you should find it in the Media directory on your Raspberry Pi. If not, you need to do a little more work.
First find the UUID string:
In the response, the last alphanumeric string is the UUID; remember it. Then create a location for the mount point. This is usually:
sudo mkdir /mnt/mydisk
Note. Change «mydisk» to your preferred disk label.
Assign permissions with:
sudo chmod 770 /mnt/mydisk
Then mount the drive with:
sudo mount -t ntfs-3g -o uid=1000,gid=1000,umask=007 /dev/sda1 /mnt/mydisk
By doing this, you will be able to access the disk in Raspbian. But what if you want to access the drive after a reboot?
The answer is to edit fstab. Start with a backup:
sudo cp /etc/fstab /etc/fstab.backup
Next, edit the original:
sudo nano /etc/fstab
Add the information needed to mount the disk; this starts with the 16-character UUID string you wrote down earlier:
UUID=ABCDEFGH12345678 /mnt/volume ntfs-3g uid=1000,gid=1000,nofail,umask=007 0 0
You should now find that the hard drive storage is available every time you boot your Raspberry Pi! This can be very useful for storing a library of retro games or media for a Raspberry Pi-based Plex streaming media center.
How to Boot Raspberry Pi from Hard Drive
What if simple storage isn’t what you’re looking for? Perhaps you want to lose the potentially weak link of the microSD card and boot from the hard drive instead?
Using a hard drive with a Raspberry Pi does not necessarily mean using the drive as a secondary device. It is possible to install your OS on disk, eliminating the requirement for a microSD card entirely.
To do this, you need to make sure the Pi is (this only works with Raspberry Pi 3 and Pi 3B+). ) knows it doesn’t need to boot from the microSD anymore. This is achieved by standard installing Raspbian on a microSD and then changing the USB boot mode.
You can then connect the hard drive via USB, format the drive, copy the operating system from the microSD card, and enjoy more (potentially faster) storage with your Raspberry Pi.
For full details, see our guide to booting your Raspberry Pi from USB. booting Raspberry Pi 3 from USB. loading
Installing Multiple Raspberry Pi Operating Systems on a Hard Drive
If this seems too practical and you want to take advantage of the huge extra storage, you should check out the various tools for installing multiple operating systems on your Raspberry Pi. Berryboot, NOOBS and PINN Lite everyone can do this job.
All options can be installed on a hard drive connected to the Pi, although you can jump straight to our guides. We have developed a tutorial for NOOBS. and a detailed guide to Berryboot boot (You cannot use NOOBS to install to a hard drive without first following our guide to changing USB boot mode.)
Raspberry Pi Hard Drive Space Cases
Once you’ve sorted out your hard drive, you’ll probably want to keep it close to your Raspberry Pi. Several cases are available that have space for a Raspberry Pi and a 2.5″ hard drive.
This popular online store has several options from WD Labs, all designed to store your Raspberry Pi and hard drive. Even though it’s designed for the WD Labs PiDrive, a little tweaking allows you to plug any 2.5″ drive into one of them.
Geekworm Raspberry Pi X820 Case
A useful all-in-one option is the case from Geekwork, which includes a Raspberry Pi expansion board, X820, and a compatible 2.5″ SATA drive.