#!/linuxSucks/Connect external hdd

Dec 11, 2019

Make sure that the HDD is connected and note down the HDD’s path. If your drive already has a label simply run

sudo blkid

This will give you a list of all the drives connect to your pi and their locations. In most cases this should be /dev/sda1

If you are not sure about your HDD’s label and need to look at disk sizes as well, then use:

sudo fdisk -l

Now we need to create the directory where we wish to mount the HDD

sudo mkdir /mnt/library

Give the correct permissions to the directory

sudo chmod 775 /mnt/library

Now we need to mount the drive to that location. In order to do this, we need to know what format our drive is in. You can use sudo blkid to check this.

If your drive is NTFS…

There is an additional step for this. We need to install a library that supports NTFS formatted drives.

sudo apt-get install ntfs-3g
sudo mount -t ntfs-3g /dev/sda1 /mnt/library

If your drive is exFat

sudo apt-get install exfat-fuse exfat-utils
sudo mount -t exfat /dev/sda1 /mnt/library

Important: Do not use exFat (at the time of writing this tutorial) did not support symlinks which are needed for something else.

Otherwise…

sudo mount /dev/sda1 /mnt/library

We need to make sure that every time the pi restarts, the external HDD is always mounted to the same location. This is important because you will be add your media libraries to it and we need to make sure that path does not change.

Edit the fstab file:

sudo nano /etc/fstab

And enter the following line at the bottom of the list (although it is spread over two lines it’s supposed to be a single line in the file), you can get the PARTUUID or UUID by using sudo blkid:

PARTUUID=iuwhdf-iuwfe8hj-sd78g8-wer3    /mnt/library    exfat    defaults    0    0

This will auto mount the drive on a restart.

Now as always, let’s reboot and check:

sudo reboot

Browse to /mnt/library and check if your HDD’s directories show up there.

Home  Linux  Notes  Blog Spot