Network-attached storage (NAS) is essentially a shared drive accessible over your local network—the perfect home alternative to cloud storage for files too large for your devices or for seamless multi-device sharing. With a Raspberry Pi, you can create an affordable, efficient NAS without buying expensive hardware.
While options like OpenMediaVault (OMV) offer advanced features such as remote access, Samba stands out for its simplicity. It runs directly on your existing Raspbian OS, leaving your Pi free for other tasks. I've set this up on multiple Raspberry Pi models, including the Pi 4, and it's reliable for everyday use. OMV is worth exploring if NAS is your Pi's sole purpose.
I've used a Raspberry Pi 4 with 4GB RAM successfully, but Pi 2 and 3 owners report great results too. A high-capacity microSD works for light use, but an external drive unlocks serious storage—even RAID setups with two drives for redundancy (we'll keep it basic here).
Start with a full system update:
sudo apt update && sudo apt -y upgrade
Open a terminal on the Pi or via SSH.
Connect your USB drive. Format if needed (use GParted for GUI or terminal tools). Create a mount point:

mkdir /home/pi/FOLDERNAME
Name it anything, like "raspshare".
Simply create a folder as above.
Samba enables file sharing across Windows, Linux, and more. Install it with:
sudo apt install samba samba-common-bin

Edit the config file:
sudo nano /etc/samba/smb.conf
Add this at the end (adjust path):
[sambadrive] path = /media/pi/pisharedrive writeable = Yes read only = no create mask = 0777 directory mask = 0777 public = no
[sambadrive] is your share name (used in access path). For SD folder, use /home/pi/raspshare. Set public=yes for open access or no for password protection. You can share multiple folders.

Save (Ctrl+O, Enter) and exit (Ctrl+X).
Add credentials for the default 'pi' user:
sudo smbpasswd -a pi

Restart Samba:
sudo systemctl restart smbd
1. Open File Explorer.

2. Click "Map network drive" (may vary by location).
3. Enter \RASPBERRYPI\sambadrive (or Pi's IP).

4. Check "Connect using different credentials".
5. Finish and log in with pi credentials.

Your NAS is ready!
If write access fails, fix ownership:
sudo chown -R pi /home/pi/raspsharey
Avoid editing /etc/fstab unless necessary—it risks boot issues. This setup takes under 30 minutes, giving you always-on NAS when your Pi runs.
Image credits: Raspberry Pi 4 Model B
Read more: