Do you have a bunch of USB disks that you juggle between your various computers? Did you know that you can plug all of them into a Raspberry Pi, which you can then use as a network attached storage (NAS) box?
Using the Raspberry Pi as an always-on NAS box sounds like a wonderful use of the silent little device. However, setting it up as one used to be an involved process. That's until the Debian-based OpenMediaVault (OMV) distro decided to roll out a version specifically tuned to the Raspberry Pi.
Once it's up and running, you can configure and manage the distro using its browser-based administration interface.
You can then use the USB ports on the Raspberry Pi to attach USB disks, which are then made available to your entire network for storage. Remember that for best performance, make sure you use self-powered removable disks. You can use the disks attached to the OpenMediaVault NAS individually, or assemble them in a software RAID array.
The distro has ample options to manage other advanced aspects of a NAS distro.
To get started, download the Raspberry Pi version of OpenMediaVault. The distro has separate releases for the Raspberry Pi 2 and the original B/B+ models, so ensure you grab the correct one. Then extract the .img file from the download and transfer it on to an SD card with
sudo dd if= /omv_1.17_rpi_rpi2.img of=/dev/sdb
replacing /dev/sdb with the location of your SD card. Now boot the Raspberry Pi with the freshly baked SD card. There's no installation involved and you can start configuring the distro as soon as it boots up. You can access its browser-based interface on the IP address of the Raspberry Pi – such as 192.168.3.111.
You're asked to authenticate yourself, which you can do using the default credentials for the administrator – admin:openmediavault. However, you should change this default as soon as you log in. Head to System > General Settings in the navigation bar on the left, switch to the Web Administrator Password tab and enter the new password in the appropriate text boxes.
You can also use the System menu to configure several aspects of the NAS server, such as the server's date and time, enable plugins and keep the system updated.
Once it's up and running, plug one or multiple USB disks into the Raspberry Pi. Head to Storage > Physical Disks and click the Scan button to make OpenMediaVault aware of the disks.
Then use the Wipe button to clean the disks individually. If you've inserted multiple disks, OpenMediaVault can even tie them into a software RAID (see walkthrough over the page). OpenMediaVault supports multiple RAID levels and each requires a different number of disks.
For example, the default RAID level 5 requires a minimum of three disks, while RAID 1, which mirrors data across drives, only needs a minimum of two. If you don't plan to use the inserted USB disk inside a RAID array, then after you've erased a drive, head to Storage > File Systems to create a filesystem on the drive.
Here click the Create button and use the pull-down menu to select the device you wish to format. By default, the drives are formatted as Ext4 but you can select a different filesystem using the pull-down menu. Besides Ext4, OpenMediaVault supports the Ext3, XFS and JFS filesystems.
Repeat the process to create a filesystem on all of the attached USB disks. After creating the filesystem, select a drive and then click the Mount button to bring them online.
Before you can store data on the NAS device, you have to create one or more users. To do this, head to Access Rights Management > User. The Add button on this page is a pulldown menu that enables you to either add individual users or import a bunch of users by adding them in the specified format.
When adding an individual user, you can also add them to an existing group. By default, all users are added to the Users group. If you want users to have their own home directories in the OpenMediaVault server, switch to the Settings tab and tick the box to enable the home directory for the user.
You must also specify the location for the home directory by selecting an existing shared folder on the NAS server or creating a new one.
Shares and permissions
The next step is to define a shared folder. The chief consideration while adding one is whether the NAS will be used by multiple users or a single individual. In case you're going to be sharing the NAS storage space with multiple users, you can define several folders, each with different user permissions.
To add a folder, head to Access Rights Management > Shared Folders and click the Add button. In the dialog box that pops up, select the volume that'll house the folder from the pull-down list. Then give the shared folder a name, such as Backup, and enter the path of the folder you wish to share, such as backup/.
OpenMediaVault creates the folder if it doesn't already exist. You can also optionally add a comment to describe the type of content the folder will hold.
Pay close attention to the Permissions setting. By default, OpenMediaVault only allows the administrator and any users you've added to read and write data to this folder, while others can only read its contents.
This is a pretty safe default for most installations, but the distro offers several permutations and combinations of permissions that you can select from the pull-down menu.
Even if you select the default Permissions setting when creating folders, which lets all users read and write data to the folder, you can fine-tune the access permissions and disable certain users from accessing or modifying the contents of a particular folder.
For this, after adding a user, head to the Shared Folders section, select the folder you want to control access to and click the Privileges button.
This opens a window with a list of the users you've added, along with tickboxes for controlling their access to that folder, so for example you can allow read-only access. With the users and shared folders set up, you're now ready to share the NAS storage with your network.
Follow the walkthrough to enable a network service that people can use to access the shared folders on the NAS. OpenMediaVault supports various popular protocols and services, including NFS, SMB/CIFS, FTP, TFTP, SSH, rsync and more.
Once you've created a network share, you can access the shared folders from anywhere on the network, irrespective of whether they reside on an individual disk or a RAID array.
You can either use your file manager's built-in Network feature to access the network shares, or enter the IP address of the NAS device in the location area, such as smb://192.168.3.111. You're prompted for a username and password before you can access the folders – unless, of course, you have marked them as public when adding them via Samba.
Enter the credentials of a user who has the appropriate permission to access the folder. After they've been verified, OMV mounts the shared folder. You can now upload files into the shared folder or delete them, if you have the permission, just as in the case of a regular folder.
It might take a little getting used to, but OpenMediaVault is a wonderfully versatile NAS option that helps you exploit the true potential of the Raspberry Pi.