Building a Raspberry Pi-Based NAS: A Comprehensive Guide

Click /the blue text above/ to follow me

Building a Raspberry Pi-Based NAS: A Comprehensive Guide

Original text:
https://www.electronics-lab.com/project/pinas-raspberry-pi-based-network-attached-storagenas/
Network Attached Storage (NAS) is a high-capacity storage device that can connect to a local home or office network, allowing everyone on the network (with designated “permissions”) to access files on the hard drive without direct insertion. This facilitates internal sharing of large files like movies and other multimedia without the hassle of moving hard drives around.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
High-end consumer NAS devices are available everywhere in stores, but the emergence of SOCs and SBCs like the Raspberry Pi has made NAS one of the coolest things to create with SBCs. There are dozens of NAS DIY projects online, but the project by Instructables user Aramybox caught my attention, and I will introduce his build process in today’s tutorial.
Aramybox’s PiNAS project is one of the simplest and most elegant DIY NAS solutions I found online. The project is based on a Raspberry Pi and two hard drives, all housed in an innovative 3D-printed case. The core of the project is the Open Media Vault (OMV) operating system running on the Raspberry Pi. OMV is a network-attached storage (NAS) solution based on Debian Linux, containing services like SSH, (S)FTP, SMB/CIFS, DAAP media server, RSync, BitTorrent client, and more. It is primarily designed for small offices or home offices but is not limited to these scenarios. It is a simple, user-friendly out-of-the-box solution that allows anyone to install and manage network-attached storage without deeper knowledge.
The emergence of microcontrollers like the Raspberry Pi has popularized such solutions, empowering ordinary users to build powerful yet affordable applications.
By the end of this tutorial, you should be able to build your own PiNAS and make some upgrades to Aramybox’s work.
Required Components
To build this project, you will need the following components:
  1. 1x Raspberry Pi 3 or 4
  2. 1x micro SD Card – 8GB or 16GB [$5.79]
  3. USB micro splitter [$6.99]
  4. SATA to USB converter [$7.99] x 2
  5. 2.5″ hard drive x 2
  6. Raspberry Pi power supply (5V / min. 2A) [$9.99] x 1
  7. Cables
  8. 4x screws: M3x8mm
  9. 4x screws: M3x6mm
  10. 4x nuts: M3 square
In addition to electronic components, obtaining the following tools will help in making the case for the project:
  1. Soldering tools
  2. Screwdriver
  3. Hot glue gun
  4. 3D printer or 3D printing service

The bolts and nuts are made according to Aramybox’s case design. If you are creating your own case and making adjustments that might affect the specifications of the bolts and nuts, you may need to disregard the listed bolts and nuts and just obtain ones suitable for your design.

Case Design

A highlight of this project is the interesting case designed for it. The 3D-printed case consists of only 4 parts, and its design allows it to be secured with just 4 bolts, making it easy to open for switching drives or performing other maintenance.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
To facilitate replication of the case, we have attached the STL files in the download area at the bottom of the page. You can also access the design files through the project page on Thingiverse.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
In terms of printing materials, Aramybox used PLA for the inner layer and ABS for the three-layer outer shell. To improve the appearance of the case and eliminate some imperfections caused by 3D printing, we used sandpaper and spray paint.
Circuit Diagram and Component Wiring
To make the project more compact, Aramybox opened the SATA to USB adapter and desoldered the wires from the hard drive end to the USB end. Then, using jumper wires, he directly soldered the hard drive end of the adapter to the corresponding pins on the Pi’s USB port. Care should be taken at this point to ensure that the Pi is not damaged and that existing connections on the circuit board are not bridged. In addition to the SATA to USB connector, Aramybox also connected a female Micro USB power board to the Pi. This provides a convenient way to power both the Pi and other components (like the SATA connector) simultaneously.
The circuit diagram below shows the connections described.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide

You can choose to use male/female pins instead of directly soldering wires to the SATA interface. This is just for neatness.

The configuration after connecting all components should look as follows.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
Once this is done, you can explore the software of the project.
Software and Configuration

To give our device NAS functionality, we will use a modified version of Raspberry Pi OS, namely Open Media Vault, as the main control for the project.

First, we will burn the image of the Open Media Vault operating system onto the SD card. Now, I assume you already know how to use tools like Balena (for macOS and Windows users) to burn the Raspbian operating system onto the SD card. If you are new to this task, you can check our related tutorials online.

Once the SD card is successfully flashed with the operating system, install the card into the Pi’s slot, connect the Pi to the network via an Ethernet cable, and then power on the system. During the first boot setup, it is recommended to connect a monitor to the Pi. This will allow you to access important information like the IP address, username, and password.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide

With this information, you can now disconnect the Pi from the monitor and continue configuring Open Media Vault. There are 5 main parts to configure in Open Media Vault:

  • ✔️ System
  • ✔️ Storage
  • ✔️ Access Management
  • ✔️ Services
  • ✔️ Diagnostics
Follow the steps described by Aramybox to configure these parts:
1. Once you have your IP address, username, and password ready, launch your favorite internet browser (Firefox, Chrome, IE, etc.) on a device that is on the same network as the Pi.

2. Enter the IP address of PiNAS in the browser’s address bar.

3. You should now see the login screen for Open Media Vault.

4. Enter your username and password, then click “Login”.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide

5. After successfully logging in, start the configuration from the system settings.

6. For system configuration, we start with security. To ensure security, be sure to reset the password and username to something you can remember. On the page that appears, click on the network administrator password panel and fill in the new password. Click the save button.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
7. Next, we need to set the time and date for the system. Click on the time and date tab to make the settings. In the window that appears, select the time zone, enable NTP (Network Time Protocol) functionality, and set the time server. Click the save button to save the settings.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
8. Next, we configure the network identity. Click on “Network”, then browse through each tab to create a hostname for PiNAS, set a static IPv4 address so it doesn’t change after a reboot, and activate the required services in the “Service discovery” tab.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide

9. Next, we will configure the parameters related to “Storage”. Under “Storage”, we will set up disks, RAID management, and file systems for easy addressing.

Disks

1. Click on the “Disks” button

2. Make sure both disks are recognized and listed on the results page

3. Perform the following steps for both disks:

i. Select the disk, click edit, and enable write caching.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
ii. Select the disk, click “Erase”, and then click the “Quick” button to erase all data on the disk, giving the system a clean working environment.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide

RAID Management

1. In the dropdown menu on the right, select RAID() management, then click the create button.

2. In the window that appears, fill in the RAID name (e.g., raid1), RAID level (e.g., mirroring (RAID level 1)), select the devices to add to the RAID (select both disks), and other parameters.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
3. After completing the above steps, click “Create” to create the RAID using the selected disks. The RAID will take some time to resynchronize. After synchronization, the RAID status will change to empty.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide

File System

1. In the dropdown menu on the right, select File System, then click the create button.

2. Select your device, in this case, it should be the previously created “raid1” (or whatever name you gave it)

3. Give your file system a label for easy identification

4. Choose the type of file system you want

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
5. Click “OK” to create the file system

6. Wait for the file system to finish initializing (the status must be online)

7. Select the initialized file system and click mount to make it available

Next, we will proceed with the configuration related to access management. For this, we will create users and user groups to allocate access permissions. We will also create shared folders so that files on the PiNAS can be accessed just like files on a PC.

Create User

Accessing the file system requires user accounts.

1. Expand the “Access Management” dropdown menu and click on the “Users” tab.

2. Click “Add” to create a new user, fill in the name and password in the pop-up window, and click the “Save” button when done.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
Create User Group

User groups can easily manage access permissions. For example, you can restrict multiple users’ access to their group. Follow the steps below to create a user group.

1. Click on the “Groups” tab under “Access Management”.

2. Click “Add” to create a new user group.

3. In the pop-up window, enter a group name of your choice.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
4. Select the users you want to join the group through the members tab (they must be created first). Click the save button when done.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
Create Shared Folder
1. Click on “Shared Folders” under the “Access Management” window.

2. In the pop-up window, click “Add” to create a new shared folder.

3. Enter the name of the new shared folder (this name will connect to other machines).

4. Select the device to create the shared folder on (the previously created file system).

5. Choose or enter the path for the shared folder.

6. Set the desired permissions for the shared folder (more permissions will be set in the next step).

7. Click “Save” to create the shared folder.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide

8. Click “Permissions” to set permissions for users or user groups

9. Set the desired permissions for the user and/or user group

10. Click save to save the settings
Building a Raspberry Pi-Based NAS: A Comprehensive Guide

11. Click ACL to create a new access control list for the shared folder.

12. Set the desired user/group permissions (such as read/write) for users and groups.

13. Enable “Replace all existing permissions” and “Apply permissions to files and subfolders”.

14. Click “Apply” to create and apply the ACL.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
15. Finally, we need to configure the services, which is how to present PiNAS to other devices on the network.

SMB/CIFS

In the services section, we will only configure the SMB/CIFS section.

1. Expand the services tab and select SMB/CIFS.

2. On the generated page, click the settings tab and enable SMB/CIFS.

3. Open the “Settings” tab.

4. Next, click on the “Shares” tab and click the “Add” button to create a new SMB share.

5. Enable the new share.

Building a Raspberry Pi-Based NAS: A Comprehensive Guide
6. Select the shared folder (the folder created earlier).

7. Choose whether the share is public (the PiNAS will be clearly listed).

8. Enable respect for existing ACL (inherit ACL).

9. Enable permission inheritance.

10. Finally, click “Save” to create the new SMB share.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
After completing all this work, your PiNAS is ready for use.
Using PINAS
Once the configuration is complete, you can now completely close up the PiNAS. It should look like the image below.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide
To use PiNAS on a computer, you must connect the PiNAS share to the computer.

Please follow the steps below.

1. Press the Windows button on your keyboard, type cmd, and press Enter. The Windows command prompt will pop up.

2. Type the following command to connect to the PiNAS share:
net use N: \PiNAS\nas_share

3. Now the command prompt will ask you to enter a username for authentication. Enter the PiNAS username nas_user.

Now, the command prompt will ask for the password for nas_user; type in the password and hit Enter.

4. The command prompt should display a message like “The command completed successfully”.

5. After completing the above steps, you will see a new group: Network Location when you open Windows Explorer.
Building a Raspberry Pi-Based NAS: A Comprehensive Guide

The new group will contain all mapped network folders, just like the connected nas_share, and you should now be able to drag and drop data onto this drive, backing it up to the two mirrored disks of PiNAS.

This tutorial ends here. Feel free to explore and add more features to this project.

This project is credited to Aramybox’s contribution.

Like, bookmark, share, and follow for more updates!

Building a Raspberry Pi-Based NAS: A Comprehensive Guide

Leave a Comment

Your email address will not be published. Required fields are marked *