How to Turn a Raspberry Pi into a NAS Server

If the Raspberry Pi are characterized by something, it is for their versatility, and it is that with these mini PCs you can do almost everything. Today we are going to teach you how to turn a Raspberry Pi into a home NAS server , whether using SATA hard drives, external USB drives or even pen drives, all easily and quickly.

The idea is to use the Raspberry as a network file server, using whatever type of storage you want. You can use hard drives with a SATA interface, an SSD, external hard drives with a USB connection or even USB pen drives, as well as the Raspberry’s own internal storage. It will be up to you to choose the storage medium used, since it is indifferent when configuring what we are going to teach you in this tutorial.

Turn a Raspberry Pi into a NAS Server

What materials do you need?

  • A Raspberry Pi, and it is recommended that it be a Raspberry Pi 4 for better performance, although from the 2B model it will already work.
  • Have Raspberry Pi Lite OS installed on the device’s memory card.
  • A Windows PC for certain configurations.
  • Storage, which as we have said can be USB disks, pen drives, etc.
  • Network connection, if possible wired for better performance.

Raspberry Pi NAS

Turn your Raspberry Pi into a NAS

To get started, you need to install the Raspberry Pi Lite OS operating system , since it is the most recommended version to make sure everything works correctly and avoid compatibility problems.

To get started, remove the micro SD card from the device and insert it into a card reader on your Windows PC. Open Windows file explorer and navigate to memory card storage. At the root, right-click on any blank space and select New -> Text Document. You should rename the file as “ssh” (no extension), ignoring the warning that will indicate that removing the extension may cause the file to stop working.

SSH Raspberry Pi NAS

The file should not be edited, it simply must exist with that specific name. Once this is done, you can remove the micro SD from your PC and insert it into the Raspberry Pi, to proceed to boot. In principle you will not need to connect a monitor, keyboard or mouse to the Raspberry if you don’t want to, you can perform all the configuration remotely from your PC.

Once the system boots, the first thing you should do is know the assigned IP, since we will have to connect to it through the ssh protocol. To do this, from the Raspberry you can open a command line and type “ifconfig -a”, or you can go to the configuration page of your router to know the IP of the device, in the DHCP section.

Once you know what IP your Raspberry Pi is assigned to, you will need to download and run PuTTY to connect to it. Simply write the IP in the Host Name section, use port 22 and select SSH as the connection type.

Putty

When connecting, a warning will appear, simply select yes and wait for it to connect. When it asks for username and password, if you have just installed the operating system, use the username “pi” and the password “raspberry” to access. In fact, we recommend that the first thing you should do nothing more than boot is to type the command “passwd” to set a new password that only you know.

Cambiar contraseña Raspberry Pi

Once this is done, we will continue to update the system to the latest version. To do this, enter the following commands:

 sudo apt update && sudo apt -y upgrade
sudo rm -f /etc/systemd/network/99-default.link

Wait for it to finish and reboot the device with the command “sudo reboot”. Once it reboots, run the following command, which is used to install OpenMediaVault 5.

wget -O – https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash

The installation process takes about 30 minutes, so be patient and wait for it to finish. The Raspberry will automatically restart when finished.

Instalar Open Media Vault

Once the Raspberry boots, leave it alone and go back to your Windows PC. Open an Internet browser and type the IP of your Rasberry in the address bar, as is. The OMV5 menu that we just installed will open, and it will ask for your username and password. The initial user is admin and the password is openmediavault .

Acceder OMV

The first thing you should do is access “General Settings” or General Settings, under the Settings / Settings menu, which will take you to the Web Administration tab. Change the “Auto Logout” section from 5 minutes to a day to avoid losing your settings, because if you spend 5 minutes without modifying anything, it will “kick you out” otherwise. Click on the “Save” button and wait for it to finish.

Configurar OMV5

We also recommend touching the “Web Administrator Password” menus to change the access password, as well as “Date & Time” to set the correct date, time and time zone. Once you have configured all this to your liking, go to the “Update Management” section, and in the “Updates” tab, click on the “Check” button to see if there are updates. If there are, select them all and install them to have the latest version.

Actualizar OMV

You already have the whole system ready, and it only remains to configure the storage.

Configure NAS storage on your Raspberry Pi

In OMV5, access the “Storage” menu and then the “Disks” sub-menu. There you will see the micro SD of the Raspberry, where OMV5 is installed, marked in yellow as telling you that you cannot touch it, but the rest of the storage devices that you have connected to the Raspberry will also appear. In the example image, we have a 1TB Seagate USB drive attached.

Discos Raspberry NAS

Here you can format and prepare the disks if you need it. Select the hard drive you want to use and click on “Mount” to use it.

Users, privileges, and shares

As with any NAS, you will have to configure the users and their privileges first of all. Access the “Access Right Management” menu and then “User”, where you can create the users you want and assign them privileges. All users must have the privilege (within groups) ssh to be able to connect remotely, while if you want to create administrator users you must put them in the “sudo” group.

Usuarios OMV5

Of course, you will also want to set up shares. To do this, access the options and then “Shared Folders”, where by clicking on the “Add” button you can create shared resources, assigning permissions for them depending on the user groups that you have previously created.

Recursos compartidos OMV

How to access your NAS from the local network

Now that you have your Raspberry Pi turned into a NAS, you will want to access the configured shares. From Windows, if you go to “Network” you should see the Raspberry, and within it will be all the resources you have created (if you access with a user with privileges to do so, of course).

Recursos NAS Raspberry Pi

If your NAS does not appear in Network, go to the Control Panel All Control Panel items Network and Sharing Center Advanced Sharing Settings and make sure you have the “Enable network discovery” option enabled.

Recursos de red

If you continue to have problems, you can always access “below the net”. Press WIN + R (Run) and type IP_Raspberry_Pi, obviously changing this name to the IP of your device.