Turn a Raspberry Pi into a NAS

It occurred to me that the main reason I hadn’t followed through on many Pi Projects is because I still don’t really know my way around Python. It’s on the to-do list, really... this was a simple project that just required some Googling and some command line stuff, no actual programming needed.

Things needed:

  • a Raspberry Pi. I am using the model 4, although this probably would work fine on a 3.
  • A microSD card for the OS. You’re not going to be storing stuff on it, so it doesn’t have to be too large. 8GB is fine.
  • The actual HD for the external storage. If you’re using a SSD the Pi will power it fine, but if you’re using spinning drives then you’ll need an external powered adapter to connect it to the Pi’s USB connector.

Also if you wanna make it pretty, a nice case for the Pi.

I forget where I got this one, but it’s nice and does the job.

For the OS, I used Raspberry Pi Imager to download and write the latest Raspbian to a microSD card. Current version as of this writing is Buster, based on Debian 11. For storage, I have two Seagate 4TB hard drives, mounted inside a SYBA 4-bay Enclosure. Note that this enclosure does not support RAID, which is fine for what I need. It connects to the Raspberry Pi with a USB 3.0 cable.

Once the Pi was started up and did its setup, I put it on our wireless network so I could access it via SSH. I connected the drives to the Pi and used fdisk -l to make sure both drives were visible. I had /dev/sda and sdb; easy enough to remember.

Next, format the drives with parted. I had to look this part up:

sudo parted /dev/sda

mklabel gpt

mkpart

<name of the volume> in my case I used DuckNASt01

ext4

Beginning 0%

End 100%

Then use quit to get out of it. Repeat for the second drive.

Once that is done, you have to set up the file system with

mkfs.ext4 /dev/sda

mkfs.ext4 /dev/sdb

Finally give it a name:

e2label /dev/sda <name>

Repeat for sdb. Again, I used DuckNASt01 and 02.

I meant it as a play on DuckNest, but now that I type this I realize it sounds like “duck nasty.” Not at all what I intended...

I rebooted the Pi, when it came back up it recognized the two new drives. Then I installed SAMBA to make sure it was shareable with anything - macOS, Windows, iPadOS, or ChromeOS (since we now have devices from all parts of the world in our house.) SAMBA can accommodate multiple users with different permissions, but this is only going to be used by me and Paula, so I didn’t bother with user accounts. I then had to edit the SAMBA config file so it knew what drives to share.

To test it, I went into my MacBook Pro, my iPad Pro, and my Samsung Chromebook and did the appropriate magic to connect to a network share. Worked on al three of them. I did notice that the iPad shows the shares as Read-Only, which might be a limitation of iPadOS, but for what I need that works fine. I’ll probably be doing most of the scanning and ripping from the MBP; the rest of the devices just need to be able to see the stuff.

Glenn Brensinger

Glenn Brensinger