Build a NAS system with OpenMediaVault and a Raspberry Pi

Lead Image © realmccoy, 123RF.com

Storage Buddy

,

A NAS system does not have to be large, heavy, and expensive. A Raspberry Pi and the OpenMediaVault Linux distro are a compact alternative to heavy and costly NAS.

Network-Attached Storage (NAS) systems are often ungainly contraptions that take up lots of floor space and come with many slots for hard drives or SSDs. However, an oversized NAS solution of the conventional sort generally is not needed on a smaller network that doesn't have a large video collection or database.

Dedicated NAS devices, already costly to purchase, also hit your wallet with relatively high energy consumption. If you don't need a big bulky dedicated NAS system, you can achieve much of the same result on a small scale by rolling your own NAS solution with a Raspberry Pi (Rasp Pi).

Don't expect your Rasp Pi NAS to shoulder enterprise-level workloads. One of the issues with using the Pi as a NAS is the bottlenecks caused by its system architecture. In particular, the relatively slow Fast Ethernet interface and the mass storage, which can only be connected via USB 2.0, take a toll on performance. But if you don't have big demands for performance, a simple and unobtrusive Raspberry Pi 3 (RPi3) will work well as a NAS.

OpenMediaVault [1] (Figure 1) is a NAS-focused Linux distribution that maintains a version for the Rasp Pi. Your Rasp-Pi-based OpenMediaVault server is suitable for minor datasets such as text files or spreadsheets. At a data rate of about 9MB/s (write) and 11MB/s (read) via Ethernet, you only need close to two minutes to transfer a 1GB file. In practice, this means managing large amounts of image or multimedia data with the Rasp Pi is not much fun. However, you do not have to give up on OpenMediaVault if you need more performance than a Rasp Pi can offer. The developers also provide a version of OpenMediaVault for classic x86 machines.

Figure 1: OpenMediaVault is a specialty Linux distro preconfigured for NAS scenarios.

NAS Software

Specialized operating systems are a recommended alternative to classic Linux for NAS tasks. Manual installation and configuration of all the necessary services is demanding, even for veteran Linux administrators, so a system that is already configured for NAS workloads has many benefits. Our Rasp Pi OpenMediaVault NAS has the added benefit of being tiny and unobtrusive.

As with other Rasp Pi distros, you need to burn the OpenMediaVault IMG file to a MicroSD card. Unpack the image file [2] into any directory on your computer. If you are using a Linux computer, use the dd command to write the image. If you are working on Windows, write the image with a graphical tool like Win32DiskImager.

As shown in Listing 1, Linux users should set the name (possibly with the path) of the IMG file for the if= input, and the device name of the MicroSD card in the card reader for the of= output. You can determine the device name with lsblk. Next, use sync to ensure that the system can empty write caches that may have been created. Then insert the card into the Rasp Pi and start it. You can configure the services via the web interface of another machine in the network.

Listing 1

Writing the IMG File on Linux

$ lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0  59,6G  0 disk
|-sda1                   8:1    0  53,7G  0 part /
|-sda2                   8:2    0   5,9G  0 part [SWAP]
sde                      8:64   1   3,8G  0 disk
$ sudo dd bs=4M if=omv_2.2.5_rpi2_rpi3.img of=/dev/sde
$ sync

From this point, please take care to ensure that you use a power supply unit that can provide at least 2.5A at 5V with the RPi3.

If the NAS is built with a Raspberry Pi 2 (RPi2) and an external 2.5-inch hard disk without its own power supply unit, you still need to prepare the USB ports (see the "More Power" box). However, keep in mind that not every hard disk will be a good match.

More Power

Xxx RPi2s are only set by default to supply low power via USB, meaning that many external 2.5-inch hard disks will not run. You must modify the Rasp Pi configuration in config.txt in order to provide more power on the USB interfaces – this modification is not necessary for RPi3. To undertake configuration work, log into the Rasp Pi OpenMediaVault via SSH as the root user with the password openmediavault. You can now open the configuration file with the nano /boot/config.txt command and add max_usb_current=1 to the end of it, before saving the file and restarting the Rasp Pi. An impressive 1200mA (instead of 600mA) is available on the RPi2 Model B, meaning that an external 2.5-inch hard disk will function without the need for additional power.

Since the RPi3 only has a Fast Ethernet interface with a maximum throughput of 100MB/s, you need to check whether the WiFi interface works faster, since it runs with a maximum of 300MB/s from the 802.11n standard onward. The nominally higher bandwidths of the WiFi interface, however, often fail less than the cable-based variety (due to the overhead during data transfer and depending on location). OpenMediaVault initially only activates the Ethernet interface, although it can cope with the RPi3's built-in WiFi interface if you configure it manually.

First Run

The Rasp Pi equipped with OpenMediaVault, when connected to a screen, simply shows a text-based terminal with a login request after booting. If you wish to configure the NAS system, switch to a desktop computer in the network rather than logging into the Rasp Pi directly.

The Rasp Pi's status messages display the IP address briefly before the login screen when the Pi receives its address through DHCP. If you are working on a Rasp Pi without a monitor, you can determine the IP address from a Linux PC via arp-scan (Listing 2); you can use the Adafruit Raspberry Pi Finder [3] for this purpose on other systems. Alternatively, read the IP assigned to the Rasp Pi from the web interface of your wireless router.

Listing 2

Finding the IP Address

$ sudo apt install arp-scan
$ sudo arp-scan --localnet | grep Raspberry

The next step is to open a web browser on the desktop computer and enter the IP address of the Rasp Pi as the URL. You will then come to a login screen, from which you first set the relevant language localization by means of a selection list, and then proceed to log in as admin using openmediavault as the password.

A clearly structured dashboard opens for you to call up all the configuration options from a list on the left. Next to this dashboard on the right, two small windows show the status of the individual services and simple system information.

The first step for increasing the security of the admin access is to modify the preset access data. Select the General Settings menu on the left before altering the login data in the Web Administrator Password tab. An encrypted connection via SSL can also be set up in the same menu – this time from the Web Administration tab. You must confirm each of these modifications by clicking on the Save button.

Check the time zone, date, and time settings on System | Date & Time and adjust these settings as necessary. Correct time and date settings ensure correct information in log files and are a prerequisite for some of the NAS automated actions. (See the "No Time" box.) The third step is to set up LAN access on System | Network. You can modify the configuration of the individual network adapters available on the system in the Interfaces tab and switch these services on and off in the Service Discovery tab. Finally, specify rules for the firewall as needed in the Firewall tab.

No Time

The Rasp Pi has never had an integrated clock (known in EDP jargon as a real-time clock, or RTC for short). The Pi therefore obtains the current time via an NTP server with each start-up. As a result of this limitation, OpenMediaVault displays a long error message on the Rasp Pi when applying changes in the settings. The developers recommend investing in an RTC module.

Moving to the last action for basic configuration of the OpenMediaVault system, you must install any pending updates. OpenMediaVault deploys Debian's Apt package system. Open System | Update Manager | Updates, display possible updates with Check, and install the updates that appear. Then activate the relevant options for automated updates in the Settings tab.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content