Setting up a shared Network Storage device with a Raspberry Pi

Hector Minaya
3 min readJul 10, 2018

--

Do you have any old HDD drives laying around? Probably from an SSD upgrade on your MBP….

Well, it’s pretty straightforward repurposing it as a NAS on your home network with a Raspberry Pi, who doesn’t wan’t an extra 500GB!.

Here is a list of what I’ll be using:

Update your Raspberry Pi

Just to be safe you should go ahead and update your Raspberry Pi, it’s as easy as:

sudo apt-get update
sudo apt-get -y upgrade

Now we need to install the exFAT driver

sudo apt-get install exfat-fuse

Mount our HD

Since we will be using an external HD we will need to consistently mount it to the same location.

First we plug in the HD and run the following command to identify where it is being mounted

sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL

From this list, look for your external HD, in my case it’s the one listed as 465G named sda2.

From here we will need to open the fstab file

sudo nano /etc/fstab

Add this line at the end (replace sda2 with your HD):

/dev/sda2 /mnt/hdd auto defaults,user,nofail 0 2

Then restart to make sure it works

sudo shutdown -r now

In case you run into any trouble you can find a good guide on mounting your HD here.

Setup SAMBA!

To keep it simple, we will be installing SAMBA. This will allow us to share our HD across our network.

Install

sudo apt-get install samba samba-common-bin

Now we just need to tell SAMBA which drive it should share and what the permissions are

Open up smb.conf

sudo nano /etc/samba/smb.conf

Go to the very end of the file and create the following entry

[share]
Comment = Pi Shared Folder
Path = /mnt/hdd
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes

Restart samba

sudo /etc/init.d/samba restart

And you should now be able to view your NAS from any computer con your network.

View from Finder in my mac
View from Windows 10

BONUS: Why did we need the 3m tape?

So we would be able to tape the HD enclosure to the back of the monitor and reduce desk clutter….

--

--