Guide · Intermediate · Raspberry Pi
Pi-Based Print File NAS for a Small Workshop
Samba shares, permissions, and backup so G-code never lives only on a laptop.
In this guide
- Goal & materials
- Steps / firmware
- Troubleshooting
- AI assist notes
- Related gear & books
In many small workshops, the only copy of a part's STL, project file, and sliced G-code lives on whichever laptop sliced it. A Raspberry Pi with an attached drive makes a cheap, always-on file share for the whole shop. This guide sets up Samba with sensible permissions and, just as important, a backup so the Pi is not the new single point of failure.
What you need
- A Raspberry Pi 4 or 5 (USB 3 and gigabit Ethernet make a real difference for file serving).
- A USB SSD or hard drive for the share. Avoid storing shared files on the SD card.
- A reliable power supply, and wired Ethernet if possible.
- A second drive or another machine for backups.
Step 1: install the OS and mount the drive
- Install Raspberry Pi OS Lite with Raspberry Pi Imager, enabling SSH and setting a hostname such as
shopfiles. - Update:
sudo apt update && sudo apt full-upgrade. - Find the drive with
lsblk. If it is new, partition and format it as ext4 (this erases it). - Get its UUID with
sudo blkid, create a mount point such as/srv/shop, and add a line to/etc/fstab:
UUID=your-drive-uuid /srv/shop ext4 defaults,nofail 0 2
The nofail option lets the Pi still boot if the drive is missing. Run sudo mount -a and confirm with df -h.
Step 2: users, a group, and folder permissions
Create a group for everyone who uses the share and a Linux account for each person:
sudo groupadd makers
sudo adduser --no-create-home --disabled-login alex
sudo usermod -aG makers alex
sudo mkdir -p /srv/shop/prints
sudo chown -R root:makers /srv/shop/prints
sudo chmod -R 2775 /srv/shop/prints
The leading 2 in 2775 sets the setgid bit on the folder, so new files and folders inherit the makers group. That prevents the common problem where one person's files cannot be edited by anyone else.
Step 3: install and configure Samba
sudo apt install samba
sudo smbpasswd -a alex
Add a share at the end of /etc/samba/smb.conf:
path = /srv/shop/prints
valid users = @makers
read only = no
force group = makers
create mask = 0664
directory mask = 2775
Check the file with testparm, then restart with sudo systemctl restart smbd. Connect from Windows with \\shopfiles\prints, from macOS with smb://shopfiles/prints, and from Linux through your file manager or a CIFS mount.
Step 4: organize so files stay findable
A simple, consistent structure saves more time than any software:
prints/
customer-or-project/
part-name/
cad/ source files (STEP, SCAD, F3D exports)
stl/ exported meshes
gcode/ sliced files, named with printer and material
notes.txt settings that worked, failures, revision history
Put the printer, material, and version in G-code filenames, such as bracket_v3_mk4_petg.gcode, so nobody prints the wrong file on the wrong machine.
Step 5: back it up
A file server is not a backup. The drive can fail, someone can delete a folder, or a power event can corrupt it. Follow the familiar 3-2-1 idea: three copies, on two different devices, with one off-site.
- Local copy: a nightly
rsync -ato a second drive or another machine, scheduled with cron or a systemd timer. - Versioned copy: tools such as restic or BorgBackup keep snapshots, so you can recover yesterday's version of a file someone overwrote today.
- Off-site copy: push encrypted backups to cloud storage or a drive kept somewhere else.
- Test restores. Restore a folder now and then. A backup you have never restored is a guess.
Security basics
- Keep Samba on the local network. Never forward SMB ports to the internet; use a VPN for remote access.
- Give each person their own account so you can remove access cleanly.
- Keep the Pi updated with regular
aptupgrades. - Modern Samba versions disable the old SMB1 protocol by default. Leave it off.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Share not visible in network browsing | Discovery differences between operating systems | Connect directly by name or IP address |
| Access denied | No Samba password set, or user not in group | Run smbpasswd -a; check groups username |
| Can read but not edit others' files | Missing setgid or masks | Reapply chmod 2775 and the masks in smb.conf |
| Share empty after reboot | Drive did not mount | Check /etc/fstab UUID and dmesg |
| Slow transfers | Wi-Fi, USB 2 port, or SD card storage | Use Ethernet, a USB 3 port, and the external drive |
Summary
A Pi with a USB drive, a shared group with setgid folders, and a short Samba share gives a small shop one place for CAD, STL, and G-code. Pair it with nightly versioned backups and an off-site copy, keep it off the internet, and the files will outlive any one laptop.
Related
- Projects hub
- Newsletter
- Books for deeper reading