Raspberry Pi is an inexpensive small form factor PC that can behave like a standard computer in many respects. Users can use this innovative mini-computer for all kinds of functions, from setting up an operating system to surfing the web, to using it as a server or a media center, and much more besides. Discover 10 interesting Raspberry Pi projects to try out at home.
Using Raspberry Pi as NAS (network-attached storage)
When organising digital files (text, pictures, videos, music, etc.), you use the same method as filing paper documents. With well labeled folders, you can create valuable storage structures that are useful when it comes to searching for documents later. However, the more folders there are, the more shelves you need – the archive could even spill over into different rooms in a company, for example. In the case of digital documents, the folders become file folders, shelves become directories, and the archive rooms become storage media like hard disks (internal, external), USB sticks, SD cards, CDs, or cloud servers.
- Raspberry Pi as an NAS server – is it a good choice?
- What you will need to create a Raspberry Pi NAS server
Tutorial: how to set up Raspberry Pi as NAS?
- Step 1: download and install OpenMediaVault
- Step 2: start the Raspberry Pi NAS and change the keyboard layout
- Step 3: change password and display IP address
- Step 4: logging onto the web interface
- Step 5: securing the web interface
- Step 6: connecting the storage media to the Raspberry Pi NAS
- Step 7: setting up file sharing on the included partitions
- Step 8: creating user profiles to access to Raspberry Pi NAS Server
- Step 9: setting up access services for the Raspberry Pi NAS Server
- Step 10: accessing the Raspberry Pi NAS
During the course of digitalisation, the paperless office is becoming increasingly important (in companies, but also on the computer at home). It therefore makes sense to come up with practical solutions for organising your own digital documents in good time.
In both cases, the search effort depends primarily on how many storage locations the various documents are saved in – a problem that can hardly be solved with paper documents. The digital flood of data, on the other hand, can be controlled by dedicated storage systems like file servers, storage networks or NAS systems (Network-Attached Storage). The latter are also becoming more and more popular in the private sector, probably because NAS servers can easily be created using a Raspberry Pi and a bit of patience.
Raspberry Pi as an NAS server – is it a good choice?
There are many good reasons for setting up a Raspberry Pi NAS server: your own server based on a minicomputer is cheaper than buying a completed NAS system. Energy costs in particular are much lower due to Raspberry having low requirements. It is also impressively compact and portable. If there are no other power sources, the Raspberry Pi NAS system runs on a standard battery pack. Of course, the Raspberry Pi network storage is also inferior to commercial counterparts in some respects – for example, they have more processor power and offer better transmission rates. However, the DIY project is definitely a good solution for file storage in the private sector.
What you will need to create a Raspberry Pi NAS server
To create a Raspberry Pi NAS, you will first need to get the necessary equipment. Of course, the minicomputer itself is the focal point: you can choose between the Raspberry Pi 2 and the newer Raspberry Pi 3, both of which have enough power to run the server.
In addition to a minicomputer, you also need two media storage units. These can be ordinary USB sticks, which commonly have 100 gigabytes of storage space and can be powered directly by the Raspberry Pi. More common, however, are external USB hard drives – 2.5 via USB hub or 3.5 with their own power supplies. Native WD PiDrives are also recommended, as long as they are 250 gigabytes, 375 gigabytes (WD PiDrive Foundation Edition), and 1 terabyte (WD PiDrive BerryBoot Edition) in size. The manufacturer also recommends a custom-fit power supply kit as an option to cover the energy demand that connected PiDrives have.
Tutorial: how to set up Raspberry Pi as NAS?
If you have the required hardware for your own NAS server, you can devote yourself to installing and setting up the software required to operate it. There are several ways to do this, and one of the most popular ones is to download the GPLv3-licensed OpenMediaVault, which has come to be considered the standard. The Debian-based Linux/Raspberry Pi distribution includes services like SSH, (S)FTP, RSync, and a BitTorrent client, which can be operated through a web interface, making it the perfect out-of-box solution for configuring a Raspberry Pi NAS. Thanks to its modular structure, the range of functions can be extended at any time through plugins.
In the following tutorial, you will learn how to install OpenMediaVault and what steps are required to implement the procedure from your own Raspberry Pi NAS server.
Step 1: download and install OpenMediaVault
Like with Raspbian or other Raspberry Pi versions, you need an external computer to download and install OpenMediaVault. On this page, you can access the official SourceForge directory for the open source software, which contains the corresponding image file for the Raspberry Pi models 2 and 3. Download the file, which is just over 300 megabytes in size, and write it into a microSD card using imaging software like Etcher.
Before initiating the automatic installation process, you should configure your network router to assign the minicomputer the same IP address each time it is started up, otherwise it will change with each restart.
Step 2: start the Raspberry Pi NAS and change the keyboard layout
In most cases, it is necessary to connect the monitor and keyboard to the Raspberry Pi to proceed further. Once you have done this, start the boot and installation process using the microSD card, until you can log into the NAS program through the shell for the first time. You can do this using the following standard login data:
Username: root Password: openmediavault
You do not need to operate the Raspberry Pi through the keyboard and monitor if your router automatically outputs the IP address that the mini-computer uses for NAS distribution. If this is the case, you can administer a second computer through the web interface right from the beginning.
Since the American keyboard is preselected in OpenMediaVault, you may need to change the keyboard layout if you are accessing from a different country.
Step 3: change password and display IP address
After switching to the appropriate keyboard language, it is time to assign a new root password for shell access to your Raspberry Pi NAS to prevent unauthorised users from logging in using the familiar default password. The required command is as follows:
Enter the new password twice and confirm the entry in both cases by pressing the enter key. If the change was successful, the command line displays the message (“password updated successfully”).
Use the command “iconfig” to start the command line program of the same name, which provides you with all important network information. The IP address (“inet addr”) listed under “eth0” is particularly important to further configure your Raspberry Pi NAS server. This is the address assigned by your router to the NAS server.
Step 4: logging onto the web interface
After you have laid the foundation for using the Raspberry Pi as NAS server in the previous steps, you can now log on to the web front end where the actual configuration takes place. To do this, you switch from the Raspberry Pi to another computer that is only on the same network and must have a standard Internet browser. Start the browser and enter the IP address that your router has assigned to the Raspberry Pi NAS into the address line. There is also a predefined default login for the NAS distribution.
Username: admin Password: openmediavault
After a successful login, OpenMediaVault’s start menu opens, providing an overview of the available services and various service information. A first possible configuration step is to adjust the system date and time (“Date and Time”). If your network is connected to the Internet, you can check “Use NTP server” – otherwise simply enter the corresponding times manually.
Step 5: securing the web interface
Since you make all the important settings on your Raspberry Pi NAS server through the web interface, it makes sense to secure the connection as thoroughly as possible. This is done by default through the unencrypted HTTP protocol, which is why it is advisable to activate the encrypted pendant HTTPS counterpart. To do this, select the menu item “General Preferences” in the “System” partitions and move the slider to “Secure Connection”. To use TLS/SSL, you also need a certificate that can be created under “System” -> “Certificates” -> “SSL”. Just click on “Add” and in the following pop-up window, click on “Save”.
If desired, you can also fill in the information fields for the certificate and determine the key length and validity period of the certificate yourself.
Enter the certificate in the general settings, click again on “Save” and confirm the decision. Using the three-point symbol, you then disconnect the current connection from the web interface and replace the HTTP in the address line with HTTPS to initiate a new connection (this time through TLS/SSL). Since the browser does not yet know the certificate, a warning will appear until you have added the certificate as an exception. Log in one last time with the standard data to enter your own password under “System” -> “General Settings” -> “Web Administrator Password”.
Step 6: connecting the storage media to the Raspberry Pi NAS
For the NAS server to work as a central file storage location, the respective storage media needs to be connected to the Raspberry Pi and configured to the web interface. If there is a power supply and physical connection, then you can display the data carriers in the “Real Hard Disks” partition of the “Data Storage” partition. If OpenMediaVault does not automatically detect a disk, you might need to use the “Search” button. Different partitions of your connected media can be found under “File Systems”. If one of the storage units you added is missing, you can add it using the “Create” option. Then mark the individual storage units you want to include, and add them to the Raspberry Pi NAS system using “Mount”.
The “boot” and “omv” partitions are part of the NAS distribution on the microSD card. Leave it unchanged as the data partition of the card, listed separately.
Step 7: setting up file sharing on the included partitions
To allow users to store files on the connected data storage devices later, share the corresponding folders under “Access Control”. To do this, click on the submenu item “Shared Folder” and then “Add”. Start with the user directory (also called the “home” directory), which you need to assign the path homes/ for. With all other folders, however, you can let your imagination run wild with regard to name and path.
OpenMediaVault offers the option to combine several removable media storage units into a RAID network. In doing so, the individual memories are converted into a single logical drive, which then guarantees a higher data throughput and/or higher reliability. Depending on the selected RAID level, a certain minimum number of disks is required.
Step 8: creating user profiles to access to Raspberry Pi NAS Server
Once you have added storage capacity to the Raspberry Pi NAS and structured it accordingly, the next step is to create a user profile. You can do this in the “User” section of the menu (or through “Access Control”). Click on the “Add” option and type in the corresponding user data (name and password). Move the slider across under “Change Access” if you want to allow a user to adjust their login information. Then open the overview of shared folders again, select the folders that are relevant for access, and assign the corresponding rights (read/write, read-only or no access).
If you activate the “User’s Home Directory” option in the user settings, newly-created users will automatically receive their own folder in the user directory created in step 7.
Step 9: setting up access services for the Raspberry Pi NAS Server
Finally, it is important to clarify how users can exchange data with the NAS server. SSH (secure shell) is enabled by default, but can only be used by Linux users (through the terminal) without needing additional software. Windows users need client applications such as PuTTY or WinSCP for data transfer through the network protocol.
A more convenient solution is therefore the cross-platform SMB (Server Message Block), which you can activate under “Services” -> “SMB/CIFS”. Windows has been supporting the protocol by default for years, while Linux and macOS have been using Samba which is also a suitable solution. When activating the service, also check “Activate home directories for users” before adding the folders you want to be accessible through the protocol under the “Shares” tab.
Step 10: accessing the Raspberry Pi NAS
All important points for operating and using the Raspberry Pi NAS server are now fixed, so that the starting signal for the central file storage can be given. The users only have to connect to the server. If using Linux or Ubuntu, open the file manager and select the option “Connect to server”. Then enter the server address including the prefix smb: //, and the connection is initiated.
Windows users establish the SMB connection to the Rasbperry NAS through Windows Explorer. In this case, it is enough to just enter the IP address after inserting the double backslash (“\\”).