How to Connect a Hard Drive to Raspberry Pi (And Why You Should)
Pinterest Whatsapp
Advertisement

You’re running a Raspberry Pi, perhaps as a server or for retro gaming. Maybe you’re using it for Kodi. The point is, you need extra storage beyond the limits of a microSD card.

It doesn’t matter how large your microSD card is; sooner or later, your Raspberry Pi will need more storage How to Increase Storage on Your Raspberry Pi How to Increase Storage on Your Raspberry Pi Need more storage on your Raspberry Pi? You have several options available. Here are all the things you can do. Read More . Also, regardless of how good the error correction is on your little piece of flash memory, sooner or later it will corrupt.

The solution is a hard disk. But how do you connect a hard disk drive to a Raspberry Pi? And what are the benefits of doing so? Here’s everything you need to know.

How to Mount and Read an HDD in Raspbian

As long as you have an external HDD with a USB cable and its own power supply, you’ll be able to use it with your Raspberry Pi. (If your drive doesn’t have a power supply, it will require connecting via a powered USB hub.) All you have to do is connect the drive to a USB port, and power it up.

By default, the hard disk drive won’t be immediately accessible. This is due to a couple of factors: the file system on the disk, and the lack of automatic mounting in Raspbian.

If the disk isn’t formatted with the EXT4 file system, then it cannot be natively read. One way around this is to remove the data from the drive, reformat in EXT4, and then replace the data. Once this is done, it should be accessible, but you’ve wasted a lot of time and effort.

More convenient is the option 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’ll need to install vfat instead.

Ensuring the drive is connected, and powered on, you should find it within the Media directory on your Raspberry Pi. If not, you’ll need to do a bit more work.

First, find its UUID string:

sudo blkid

In the response, the final alphanumeric string is the UUID; keep a note of this. Next, create a location for the mount point. This is typically:

sudo mkdir /mnt/mydisk

Note: Swap “mydisk” with your preferred disk label.

Assign permissions with:

sudo chmod 770 /mnt/mydisk

Next, mount the drive with:

sudo mount -t ntfs-3g -o uid=1000,gid=1000,umask=007 /dev/sda1 /mnt/mydisk

Once you’ve done this, you should be able to access the drive in Raspbian. But what if you want to access the disk after a reboot?

The answer is to edit the fstab. Begin by backup:

sudo cp /etc/fstab /etc/fstab.backup

Next, edit the original:

sudo nano /etc/fstab

Add the information need to mount the disk; this begins with the 16-character UUID string you made a note of earlier:

UUID=ABCDEFGH12345678 /mnt/volume ntfs-3g uid=1000,gid=1000,nofail,umask=007 0 0

Next, reboot:

sudo reboot

You should now find that the HDD storage is accessible each time you boot up your Raspberry Pi! This might prove very useful for storing a retro gaming library, or media for a Raspberry Pi-based Plex media center to stream How to Turn a Raspberry Pi Into a Plex Media Server How to Turn a Raspberry Pi Into a Plex Media Server Here's how to install Plex server on a Raspberry Pi, configure it, and start streaming movies, TV shows, music, and more. Read More .

How to Boot Your Raspberry Pi From HDD

What if simple storage isn’t what you’re looking for? Perhaps you want to lose the potential weak link of the microSD card, and boot from HDD instead?

Raspberry Pi Model B 3+

Using a hard disk drive with your Raspberry Pi doesn’t have to mean using the disk as a secondary device. It is possible to install your OS to the disk, removing the requirement for a microSD card completely.

To do this, you’ll need to ensure the Pi (this works only with the Raspberry Pi 3 and Pi 3B+ How to Decide If You Need the New Raspberry Pi 3 B+ Model How to Decide If You Need the New Raspberry Pi 3 B+ Model The new Raspberry Pi 3 B+ has been released. How much does it cost, what hard specification does it have, and will it improve your existing projects? We've got answers. Read More ) knows that it no longer needs to boot from microSD. This is achieved by starting with a standard Raspbian install on microSD, then changing the USB boot mode.

You can then connect a HDD via USB, format the drive, copy the operating system from the microSD card, and enjoy larger (potentially faster) storage with your Raspberry Pi.

For the full details, see our guide to booting a Raspberry Pi from USB How to Make Raspberry Pi 3 Boot From USB How to Make Raspberry Pi 3 Boot From USB The Raspberry Pi is a versatile piece of kit, capable of a diverse range of tasks. But it has one glaring flaw: the inability to boot from USB. Until now, that is. Read More .

Installing Multiple Raspberry Pi OSes to HDD

If these seems too hands on, and you want to take advantage of the vast additional storage, you should check out the various tools for installing multiple operating systems to your Raspberry Pi. Berryboot, NOOBS, and PINN Lite NOOBS vs. BerryBoot: Which Is Best for Installing a Raspberry Pi OS? NOOBS vs. BerryBoot: Which Is Best for Installing a Raspberry Pi OS? Want to install a Raspberry Pi operating system without messing around with image files and SD card writing programs? It's easy with NOOBS and BerryBoot... but which option is best? Read More can all do the job.

All options can install to your Pi-attached hard disk drive, although you may prefer to jump straight into our guides. We’ve produced a tutorial for NOOBS How NOOBS For Raspberry Pi Can Help First Time Users How NOOBS For Raspberry Pi Can Help First Time Users There is something about the Raspberry Pi that might just put people off: until now, setting it up has not been particularly user friendly. NOOBS aims to change that! Read More , and an in-depth guide for Berryboot How to Dual Boot a Raspberry Pi Using BerryBoot How to Dual Boot a Raspberry Pi Using BerryBoot Want to install multiple operating systems on your Raspberry Pi? Dual booting is the answer, and BerryBoot is one of the best tools for that. Read More . (You cannot use NOOBS to install to HDD without first following our guide to changing the USB boot mode.)

Raspberry Pi Cases With Space for an HDD

Once you’ve got your HDD sorted out, you’ll probably want to keep it close to your Raspberry Pi. Several enclosures are available that have space for a Raspberry Pi and a 2.5-inch hard disk drive.

ModMyPi

This popular online store has several options from WD Labs, all designed to store a Raspberry Pi and a HDD. Although designed for the WD Labs PiDrive disk drive, a small amount of customization should allow any 2.5 inch drive to slot into one of these.

Geekworm Raspberry Pi X820 Enclosure

Geekworm Raspberry Pi X820 (X800) SSD&HDD SATA Storage Board Matching Metal Case/Enclosure + Power Control Switch + Cooling Fan Kit Geekworm Raspberry Pi X820 (X800) SSD&HDD SATA Storage Board Matching Metal Case/Enclosure + Power Control Switch + Cooling Fan Kit Buy Now At Amazon

A useful all-in-one option is this enclosure from Geekwork, which incorporates a Raspberry Pi, X820 expansion board, and compatible 2.5 inch SATA disk drive.

While the enclosure itself is available on Amazon, the X820 SATA expansion board must be purchased separately.

NODE Decentralized Mini Server

If you prefer, something even more integrated, prefer an open source design, and don’t mind a bit of soldering, then YouTuber NODE’s amazing decentralized mini server build might suit you.

Featuring some modifications to a Raspberry Pi 3B+ and a 3D-printed case with space for a 2.5 inch HDD to slot in, this is designed for using your Pi as a server. Find full details at n-o-d-e.net.

Setting Up Your Raspberry Pi With an HDD Is Simple

By now, you should be ready to add a hard disk drive to your Raspberry Pi, if you haven’t already. While any model can benefit, the best results are undoubtedly enjoyed on a Raspberry Pi 3 or 3B+.

How you use the hard disk drive is up to you. It may prove useful in a number of ways, including several of the ones in our list of the best Raspberry Pi projects 20 Awesome Uses for a Raspberry Pi 20 Awesome Uses for a Raspberry Pi With so many cool projects for the Raspberry Pi, it can be hard to decide what to make. In this mega guide, we round up 20 of the very best projects around! Read More .

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. dragonmouth
    July 17, 2018 at 8:37 pm

    Doesn't attaching all kinds of peripherals to a Raspberry Pi just to prove you can defeat the entire purpose of having a low power, micro PC? There comes a point when the RPi and all the devices attached to it take up much more space than a desktop with similar peripherals.