Professionalize your home lab with a Raspberry PI and a NAS — Part 2

Maximilian Kilian
Mar 6 · 8 min read

Table of Content

Part 1: Modeling our network setup
Part 2: Setting up our NAS (that’s where you are now)
Part 3: Setting up our Ubuntu server
Part 4: Putting it all together

Part 2: Setting up our NAS

TL;DR of part 1

Hardware is getting cheaper and more economic, that’s why we want to create the perfect home network setup with a cheap Raspberry Pi 4 and self-built NAS. As a reminder: We chose to split our network into a public and private part, where the public part will be hosting our own websites and our cloud, both accessible from the outside. The private part will be managing our services we think are too sensitive to expose outside our network. Nonetheless, a NAS will be necessary.

What components did you use for your NAS?

While sorting out some old stuff (Covid-19 distraction) I discovered my old computer I’ve built when I was sixteen. At the time it was a powerful setup allowing me to play graphically demanding games. In 2021 it is not really powerful anymore, so I thought to myself if I could turn it into a NAS. Unfortunately the computer did lack a PSU and CPU cooler. So I just went to eBay-Kleinanzeigen and bought an used PSU for 20€, a cheap CPU cooler for an additional 20€ and last but not least another case which could host up eight 3.5" drives.

  • Motherboard: GA-P55M-UD2 with 6! SATA plugs
  • CPU: Intel i5–750
  • RAM: 8GB DDR3 (I really don’t know the frequency)
  • CPU cooler: be quiet! Pure Rock Slim
  • Case: Master Cooler Elite 432

The setup in today’s perspective is far from being as energy saving as possible with the latest components, but with 40W at idle (without hard drives being spinned down) acceptable. If you’re interested in how much electricity this setup costs, head over to part 1 including a brief calculation.

Let’s get down to business …

Okay, so first things first: The Pi will be acting as our docker host as well as hosting our PiHole instance, which we’ll need for name resolution inside our network. The NAS will be solely acting as our backup server, configured as RAID-1, providing us with the capabilies of CIFS/Samba and NFS. The CIFS/Samba implementation helps us setting up a network share, which makes day-to-day life in home office easier (especially if you have to share some data). NFS on the other side will host our docker volumes on the RAID-1 configured file system. This will make our life easier in case of any hardware drive failure, as we would still be able to access our data (and swap out the faulty hardware drive).

Now let’s have a quick glance and what we’ll be doing today.

Setting up Open Media Vault

Okay, so our NAS is up and running but we do not have any sort of NAS software installed. Which software should we use? Admittedly, I am a huge fan of open source, that’s why I chose Open Media Vault as it was fulfilling a lot of my requirements and could be extended by community plugins.

I’m assuming that you’ll have a understanding of how to install software via an USB stick, therefore I’ll spare you with those details. But be aware of one thing: Open Media Vault is tightly coupled with Debian and therefore controls a lot of Debian’s settings, especially the network interfaces. Do yourself a favor and install Open Media Vault with your ethernet cable plugged in, otherwise you have to configure everything on your own afterwards.

Of course you’d be able to connect your NAS through WiFi as well, but then you will lose the capability of WOL, which is indispensable if you don’t want your NAS to be up and running all day (and starting your server from outside your network).

Activate WOL and assign a static IP to Open Media Vault and

After the successfull installation of Open Media Vault you will be greeted with the following login screen:

The default login is admin:openmediavault. Log in, change your password and navigate to system/network which is shown as alink in the left sidebar. Mark your ethernet interface, click edit and scroll all the way to the bottom. If your setup supports WOL you’ll have the “Wake-on-LAN” switch.

Activate WOL: check! Let’s tackle the static IP part. There are actually two ways of assigning your OMV a static IP. First one is over your router, where you’d just say that this network device should always have the same IP. Second one would be configuring it in the same network menu we enabled WOL. If you’re wondering why we need a static IP: it’s necessary for our docker services to access our RAID’s file system with the same IP, as you’d have to provide another IP to your services after every reboot.

Initialize your preferred RAID level

Okay, depending on your setup you can now choose different RAID levels. For me only having two 1TB hard drives, I’m chosing RAID-1. If everything works out fine and your computer has successfully detected your hard drives, you can check that your disks are available under the menu link data storage/drives. This interface should show you all your disks, including your hard drive you installed OMV to.

Okay, but now let’s setup our RAID. Click on data storage/raid management and create a new RAID by selecting a name and the preferred RAID level as well as the disks you want to use.
If your disks are not showing up in this menu, just head back to the previous menu and delete your two hard drives. Choose the full mode as it seems to work better. Afterwards you should be able to see your hard drives showing up while creating a new RAID level.

Initialize a file system

You have successfully created your RAID level, therefore we need to set up a file system. Head to the data storage/file system interface located in the same menu. Click create and choose your freshly created RAID as device and give it a cool name (this step is super important, the name must be super cool!). As a file system choose EXT4 and hit ok.

Congratulations, you’ve set up your RAID! Now let’s activate the services we’ll need later on.

Create shared folders

Head over to the menu point access control and the included sublink shared folders. This is important: whenever you want to create a directory you want to share with NFS/FTP/CIFS/Samba or something else, you have to first create this folder physically on your NAS through this menu.

Click add, choose a meaningful name, select your RAID as device and insert a path (if you want to have it reside on root level, just type the name without “/” e.g. “share”). Leave the access control to the default selection and hit save.

Secure CIFS/Samba and NFS with a user

Well done! We have just created our first share, now let’s protect it with a user. Head over to access control/user and create one which is solely responsible for your created share. Click add and fill out the requested details (name, password and shell). Now head back to the submenu access control/shared folders, select your new share and hit the button privileges. Your user should now show up in the pop-up window and you can assign different permissions to your user. Because of the nature of a network share, we want to read and write and select the corresponding checkbox.

Now repeat the previous steps and create an additional folder, but this time as NFS share.

Activate the shares

Head over to the menu link services and click on SMB/CIFS and activate it by clicking the switch.

Next select “Share” (blue top bar), click add and select one of your previously created folder which is intended as CIFS share. Leave the default values and click save. You should see a similiar image like the one below:

Now, do the same thing for NFS — activate the service and add your nfs share. Important: In order to use docker volumes on your NFS share you have to add add the option “no_root_squash” to the advanced options text field:

Why do we need no_root_squash? Unfortunately, it’s a little bit of a security risk and I’m open to any suggestion on how to do this differently (I did not find any solution) but basically this option allows remote users to change any file one the NFS share and this is what we want to achieve. As a reminder: We use a fully dockerized setup, so docker has to be able to change the permissions and the ownership of the NFS directory. If we don’t include this option, docker will in most of the cases not be able to start because of permission errors.

Install OMV-Extras

Open Media Vault is highly extensible through its plugin system, but initially there are not a lot of plugins available. So, let’s install a plugin which is called “OMV-Extras” including additional repository links. Log into your NAS and open a root shell and issue the following command:

Switch back to your Open Media Vault interface and check if a new link has appeared under the system menu link.

Now click the link extensions and search for “openmediavault-autoshutdown” and install it. If everything’s correclty done, you should now have another menu link inside services saying “Autoshutdown”. Hooray, you’ve successfully installed your first plugin!

Configure automatic shutdown and planned tasks to save energy

Phew, almost done. The only thing left now is to activate some energy saving options for our NAS. Under the link system/power management you can find planned tasks in the top blue bar. Click on it and configure your automatic shutdown (which is nothing else than a cron job). For my setup, I want my NAS to shutdown every day at 10pm. This would look as follows:

I promise, this is now the last task we need to do! Go to services/autoshutdown and activate it. All done! Autoshutdown is a pretty straight forward tool and the standard configuration should be sufficient for most of people. But in case you want me to post my setup, let me know and I’ll be glad to share it with you.

Part 3 is ready, check it out!

A series on how I professionalized my home infrastructure with a cheap Raspberry Pi and a self-built NAS

How to easily host your own websites and services inside your home network.

Maximilian Kilian

Written by

I love to solve problems with a technical solution and I am absolutely convinced that technology can be used to facilitate every day’s aspect of life.

A series on how I professionalized my home infrastructure with a cheap Raspberry Pi and a self-built NAS

Did you ever want to to host your own services like Apache, GitLab and Nextcloud inside your home network and be the root of your setup? After the completion of this 4 part series you’ll have an understanding of how this is possible and maybe even decide to try it out on you own.

Maximilian Kilian

Written by

I love to solve problems with a technical solution and I am absolutely convinced that technology can be used to facilitate every day’s aspect of life.

A series on how I professionalized my home infrastructure with a cheap Raspberry Pi and a self-built NAS

Did you ever want to to host your own services like Apache, GitLab and Nextcloud inside your home network and be the root of your setup? After the completion of this 4 part series you’ll have an understanding of how this is possible and maybe even decide to try it out on you own.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store