Adding a storage device your network is called creating a NAS (Network Attached Storage). And basically it is just a minimalistic computer with a boat load of storage attached to it. So using a Raspberry Pi as our minimalistic computer, let’s create our own Network Attached Storage and make a Raspberry Pi NAS. You can find the project page for this video at the link below. But for now, let’s start tinkering.
Gather The Parts
There really isn’t much you need to do this project, and aside from the Raspberry Pi, you probably already have everything you need.
Here are some other parts and tools that you you will probably find around the house (as I did):
- Keyboard and Mouse
- Ethernet Cable
Installing The Software
The first thing you want to do is download the Raspbian image using the link above. This is a stripped down version of Debian linux, so what I’m doing should also work on other Debian based distros, such as Ubuntu.
You then want to burn this one to an SD card using either Win32diskImager on Windows or the dd command for linux or Mac. Then plug the SD card into your Pi with video, mouse, keyboard, internet, power, and your external storage.
Setting Up The NAS
Once your pi boots up, you can login using “pi” and “raspberry” and then follow these steps to set it up as a NAS:
- Update apt-get and install NTFS-3g
sudo apt-get update
sudo apt-get install ntfs-3g
- Find out what path your external drive is located at (ex. /dev/sda1).
sudo apt-get update
- Mount the external drive to the media folder and then make a shared folder within it.
sudo mkdir /media/NASDrive
sudo mount -t auto /dev/sda1 /media/NASDrive
sudo mkdir /media/NASDrive/shared
- Install the Samba software.
sudo apt-get install samba-common-bin
- Edit the Samba config file.
sudo nano /etc/samba/smb.conf
- Under the “Authentication” header, remove the hash (#) before
security = user
- Under the “Share Definitions” header, change
read only = yes
read only = yes
- At the bottom of the page add:
[Shared] comment = Shared Folder path = /media/NASDrive/shared valid users = @users force group = users create mask = 0660 directory mask = 0771 read only = no
- Restart Samba
sudo /etc/init.d/samba restart
- Add a new user to linux
sudo useradd [enter new user here] -m -G
- Create a new password:
sudo passwd [enter new users name]
- Add new user to Samba
sudo smbpasswd -a [enter new users name]
Now on a different computer, if you browse the network you should see your raspberry pi. Trying to access it will prompt you for your username and password, and you can just enter the user and password we just created. Then start storing stuff to it!
Using Open Media Vault
Before we dive into the nerdy method of setting up a NAS on a Raspberry Pi, a super simple alternative is to use Open Media Vault. Open Media Vault is a distribution intended to make it super simple to set up and manage your own NAS.
If you want to give it a try yourself, here are the dead easy steps for setting it up:
- Download the most recent OpenMediaVault Raspberry Pi Image (using the button above)
- Burn it to an SD card (you can use this guide if you don’t know how)
- Plug it into your Raspberry Pi along with a monitor, network cable and power.
- When it boots up, the screen will give you your IP Address along with instructions on how to log in.
- On a separate computer, open up a browser and type in your Pi’s IP address. On the resulting page, login using the provided credentials (default should be admin and openmediavault).
- Use the options provided to set up your networking share and add and manage users!