This #MagPiMonday, learn how to make a better NAS with the new features of Raspberry Pi 5. This tutorial is part of The MagPi’s Raspberry Pi 5 launch special.
In The MagPi 134 we talked to Alasdair Allan, Head of Documentation, who mentioned he was excited for the prospect of low-power NAS boxes that made use of the M.2 HAT coming to Raspberry Pi 5 in the future. Here are the basics of setting one up.
01. Software setup
You need to install Samba onto Raspberry Pi OS, usually done with:
sudo apt install samba samba-common-bin
We like to use NTFS for the shared drive so that other operating systems can use it easily, so we install that with:
sudo apt install ntfs-3g
02. Storage setup
Usually we use an external hard drive, but using the SSD drive will be very similar – plug it in, make sure it’s formatted, and then mount it to Raspberry Pi OS. It will do this automagically when you plug it in once booted, but to automount it on boot (there is a difference) you’ll need to edit the fstab file with sudo nano /etc/fstab
and add a line like:
/dev/sdb1 /mnt/location ntfs nls-utf8,umask-
0222,uid-1000,gid-1000,rw 0 0
03. Configuration
The magic of the NAS box is in the Samba configuration file – it’s like writing a spell to open up the shared storage to the network. Here’s one example, and there’s another in the screenshot above, but tweak it to your own needs:
[share]
Comment = Network share
Path = /mnt/location
Browseable = yes
Writeable = yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes