NAS server with Raspberry Pi

Hi everyone, today I’ll show you a very cool and usefull project based on Raspberry Pi. We’re going to configure a Network Attached Storage (NAS) server with Raspberry Pi. A NAS server is basically a computer always online with a big ammount of memory where you can store your files and share it with all your device without have a copy of it locally. A NAS server is very usefull to store backup or other heavy files that can slow down your PC. I use it also as media storage. I’d like to store all my films, TV series and music to share it with all my devices, expecially with my Raspberry Pi Zero with KODI to make a portable media center with very large media collection. If I intrested you, let’s get started!

Hardware Requirements

For this project we need:

  • Raspberry Pi, I’d like to use Pi 4 because we can use a gigabit ethernet and USB 3.0 but Pi 3 and 2 works also well.
  • External USB SSD or HDD for storage, also USB flash drive works but it has less memory.
  • SD card where we’re going to install the OS
  • Power supply for your Pi and If you need for your Hard Disk.

I also find a Dual/Quad SATA HAT for Raspberry Pi that allows you to connect directly an hard disk with sata interface with your Pi. I find it very intresting and I think that I’m going to test it very soon. It’s a product made by ALLNET.CHINA and you can find it at this link.

Software and Configuration

In this project we are going to use OpenMediaVault. It is the next generation network attached storage (NAS) solution based on Debian Linux. It contains services like SSH, (S)FTP, SMB/CIFS, DAAP media server, RSync, BitTorrent client and many more. Thanks to the modular design of the framework it can be enhanced via plugins.Openmediavault is primarily designed to be used in small offices or home offices. It is a simple, free and easy to use out-of-the-box solution that will allow everyone to install and administrate a Network Attached Storage without deeper knowledge. You can download it through SourceForge at this link.

After the download you need to flash the image file on your SD card, to do that you can use a program called Etcher. The process is the same that we used to install Raspbian and you can follow it in my Beginnig page. When the SD card is ready plug it into the Raspberry Pi, connect a monitor and a keyboard (we use it only for the first boot, after this process you can unplug the monitor and the keyboard because we can configure all the sistem through a web page) and power the sistem. After the boot we can log in into the system using:

user: root
password: openmediavault

Openmedavault use the US keyboard as default, if you need to configure another language use the configuration menu that it will be opened after the command:

dpkg-reconfigure keyboard-configuration

Now it’s very important to change the defaut password so change it running the command:

passwd

It’s time to use the web page to make all the setting simple as possible so open a browser in your computer and in the search bar write the Raspberry Pi IP address, you can discover it in your modem page or in the Raspberry Pi using the command:

ifconfig

Another option that I suggest you is giving a static IP address to your Raspberry Pi and use an ethernet cable to make the connection as stable as possible. To give a static IP follow a guide for your specific modem. I can’t do that now because it’s different for every model.

When you are connected to the web interface use the default credentials:

user: admin
password: openmediavault

We’re going to change it in a while. After the login as first check the date a time option and use the “use NTP server” option to configure it automatically. To make our NAS more secure I also reccommend to use HTTPS cryptography. To use it going to System > General Setting > Secure Connection and turn on the option. After that we need an SSL cretificate, to make one go into System > Cretificate > SSL,  add one and save it. Going into the General Setting, add the new certificate and save the option again. Now In the General Setting going into the Web Administrator Password and now you cang change the defautl password that you are used to login into the webpage configuration.

It’s the moment to configure all your Hard Disk, going into Storage > Disk , now clean you Hard Disk and make sure to not clean the SD with your OS, to avoid this check the capacity and you are able to recognize the SD! After the cleaning go into Storge > File System and add a new file file sistem for each Hard Disk you are connnected and after the process mount it. To share the file you need to share a folder, so go into Acces Right Managemer > Shared folder . In this windows you can create all the folder you want to share in a specific Hard Disk. Unfortunately the USB connection can’t support the RAID option so every Hard Disk is a separate storage and you need ttto create a minimum of one folder for each disk. Now it’s time to set the services. Go into Services > *service you need* enable service and in the Shares tab add your Shared folder created before.

We have finished all the configuration! Now you can view you online folder using for exaple an FTP or SAMBA connection in all your devices connected to the network. For exaple in windows if you have setting an FTP connection you can use it by the File Manager. Going into This PC > Network Location right click and add new Network Location in the network address put:

ftp:\*Raspberry Pi IP*:22

and you are able to use the shared folder on your NAS server!