Mount an External Hard Drive on the Raspberry Pi with Raspian
This is a quick guide on how to connect an External Hard Drive to the Raspberry Pi using the Raspian operating system. Most external Hard Drives are quite energy hungry and will require a USB Hub to run in a stable manner. You can buy a USB hub from our store.
The first step is to plug the Pi in and then switch it on. It should boot up as normal, so go ahead and log in to Raspian as normal.
Step 1. Is it there?
To check the current storage devices attached to your Pi simply run the command:
This shows that we currently have a 'Seagate Expansion Drive' attached.
Step 2. Check the Partitions
We now have to check the boot name of the 'Seagate’s' partition.
sudo fdisk –l
Shows that the drive is located at /dev/sda1
Step 3. Mounting it.
Now we know where the drive is, we need to mount it:
sudo mount /dev/sda1 /mnt
The folder “/mnt” is the standard location for mounting permanent media, but you can create your own folder using the “mkdir” command.
That’s it! The drive is mounted.
Step 4. Permissions
As the drive is formatted in NTFS, we may have to change the /mnt drive permissions in order to enable proper access. Simply run the following command:
sudo chmod 775 /mnt
This will change your permissions and allow you to access the drive.
To test, let’s create a folder
sudo mkdir /IMAFOLDER
Good! So you can read and write to the hard drive.
Step 5. Automounting the hardrive
If you want your Hard Drive to mount from boot, you should set this up.
First step is to edit the "fstab" file
sudo nano /etc/fstab
It will open up this file in nano text editor:
You need to add the following line to have the hard drive mount at boot:
/dev/sda1 /mnt /ntfs defaults 0 0
You can now reboot your Raspbery Pi, and your hard drive will automatically mount.
Step 5. How to unmount.
To unmount the drive, simply run this command:
sudo umount /mnt
As long as you’re not currently using the drive, it should un-mount.