Thu. Aug 11th, 2022

We are going to build a NAS (Network Attached Storage) with a RPi 4 or a VM. This will be done with Tools and Apps that are readily available in the linux Distro that you use on a regular basis. We’ll install these and configure them to use as a NAS. Let’s get started:

Install OS (Use RAID0 for multiple drives)
sudo passwd root
sudo systemctl stop ufw # Stop the firewall
sudo systemctl disable ufw # Disable the firewall
sudo timedatectl set-timezone America/New_York # Set server clock to your timezone
sudo nano -c /etc/hosts # Put in your Server Hostname/IP

Add the webmin repositories to our build.
sudo nano /etc/apt/sources.list
deb http://download.webmin.com/download/repository sarge contrib # Copy & Paste into sources.list

note: add the webmin gpg key to your repository
sudo wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
sudo apt update

Add the necessary utilities we need to configure the NAS Services
sudo apt -y install tgt samba nfs-kernel-server webmin
sudo apt -y full-upgrade
sudo reboot
note: Check for drive status
note: Prepare the drives for use
sudo fdisk /dev/sdX # Partion the drive # Initiate & Partition the Drive
sudo mkfs -t ext4 /dev/sdX # format the drive
sudo lsblk # Check that the Drives are working and alive
note: Create the Raid – I use RAID0 – and I want 1 partition
sudo mdadm –create /dev/md0 –level=raid0 –raid-devices=2 /dev/sdX1 /dev/sdX1
sudo mdadm –examine –brief /dev/sdb1 /dev/sdc1 >> /etc/mdadm/mdadm.conf
note: Create the filesystem on /dev/md0 (RAID Device)
sudo mkfs -t ext4 -L /dev/md0
Create your Mount point
sudo mkdir -p /srv/<folder_name_here>
Run fsck to fix any bad blocks on the raid
sudo fsck /dev/md0
Mount the array to a mount point
sudo mount /dev/md0 /srv/<folder_name_here>

I hope you enjoyed the article please come back to our little corner of the world.
Thank you.

By Michael Cooper

30 years in it, Senior Systems Engineer

Leave a Reply

Your email address will not be published.