You may store data from your computer and mobile devices on external hard drives over your home or workplace wireless network with network-attached storage (NAS). You may connect your current storage devices, such as external portable hard drives and USB flash drives, to your Raspberry Pi to generate safe backups of all your essential information that are available from anywhere around the globe.

How to build a Raspberry Pi NAS

Your data will save to your external storage faster if your Raspberry Pi is faster. As a result, we recommend a Raspberry Pi 4 8GB, but any member of the Raspberry Pi 4 family would suffice.

You'll need a USB-C power source and a micro-HDMI-to-standard-HDMI cable if you're using a Raspberry Pi 4 or 400. Older versions will need a micro USB power supply as well as a normal HDMI-to-HDMI connection.

You Might Also Like:

Power sources exist in a range of shapes and sizes, and you may discover that an unauthorized type like a phone charger is insufficient for your Raspberry Pi. We provide authentic USB-C and micro USB power supplies in a range of regional formats for convenience and dependability. If you want to utilize your own power source, a lightning bolt will appear in the upper right corner of your screen if it isn't providing enough power to the computer.

Install Raspberry Pi OS Lite on your Raspberry Pi.

To install Raspberry Pi OS Lite onto your microSD card, we'll use Raspberry Pi Imager. Raspberry Pi Imager is a free program that may be downloaded for Windows, macOS, Ubuntu for x86, and Raspberry Pi OS.

Connect your microSD card to your computer and open the Imager program.

Using an SD card adapter, connect your microSD card to your computer. A minimum storage size of 16GB is recommended.

Install the Raspberry Pi operating system on your microSD card.

Imager for Raspberry Pi:

CHOOSE YOUR OPERATING SYSTEM: Raspberry Pi OS is located under Raspberry Pi OS (other). Because we don't require the desktop environment for our project, we're employing the smaller Raspberry Pi OS Lite.

To access the advanced menu, press Ctrl-Shift-X or select the Advanced Menu button on the Raspberry Pi Imager.

Set a username and password for SSH by checking the Enable SSH box. To access your Raspberry Pi and network storage, you'll need these credentials.

To exit the advanced menu, select save.

SELECT STORAGE: Choose a microSD card.

Last but not least, choose Write.

Remove your microSD card from your computer and plug it into your Raspberry Pi after it's finished.

Options for storage

We'll use a portable USB hard disc and an internal hard drive with a SATA-to-USB converter for this lesson. If you want, you can utilize a USB flash drive. We recommend deleting all data from your hard disc because you may need to format it later.

It is preferable to utilize a powered USB hub to connect your storage to your Raspberry Pi in order to keep a steady power supply to our external hard drives.

Getting your Raspberry Pi set up

An Ethernet cable is required to connect your Raspberry Pi to your network. For the most part, this entails connecting the device to your router directly. Connect your storage to the powered USB hub, and the hub to your Raspberry Pi after everything is linked. Finally, use a USB-C power supply unit to connect your Raspberry Pi to the mains.

Getting your IP address back

You'll need the IP address of your Raspberry Pi in order to connect to it through SSH from a regular computer. A device on your network is identified by its IP address, which is a unique string of digits. The most straightforward approach to locate it is to go into your home network and see what devices are connected through Ethernet (LAN). The login information for accessing your router should be printed on it (look for a sticker on the side or the bottom), or you may find it on the router's manufacturer's website (or of your ISP if they provided the router).

Use SSH to connect.

To access your Raspberry Pi, open Terminal on your computer and type the following, substituting "pi" with your previously chosen username and XXX.XXX.XXX with the IP address:

$ ssh pi@XXX.XXX.X.XXX

Use the password you created in Raspberry Pi Imager when prompted for it.

Run the following commands to confirm that your Raspberry Pi is properly configured for networking:

$ sudo rm -f /etc/systemd/network/99-default.link

rm -f /etc/systemd/network/99-default.link $ sudo rm -f /etc/systemd/network/99-default.link

To reboot your Raspberry Pi, perform the following commands when you've finished:

$ sudo reboot

OpenMediaVault

To handle our network storage, we'll be utilizing OpenMediaVault, a free piece of software. OpenMediaVault has a web-based interface that is simple to use, as well as many add-on choices for sophisticated users.

How to Setup OpenMediaVault

Return to the Terminal and SSH back into your Raspberry Pi after it has restarted.

$ ssh pi@XXX.XXX.X.XXX

Run the following commands to install OpenMediaVault:

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

Close Terminal after it's finished.

Installing OpenMediaVault

Open your regular computer's internet browser and input your Raspberry Pi's IP address into the address box.

Use the following credentials to log in to OpenMediaVault:

Username: admin Password: openmediavault

Change the password for your OpenMediaVault admin account.

Change your OpenMediaVault admin password by selecting the "cog" symbol in the upper right corner.

Create a network connection

Select Disks, then Storage. The SD card, as well as any other associated storage, should be visible. If not, double-check that everything is connected properly and restart the computer.

After that, go to Storage & File Systems. You'll probably see nothing here, so choose Create. You may choose your storage device here. Selecting EXT4 as the drive format is recommended. Close the window after selecting OK.

To mount the file system and make modifications, choose it.

Now it's time to make a shared folder.

Select Create from the Storage and Shared Folders menu. You may give the folder a name, choose which drive it should be on, and assign rights to people here. The permissions should be correct by default, but you can change them if you prefer a different network choice. Changes should be saved and applied.

Finally, we must ensure that machines on your network can access the folder.

Select SMB/CIFS from the Services menu.

Check the Enabled box under Settings and save. Select Create under Shares, then add your shared folder and save.

You should now be able to utilise your NAS system.

Using macOS to access your NAS

Press Command+K from your desktop. smb://XXX.XXX.X.XXX (replace with the IP address of your NAS Raspberry Pi).

Enter your e-mail address and password. The login and password you created in Raspberry Pi Imager will be used.

In a finder window, your shared folder will now appear.

Using Windows to access your NAS.

Open the Windows Explorer programme write \\XXX.XXX.X.XXX  (using the IP address of your Raspberry Pi NAS).

This should add a new Network entry to the left navigation bar and display its contents. When asked, double-click on the desired share and input the username and password you generated in Raspberry Pi Imager.

Using your iPhone to access your NAS

Using the iOS Files app, you may connect your iPhone to your NAS system.

To access the Browse view, open the app and click the "three dots" icon in the top right corner of the screen.

You'll notice a Connect to Server option here. Tap Enter after entering the IP address of your NAS Raspberry Pi and, if requested, the username and password you set in Raspberry Pi Imager.

Credit: Raspberry Pi

More Articles Must Read: