Setting up a shared Network Storage device with a Raspberry Pi
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:
- CanaKit Raspberry Pi 3 Kit
- 500 GB SATA HDD
- 2.5-Inch SATA to USB 3.0 HDD enclosure
- 3m double sided tape (yes!, this is the secret sauce)
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.
To keep it simple, we will be installing SAMBA. This will allow us to share our HD across our network.
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
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
sudo /etc/init.d/samba restart
And you should now be able to view your NAS from any computer con your network.