Your Raspberry Pi microSD card can fill up quickly. Especially if you plan on turning it into a media server or torrent box. The best place to store your media files or downloads would be a Network Attached Storage (NAS). This could be in the form of a NAS like “WD My Cloud” or similar, or simply an external HDD connected via the USB port of your router. Doing this is very simple, follow along and you’ll be set up in no time.
Requirements
- Raspberry Pi 3 Kit
- 8GB microSD Card for Raspberry Pi OS
- Drive to mount (the bigger the better)
- External HDD (recommended if your router is equipped with a USB port)
- Traditional NAS
Instructions
1. Install Raspbian OS
First, you must install the Raspbian OS on your Raspberry Pi. Check out the official guide here .
2. Mount your Network Drive
Create a folder on your Raspberry Pi to mount the drive in.
I mounted mine at /home/pi/DRIVE/share
To do this, type these commands in your terminal (change ‘DRIVE’ and ‘share’ to whatever you want)
1 2 3 4 5 |
cd /home/pi sudo mkdir DRIVE cd DRIVE sudo mkdir share cd .. |
Now mount your drive to the directory you just created:
1 |
sudo mount -t cifs -o username=yourusername,password=yourpassword //NIGHTHAWK/S_Drive DRIVE/share |
If you are using a external HDD connected to the USB port of your router, your username and password will be what you normally use to log in to your router settings. You can replace “NIGHTHAWK” with the gateway address of your router as well.
Otherwise, use the credentials you set up when you installed your NAS.
Now, navigate to your drive by browsing to its mount point
1 2 |
cd /home/pi/DRIVE/share ls |
If your see your files there, it worked.
To do this, we need to edit the /etc/fstab file, Run the following command to edit the /etc/fstab file:
1 |
sudo nano /etc/fstab |
User your arrow keys to navigate to the bottom of the file and add this (change as appropriate):
1 |
//NIGHTHAWK/S_Drive /home/pi/DRIVE/share cifs username=yourusername,password=yourpassword 0 0 |
Now press CTRL+X then Y then ENTER. All done! Your share will automount at boot.