Raspberry Pi NAS ultimate guide
Raspberry Pi NAS ultimate guide
The full installation tutorial on
how to build your own Raspberry Pi NAS server
![]() | Building NAS on Raspberry Pi is a very smart way to create DIY NAS for safe and efficient file management. NAS (or Network Attached Storage) Server is a network storage system to serve and share files with other client computers in a local network area. This enables multiple users to access and share the same file storage. The NAS server can use different file sharing protocols to share the data via the network. The mainly used protocol is SMB (Server Message Block). |
| Additional protocols are NFS (Network File System), FTP (File Transfer Protocol), SFTP (Secure File Transfer Protocol), SCP (Secure Copy) and more. The main hardware components of the NAS storage system are media storage devices, mainly hard drives. If you have more than one storage device mounted on your NAS server, the storage devices can be arranged via a RAID controller (Redundant Array of Independent Disks) into logical and redundant storage containers for redundancy and safety reason. There are various RAID levels to protect the data in case of a disk failure. The most common are RAID-0, RAID-1, and RAID-5. |
Advantages of building NAS on Raspberry Pi
Raspberry Pi is a mini computer build on a single PCB board, slightly larger than a credit card. It has a wired local area network (LAN) and 4 USB-Ports for different external devices like keyboard and mouse or external storage devices.The optimized operating system for the Raspberry Pi 2 and the Raspberry PI 3 is Raspbian, a free and open source software based on Debian. Also, there are a couple of alternative operating systems available for the Raspberry Pi. In this article, we will use the newest “Raspbian Stretch” operation system, released at 2017-08-16 with the Kernel version 4.9.
Well, concerning the advantages of making up Raspberry Pi NAS hosting device, RPI is a mini-computer with the full performance of a Linux-based operating system and contains almost all functions of a large server system.
On the other hand, the Raspi saves a lot of money because it’s really cheap and consumes a very small amount of energy. Due to its small size, the RPi can be placed almost everywhere as it occupies a very small space. RPi board can be used for an almost unlimited number of projects, like running Plex media server, playing retro games with a game emulator built on the Pi and much more.
All of that features make the Raspberry Pi an ideal candidate for your own small NAS storage system.
Setup a NAS Server on Raspberry Pi
In this article, we will set up a simple NAS server from scratch, based on the SMB protocol. The goal is to save files on the NAS server and share them between different computer clients. For this project, we’ll need a Raspberry Pi 2 or Pi3 with a running Rasbian and connected to some Network. Make sure you have access to the terminal or you’re logged in to the Raspberry Pi via SSH connection.Need purely the algorithm alone? Try our short how-to guide! Simply provide your email and get instant access to the document.
For the file storage, we need an external USB Hard-drive with a storage capacity of your choice.Prepare your RPi
Let’s assume that the Raspbian operating system is already installed and running on RPi. Connect your device to the Network via a wired connection or via WLAN and open a terminal.
$ sudo apt-get update |
Install and Setup Samba Server
1. To share files from our NAS server we need to install the Samba package. This includes all the required apps and configuration files to set up the SMB protocol.$ sudo apt-get install samba samba-common-bin |

[INTERNAL] comment = internal Files browseable = yes path = /home/pi/INTERNAL writeable = Yes create mask = 0777 directory mask = 0777 browseable = Yes public = yes |
$ sudo leafpad /etc/samba/smb.conf |
4. After that, you need to get
access to the sharing, we’ve just created. For that, the user Pi should be allowed to be the Samba user.
$ sudo smbpasswd -a pi |
$ sudo /etc/init.d/samba restart |
On Windows open the Explorer and choose “Map network drive” from the Menu:






Prepare an external drive
If we want to provide a larger amount of file space we connect an external USB drive to Raspberry Pi. In this tutorial, we are going to use a 1TB external USB HDD with an NTFS file system to expand our storage pool.6. So, connect the external USB hard drive to the device. With the command lsblk, we can check all the connected devices.

7. To mount this file system we need to install the “ntfs-3g” package.
$ sudo apt-get install ntfs-3g |
$ sudo mkdir /EXTERNAL |
$ sudo umount /media/pi/New\ Folder/ |

$ sudo leafpad /etc/fstab |



Create an external share
Now we are ready to share the external disk to the network.1. For that, firstly, we have to add the following configuration part to the end of /etc/samba/smb.conf file. Don’t forget to use the special command for opening the file:
$ sudo leafpad /etc/samba/smb.conf |
[EXTERNAL] comment = external Files browseable = yes path = /EXTERNAL writeable = Yes create mask = 0777 directory mask = 0777 browseable = Yes public = yes |
2. Then, we can restart the Samba server.
$ sudo /etc/init.d/samba restart |
3. On the next step, we’ll move over to a Windows 7 client to check if the external share is also available in the Network. As described earlier, we map the external sharing in the same way, with the “EXTERNAL” instead of “INTERNAL” sharing name.


Other Alternatives for NAS Server on Raspberry
As an alternative to your own NAS, you can use ready built NAS storage server applications like Openmediavault, Freenas, Nas4free, and others. These application packages are easy to install and comes with a Web-Interface to configure. They are made for managing the storage and file sharing to other users within the Network.
- Download the Raspberry Pi 3 NAS image (using the link above).
- Create an SD card for Raspbian with the proper OMV image on it. For that, we can use the Win32DiskImager app just the same way, as we have used it for setting up Raspberry Pi Backup.
- Insert the SD card into your Raspbian device and watch the configuration to be completed automatically.
- To finish the setup, input your Raspberry Pi IP address.
- After that, connect to the IP address you’ve provided in the previous step via Chromium browser (or whatever you use on your Pi).
- Set up the username and the password (the username is “admin” by default).
- The interface is quite user-friendly, so you’ll be able to add your hard drive by purely following the guidelines.
- Don’t forget to enable the service by entering the SMB/CIFS directory and pushing the switch-on button.
- You can also enable the guest access in the “Shares” directory (it’s optional).
- Then… You’re done!

- Download the latest image. I’d advise you to choose “NAS4Free-rpi2-SD-10.3.0.3.4529.img” (download the image).
- Create an SD card with the image on it. Use Win32DiskImager and the same example guide we’ve mentioned earlier.
- Insert the SD card into your Raspbian device and let the installation run automatically.
- To finish the setup, input your Raspberry Pi IP address.
- You are all set!

Telling the truth, Freenas is considered to be not the best variant for building up NAS on Raspberry. This is not only personal opinion, but the community thinks the same (check the StackExchange thread here). In a nutshell, FreeNAS is aimed to be used within really big (even huge) projects and requires a powerful computer. The 8GB of RAM is required for the FreeNAS 11 to be run properly, which, obviously, can’t be met by even the latest 2017 model of Raspberry Pi (you can make sure on their download page).
Still, there is a common way to install FreeNAS on Raspberry Pi using the combination of ExaGear and Wine, but even the 3D hardware graphics acceleration, provided by ExaGear Desktop, won’t get you acceptable performance. Anyway, you are free to try that scheme. For that use the tutorial described in the article Wine on Raspberry Pi (or you may find Raspberry Pi Owncloud tutorial relatively closer).
Final notes
In conclusion, we have gained a lot of information on different ways of making up your own NAS on the Raspberry Pi devices (or implement the same to any AMR-based hardware). Obviously, there are a lot of pros as well as cons at the same time of using NAS on Raspberry Pi.The great advantages of Raspberry Pi are its very small size, cheap price(less than 40 USD) and very little energy consumption device. Disadvantages include the fact, that hard drives can only be connected via USB interface and have a possibility of a performance loss compared to hard drives running over SATA. Also, the setting up RAID over USB HDDs is not recommended as this type of devices are very error sensitive.
You can further expand the storage capabilities of the RPi by adding cloud services like Google Drive or Dropbox on Raspbian with the help of ExaGear Desktop. Using Dropbox on Raspbian or any other ARM (set up on with ExaGear) for the purpose of building up the NAS system have a number of advantages:
- You can synchronize the data between different devices, using multiple ARM boards, or even use them the cross-platform way (x86 + ARM).
- Your data and files are accessible from anywhere in the world, as this is a cloud service.
- With Dropbox, it’s possible to set up a backup for your Raspberry Pi NAS system
- You can get the history of changes because Dropbox backs up files several times a day keeping all the versions of files saved.
- Dropbox itself provides great customer technical support.
.png)



0 comments: