WEBTOOLIST.
STATIC WEB PLATFORM
NO ACCOUNTS / NOTHING TO INSTALL

$ webtoolist --read

Raspberry Pi File Server

medium · 2-3 hours

Turn a Raspberry Pi and an external drive into an always-on network file server with Samba shares and automated backups.

difficulty medium time 2-3 hours cost ≈ $70-90 (plus drives you may own)
raspberry-pinassambaself-hostinglinux
Safety notes:
  • Power the drive from a powered USB hub or use a separately powered enclosure — the Pi's ports can only supply about 1.2 A total.
  • Unmount drives before unplugging; pulling power mid-write corrupts filesystems.
  • Shut down with 'sudo poweroff', never by yanking the power cord.

Parts

  • Raspberry Pi 4 or 5 (2 GB+ recommended)
  • Class 10 microSD card, 32 GB
  • External USB drive, 1 TB+ (preferably an SSD or a powered HDD enclosure)
  • 5V USB-C power supply, official Pi unit
  • Ethernet cable (recommended over Wi-Fi for a server)

Tools

  • Computer with an SD card reader
  • Raspberry Pi Imager (free)
  • Second USB drive or NAS space for backups

A Pi file server is the classic first homelab project: cheap parts, an afternoon of work, and a genuinely useful result — shared storage for every device in the house, running on ~4 W.

Steps

  1. Flash the OS. In Raspberry Pi Imager, choose Raspberry Pi OS Lite (64-bit). In the settings, set a hostname (fileserver), enable SSH, and configure your user and password before the first boot.
  2. Boot and connect. Insert the SD card, attach Ethernet and power, then SSH in: ssh user@fileserver.local. Run sudo apt update && sudo apt full-upgrade.
  3. Prepare the drive. Identify it with lsblk (look for the size, e.g. /dev/sda). Partition and format it as ext4: sudo mkfs.ext4 /dev/sda1. Ext4 preserves Linux permissions, which NTFS does not.
  4. Mount it permanently. Find the UUID with sudo blkid, create a mount point (sudo mkdir -p /mnt/storage), then add to /etc/fstab:
    UUID=your-uuid  /mnt/storage  ext4  defaults,nofail  0  2
    The nofail option keeps the Pi bootable if the drive is absent. Run sudo mount -a to test.
  5. Install Samba. sudo apt install samba, then append a share to /etc/samba/smb.conf:
    [storage]
       path = /mnt/storage
       browseable = yes
       writeable = yes
       valid users = pi
    Set the SMB password: sudo smbpasswd -a pi, then restart with sudo systemctl restart smbd.
  6. Connect from your devices. macOS Finder → ⌘K → smb://fileserver/storage. Windows Explorer → \\fileserver\storage. Linux file managers handle smb:// natively.
  7. Add automated backups. Install rsync and add a nightly cron job (crontab -e):
    0 3 * * * rsync -a --delete /mnt/storage/ /mnt/backup/mirror/
    Point it at a second drive — a mirror on the same disk protects against accidental deletion, not disk death.
  8. Harden the basics. Change the default password, install unattended upgrades (sudo apt install unattended-upgrades), and enable fsck scheduling. Check smartctl -a /dev/sda occasionally for drive health.

Troubleshooting

  • Share visible but writes fail → check Linux permissions on the mount (ls -ld /mnt/storage); Samba users need filesystem-level write access, not just writeable = yes.
  • Drive shows up as sdb after a reboot → don’t rely on device names; always mount by UUID in /etc/fstab.
  • fileserver.local not resolving → mDNS can be flaky on some routers; use arp -a or your router’s client list to find the IP and set a DHCP reservation.
  • Random disconnects under load → almost always insufficient USB power. Use a powered hub or a drive with external power.
  • Slow transfers over Wi-Fi → the Pi’s Wi-Fi shares bandwidth with the drive’s USB traffic; switch to Ethernet.