After many years of owning a computer, one invariably ends up with a few spare internal or external/USB hard drives. The Raspberry Pi is an inexpensive and energy efficient means of converting these into network-attached storage (NAS). The Raspberry Pi 4’s USB 3.0 and gigabit Ethernet ports in particular make it an ideal candidate for a fast and feature-rich network storage solution.
We already have a guide on converting your existing Raspberry Pi into a simple NAS. This guide, however, is meant for those who seek to harness the true power of the Raspberry Pi 4 with a bespoke Linux distribution built from the ground up to run as an NAS solution. OpenMediaVault 5 (OMV5) will not only deliver all the features of a basic Samba share, but it has far more powerful features and functionalities.
Here’s What You Need
Here are the essentials you will need before we can proceed.
1. Raspberry Pi: The Raspberry Pi 4 will deliver the best performance, but OMV5 works on Model 2B and onwards as well.
2. Storage: OMV5 is best installed on an 8GB microSD card. Larger capacities work as well but are wasteful because the NAS-specific distro takes up the entire space. Samsung or SanDisk Class 10 microSD cards rated A1 are our best bet. You can either use external USB hard drives as NAS drives or repurpose internal hard drives by installing them into USB hard drive enclosures.
3. Tools for Prepping OS Image: You’ll need the latest Lite version of the Raspberry Pi OS along with the official SD card formatting tool, Raspberry Pi Imager, and a computer capable of writing the OS image to the microSD card.
4. SSH Client: The installation process will require connecting to the Raspberry Pi through SSH.
5. Wired Network Access: An NAS works best when it is connected to the home network using an Ethernet cable. Wireless connections are neither stable nor fast enough for this purpose. OMV5 is designed to work as a headless server, so you can safely place the Raspberry Pi next to the router. You won’t be hooking up a display or input devices to it.
Installing Raspberry Pi Lite OS
To get started, we need to install Raspberry Pi OS. Be absolutely sure to download the Lite version and avoid the regular ones with the desktop for maximum compatibility.
Install the Raspberry Pi OS Lite to the microSD card using our excellent guide.
Once installed, remove the microSD card from the card reader and reinsert it. Open Windows Explorer and navigate to the microSD card. Right-click on any blank area within the file view of the microSD card and select “New -> Text Document.”
You should see the new file as “New Text Document.txt.” If the extension is not visible, you must force Windows to display the file extensions by accessing the Windows Explorer Options menu to change the setting. Right-click the text document and select “Rename.”
Change the name of the file to “SSH”. This step is critical to allow remote SSH access to the Raspberry Pi for installation purposes. Ignore the subsequent warning by selecting the Yes option.
Remove the microSD card from your PC and insert it into the Raspberry Pi. Hook it up to the network with an Ethernet cable and power it on.
Finding the IP Address
After the Raspberry Pi powers up, we will need to find its IP address to be able to ssh into it. There are a number of ways to do that. You can log into the admin panel of your router and access the client list. The exact location of the client list in the router menu will vary from router to router, but it is generally easy to find.
The device will be listed as “raspberrypi.” Make a note of the assigned IP address as highlighted in the screenshot above. Alternatively, you can access the “DHCP Server” section from your router menu and use the “Address Reservation” feature to permanently assign a static IP address to the NAS.
If you don’t want to bother with the router’s administration panel, refer to our handy guide on using Angry IP scanner to find out the IP address of any device on the network, including the Raspberry Pi.
If you still can’t find the IP address, attach a monitor and keyboard to the Raspberry Pi, log in to it, and type
ip add in the command line. Note the IP address displayed next to the Ethernet interface.
SSH into the Raspberry Pi
1. Head over to Windows’s PuTTY or open a terminal in any Linux computer. SSH into the Raspberry Pi.
2. Click Yes on the security alert that pops up. This is expected behavior for the first login.
3. Log in as “pi” with “raspberry” being the default password.
passwd once the command line prompt shows up post successful login to change the default password. Make sure you use a strong password.
5. Before we install OMV5, first update/upgrade the OS to the latest version:
sudo apt update && sudo apt -y upgrade sudo rm -f /etc/systemd/network/99-default.link
6. Reboot the Raspberry Pi:
Installing OpenMediaVault 5
SSH to the Raspberry Pi again after it reboots. Install OMV5 with the command:
wget -O - | sudo bash
The installation process will take approximately 30 minutes, so leave the computer alone to avoid interrupting the process. The Pi will reboot automatically upon successful installation.
OMV5 First Login and Basic Setup
1. On your computer’s browser, enter the Raspberry Pi’s IP address in the URL bar to open the web interface for OMV5. The default username is “admin,” and “openmediavault” is the default password.
2. Go to the “General Settings” option under the Settings menu, which will take you to the “Web Administration” tab. Change the “Auto Logout” setting from five minutes to one day to prevent losing settings due to a timeout.
Click the Save button and wait for the confirmation bar to pop up at the top of the window. Click on Yes and another confirmation prompt will pop up in the middle of the window. Click Yes on this one as well to commit to the settings.
3. Move on to the adjoining “Web Administrator Password” tab to change the default password to something more secure. Hit Save after you have entered the password.
4. Head over to the “Date & Time” sub-menu and select the appropriate “Time zone” from the drop-down menu. Enable the “Use NTP server” toggle button to use the Network Time Protocol for accurate and consistent timekeeping.
Click on the Save button and select Yes on the two subsequent confirmation prompts. This process must be repeated each time you save settings after making changes, so be sure to wait for the confirmation prompts if they don’t show up immediately.
5. With the basic settings in place, head over to the “Update Management” sub-menu. In the Updates tab, click on the “Check” button to look for updates.
6. Select all packages by enabling the checkboxes on all pending updates. Click on the “Install” button to initiate the updates. This will take a few minutes, so grab another cup of coffee. Select “Close” on the installation progress pop-up after the updates have been installed. The page will subsequently reload pending confirmation from you.
Preparing Storage for OMV5
1. Head over to the “Storage” menu and enter the “Disks” sub-menu. You can see the microSD card housing OMV5 highlighted in yellow in the screenshot below. The drive listed below the microSD card is the 1TB external hard drive that will be used for storage.
Note: skip to “Step 3” if your external hard drive is already populated with data and you otherwise don’t want to wipe it clean.
To wipe the drive clean of existing data, click on the correct drive and hit the “Wipe” button. This applies to fresh blank drives, or if you otherwise wish to start with a clean slate. You will be presented with a confirmation prompt, followed the choice between “Quick” or “Secure” wipe methods.
Move to the “File Systems” sub-menu.
2. If you wiped the hard drive clean in the previous step, it will be absent here because it lacks a file system. That’s your cue to click on the “Create” button and format the drive with the file system of your choosing.
In the subsequent pop-up window, select the desired hard drive from the Device drop-down menu. Type in a name for hard drive in the Label field. Finally, choose the “EXT4 Filesystem” from the drop-down menu because it will deliver the best performance in this native Linux operating system. Click OK and accept the ensuing confirmation prompts.
Note: A drive formatted with the EXT4 filesystem can only be accessed by a Windows machine over the NAS. The Linux-based filesystem will not be recognized if drive is hooked up directly to a Mac or Windows PC. Formatting a new drive to the NTFS file system on a Windows machine will not only allow it to be used with the NAS, but that will also provide the flexibility of disconnecting it from the NAS in order to physically access it from another Windows machine.
3. Select the external hard drive and click on the Mount button.
Creating Users and Assigning Privileges
OpenMediaVault 5 allows a granular control over user accounts while incorporating the capability to assign varying degrees of privileges on a per-user basis. This is a great way to pick and choose who has read/write access to various shared folders on the NAS.
1. Move on to the “User” sub-menu within the “Access Rights Management” menu. In the “Users” tab there, you should see the account “pi.” This account has access to every single group governing critical system functions.
2. Click on the “Add” drop-down menu with the plus sign. Click on the subsequent “Add” button to bring up the “Add user” pop-up window. Enter the name of the user, followed by an optional descriptive comment and the email address.
3. Click on the “Groups” tab in the same “Add user” pop-up menu to add this user to relevant groups. The “users” group will have been selected by default. Click on the checkbox next to the “sudom” “ssh,” and “sambashare” group options. Click on the Save button to commit to these changes.
You can repeat the process to create additional users, but make sure you only give access to the “sambashare” group in addition to the default users group for additional accounts. Having separate accounts for family members makes it easier to keep your shared folders private if needed.
Setting Up Shared Folders
Before we can move to the Settings tab within this sub-menu, we must set up the shared folders first.
1. Skip to the “Shared Folders” sub-menu. Click on the Add button to create a new shared folder. Start by creating a folder containing files that will be shared between users and subsequent OMV5 plugins and applications.
In the subsequent “Add shared folder” pop-up window, enter the name of the folder. We will go with Common for this one. Use the Device drop-down menu to select the external drive that we mounted earlier. Since this is a shared folder, select the “Everyone: read/write” option in the “Permissions” drop-down menu. Click on the Save button.
2. We will now create a Movies folder that can be accessed by guests on the network, but only users with legitimate accounts (family members, for example) can add, delete, or modify content within the folder. Follow the process in the last step but select “Administrator: read/write, Users: read/write, Others: read-only” in the Permissions drop-down menu.
You can even restrict anyone except family members from accessing certain folders (containing family photos, for example) by selecting the option containing the argument “Others: no access” from the Permissions drop-down menu.
3. It is also possible to restrict everyone except yourself from accessing sensitive folders or even pick and choose which users have access to specific folders. We can do this by highlighting the desired folder and clicking on the “Privileges” button at the top.
This will bring up the “Shared folder privileges” pop-up window, where you can give read-write access to yourself and other users by ticking on the appropriate checkboxes as illustrated in the screenshot below. Here we have restricted users “shashi” and “zoe” from accessing the Work folder. Click on the Save button to finalize the changes.
Referencing Folders through CIFS
The next step involves referencing these folders in OMV5 to make them accessible over the network. Head over to the “Services” menu to do just that. You can choose between “NFS” and “SMB/CIFS” protocols for network sharing. The latter is recommended for Windows and Mac users since it has wider compatibility between operating systems.
1. Enter the “SMB/CIFS” sub-menu, and you will be presented with the Settings tab. Skip to the “Shares” tab for now. Click on the Add button to see the “Add share” pop-up window.
The toggle button for “Enable” should be enabled (green) by default. Select the Common folder we created on our external hard drive from the “Shared Folder” drop-down menu. Since this is a shared folder, we will select the “Guests allowed” option from the “Public” drop-down menu. The toggle options for “Set Browseable” and “Honor Existing ACLs” should be enabled by default. Click on the Save button.
2. The process is similar for other folders. It’s worth noting that selecting the “No” option from the Public drop-down menu instead of “Guests allowed” prevents anyone except registered users from accessing the shared folder. This is a great option to, say, restrict anyone but your family from accessing family photos on the NAS.
3. With the shares set up, navigate to the Settings tab in the same “SMB/CIFS” sub-menu. Click on the “Enable” toggle button in the “General Settings” section to make it green. Hit the Save button to commit to the changes.
Accessing the NAS Over the Network
Your OMV5 installation has been configured just like that. Now all you need to do is access it from another computer on the network.
1. With OpenMediaVault 5 configured and the shares set up, head over to a Windows PC to access the NAS. Open the File Explorer and head over to the Network section. Your Raspberry Pi NAS running OMV5 should show up with the default hostname “RASPBERRYPI.” Double-click on it to access the list of shared folders we have created in the NAS.
2. If you have trouble locating the NAS, head to the Windows Control Panel and follow the path highlighted in the screenshot below to access “Advanced Sharing Settings” in the Network and Sharing Center. Enable the “Network Discovery” and “File and Printer Sharing radio” buttons if they aren’t already.
If that doesn’t solve your problem, simply press Win + R to bring up the Run dialogue box. Enter the IP address of your NAS suffixed with two consecutive backslashes and hit enter to access the NAS. For example, I have to enter \192.168.0.132 to access my NAS. The same can also be entered in the address bar of the File Explorer window.
3. Once you have access to the NAS, double click on the Common folder to verify if you can access it.
Since the Common folder is open to everyone, accessing it is a simple matter of double-clicking the folder. However, only legitimate users can access the Photos and Work folders with restricted access. Double-clicking on such folders will open a dialogue box where you can enter the user name and password to the appropriate account.
If the user name field is greyed out, click on “More choices” and select “Use a different account.” This will allow you to enter any user name. Check the “Remember my credentials” option if you want to avoid manually logging in each time you access the folder on the current machine.
That’s it. You have successfully created an NAS with your Raspberry Pi. There are plenty of projects you can do with a Pi, too, such as running a minecraft server, a DIY chromecast, or even a retro gaming machine. Check out our Raspberry Pi’s project page for more interesting projects.