Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Raspberry Pi

Raspberry Pi File Server: Samba NAS for Home Network

Raspberry Pi File Server: Samba NAS for Home Network

March 11, 2026 /Posted byJayesh Jain / 0

A Network Attached Storage (NAS) device lets every computer, phone, and smart TV on your home network access a shared pool of files. Commercial NAS boxes from Synology or QNAP cost ₹15,000–₹60,000. A Raspberry Pi running Samba delivers nearly the same functionality for under ₹5,000—and you keep full control over your data.

This guide walks you through building a complete Raspberry Pi Samba file server from scratch: choosing hardware, configuring Samba shares, setting up user permissions, enabling automatic mounts, and tuning for maximum throughput. By the end, your Pi will appear as a network drive on Windows, macOS, Linux, and Android devices simultaneously.

Table of Contents

  • What You Need
  • Preparing the Raspberry Pi
  • Formatting and Mounting Storage
  • Installing and Configuring Samba
  • Setting Up Shares and Permissions
  • Connecting from Windows, macOS, and Linux
  • Performance Tuning for Faster Transfers
  • Advanced Features
  • Frequently Asked Questions

What You Need

Building a Pi NAS requires surprisingly little hardware:

  • Raspberry Pi 4 or Pi 5: Both have USB 3.0 ports for fast external drive access. The Pi 5 offers ~15% better Samba throughput due to its faster CPU and PCIe-capable USB controller.
  • MicroSD card (32GB+ Class 10): For the OS only—don’t store files here.
  • External USB hard drive or SSD: This is where your NAS data lives. A 2.5″ USB 3.0 SSD is ideal for speed; a USB HDD is fine for bulk storage.
  • Ethernet cable: Essential for NAS use—Wi-Fi caps at ~40MB/s even on a good day; gigabit Ethernet delivers 100+MB/s.
  • Official power supply: The Pi 5 requires the 27W USB-C PSU; the Pi 4 needs the 15W USB-C supply. Inadequate power causes random disconnects and data corruption.
Recommended: Raspberry Pi 5 Model 4GB RAM — Best balance of price and NAS performance. The Pi 5 achieves 110–115 MB/s Samba read speeds on gigabit Ethernet, making it genuinely comparable to entry-level NAS appliances.

Preparing the Raspberry Pi

Step 1: Flash the OS

Download and install Raspberry Pi Imager on your computer. Flash Raspberry Pi OS Lite (64-bit) to your microSD card. The Lite (headless) version is ideal for a server—no desktop environment means more RAM and CPU available for file serving.

Before writing, click the gear icon in Raspberry Pi Imager to:

  • Set hostname (e.g., pi-nas)
  • Enable SSH
  • Set username and password
  • Configure your Wi-Fi (for initial setup—switch to Ethernet for production use)

Step 2: Initial Configuration

Boot the Pi, find its IP address from your router’s DHCP table, and SSH in:

ssh [email protected]

Update the system first—always:

sudo apt update && sudo apt upgrade -y

Step 3: Assign a Static IP

A NAS must always be at the same IP. The easiest method is a DHCP reservation in your router—reserve an IP for the Pi’s MAC address. Alternatively, configure a static IP in /etc/dhcpcd.conf:

interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
Recommended: Raspberry Pi 5 Model 8GB RAM — If you plan to run additional services alongside the NAS (Plex, Pi-hole, Home Assistant), 8GB ensures everything runs smoothly without memory pressure.

Formatting and Mounting Storage

Step 1: Identify Your Drive

Connect your USB drive and run:

lsblk

Your drive will appear as sda (or sdb if another drive is connected). The partition will be sda1.

Step 2: Format the Drive

For maximum Linux performance, format as ext4. For compatibility with Windows (if you may connect the drive directly to a PC), use exFAT:

# For ext4 (recommended for NAS use)
sudo mkfs.ext4 /dev/sda1

# For exFAT (cross-platform compatibility)
sudo apt install exfatprogs
sudo mkfs.exfat /dev/sda1

Step 3: Create Mount Point and Mount the Drive

sudo mkdir -p /mnt/nasdata
sudo chown -R pi:pi /mnt/nasdata

For automatic mounting at boot, find the drive’s UUID:

sudo blkid /dev/sda1

Add to /etc/fstab:

UUID=your-uuid-here  /mnt/nasdata  ext4  defaults,noatime  0  2

The noatime option skips updating access timestamps—a significant performance improvement for a busy NAS.

Mount it now without rebooting:

sudo mount -a

Installing and Configuring Samba

Step 1: Install Samba

sudo apt install samba samba-common-bin -y

Step 2: Back Up the Default Config

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

Step 3: Configure smb.conf

Edit the Samba configuration file:

sudo nano /etc/samba/smb.conf

Replace the [global] section with:

[global]
workgroup = WORKGROUP
server string = Pi NAS
netbios name = pi-nas
security = user
map to guest = bad user
dns proxy = no

# Performance
read raw = yes
write raw = yes
max xmit = 65535
dead time = 15
getwd cache = yes
so options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=131072 SO_SNDBUF=131072

Setting Up Shares and Permissions

Public Share (No Password)

Add to the bottom of smb.conf:

[Public]
path = /mnt/nasdata/public
browseable = yes
read only = no
force create mode = 0666
force directory mode = 0777
guest ok = yes

Create the directory:

sudo mkdir -p /mnt/nasdata/public
sudo chmod 0777 /mnt/nasdata/public

Private Share (Password Protected)

Add to smb.conf:

[Private]
path = /mnt/nasdata/private
browseable = yes
read only = no
create mask = 0644
directory mask = 0755
valid users = pi nasuser

Create the Samba user and set a password:

sudo useradd -M -s /sbin/nologin nasuser  # New user without login shell
sudo smbpasswd -a pi        # Add existing pi user to Samba
sudo smbpasswd -a nasuser   # Add nasuser to Samba

Apply Configuration

sudo testparm  # Verify config syntax
sudo systemctl restart smbd
sudo systemctl enable smbd

Connecting from Windows, macOS, and Linux

Windows

Open File Explorer and type \pi-nas or \192.168.1.100 in the address bar. You’ll see the shared folders. Right-click a share and select “Map network drive” to assign it a drive letter (e.g., Z:) that appears every time Windows starts.

macOS

In Finder, press Cmd+K and enter smb://pi-nas or smb://192.168.1.100. Select the share and authenticate. To auto-mount at login: System Preferences → Users & Groups → Login Items → add the network share.

Linux

Install the SMB client tools and mount manually:

sudo apt install cifs-utils
sudo mkdir /mnt/pi-nas
sudo mount -t cifs //192.168.1.100/Private /mnt/pi-nas -o username=pi,password=yourpassword,uid=1000,gid=1000

Android/iOS

Use a file manager app with SMB support. On Android, Solid Explorer or MiXplorer work excellently. On iOS, the built-in Files app supports SMB—tap the three dots in Files → Connect to Server → enter smb://192.168.1.100.

Recommended: Raspberry Pi 5 Model 16GB RAM — For enterprise-style NAS deployments with Samba AD DC (Active Directory Domain Controller), 16GB RAM ensures smooth operation when serving dozens of clients simultaneously.

Performance Tuning for Faster Transfers

Out of the box, Samba on a Pi 4/5 over gigabit Ethernet achieves 40–60 MB/s. With tuning, you can push this to 100–115 MB/s.

Samba Tuning Parameters

Add these to the [global] section of smb.conf:

min receivefile size = 16384
use sendfile = true
aio read size = 16384
aio write size = 16384
async smb echo handler = yes

SMB Protocol Version

Force SMB3 for maximum performance—SMB1 and SMB2 are slower and have security issues:

min protocol = SMB3
max protocol = SMB3

Linux Kernel Buffer Tuning

Add to /etc/sysctl.conf:

net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

Apply: sudo sysctl -p

Use a USB SSD Instead of HDD

The single biggest performance improvement is switching from a spinning HDD to a USB 3.0 SSD. A typical USB HDD saturates at 50–80 MB/s sequential reads. A USB SSD easily exceeds 300–400 MB/s, making it impossible for the Pi’s gigabit Ethernet (which caps at ~115 MB/s) to be the bottleneck from the storage side.

Advanced Features

Automatic Backup with Rsync

Set up automated backups from your PC to the NAS using rsync over SSH:

rsync -avz --delete /home/user/Documents/ [email protected]:/mnt/nasdata/backups/documents/

Add to cron for nightly backups at 2AM:

0 2 * * * rsync -az /home/user/Documents/ [email protected]:/mnt/nasdata/backups/documents/

Add Plex Media Server

Your Pi NAS can double as a Plex Media Server. Install Plex and point its library to your NAS drive. The Pi 5 handles direct-play transcoding for 1080p content; 4K transcoding may require a more powerful host. With direct play (no transcoding), the Pi 5 serves 4K content without issue.

Monitor Disk Health with SMART

sudo apt install smartmontools
sudo smartctl -a /dev/sda

Set up weekly SMART tests in cron to catch drive failures before they cause data loss.

Enable Recycle Bin

Add this to each Samba share to enable a network recycle bin (deleted files go here instead of being immediately removed):

vfs objects = recycle
recycle:repository = .recycle
recycle:keeptree = yes
recycle:versions = yes

Frequently Asked Questions

How much storage can I attach to a Raspberry Pi NAS?

Theoretically unlimited via a powered USB hub. You can connect multiple USB drives and create separate shares for each, or use them in combination with LVM (Logical Volume Manager) to create a single large logical volume spanning multiple physical drives. A Pi 5 can handle 4+ USB drives simultaneously through a powered hub.

Is a Raspberry Pi NAS reliable enough for important data?

The Pi itself is very reliable—SBCs have no moving parts. The microSD card for the OS is the weakest link. Use a quality card and consider booting from USB SSD instead. Always maintain a backup of important data on a separate drive. The NAS drive itself (external USB) is as reliable as any external hard drive.

What transfer speeds can I expect?

Over gigabit Ethernet with a USB 3.0 SSD: 100–115 MB/s read, 80–100 MB/s write. With a USB HDD: 50–80 MB/s. Over Wi-Fi 5 (802.11ac): 30–50 MB/s. Over Wi-Fi 6: 50–70 MB/s. Wired Ethernet always wins for NAS use.

Can I access my Pi NAS remotely (outside home)?

Yes, via SSH tunneling, WireGuard VPN, or Tailscale (the easiest option). Install Tailscale on both the Pi and your laptop, and you’ll access the NAS from anywhere in the world as if you were on your home network. Avoid exposing Samba directly to the internet—it has a long history of vulnerabilities.

Can I run other services alongside Samba on the same Pi?

Absolutely. A Pi 4 or Pi 5 easily runs Samba alongside Pi-hole (DNS ad blocker), Nextcloud, Home Assistant, or a media server. Samba itself uses very little CPU in steady state—only during file transfers does it spike. A Pi 5 with 4GB or 8GB RAM comfortably handles all of these simultaneously.

Build Your Home NAS Today

A Raspberry Pi Samba file server is one of the most practical Pi projects you can build. Once set up, it runs silently 24/7 with negligible power consumption (Pi 5 draws ~3–5W idle), appears seamlessly on every device in your home, and gives you full control over your data without any cloud subscription.

The total project cost—Pi 5 + power supply + USB SSD—is a fraction of commercial NAS devices, and the result is equally capable for home use. With the tuning steps in this guide, you’ll achieve throughputs that rival dedicated NAS hardware.

Get started by picking up a Raspberry Pi board from Zbotic.in. We stock Pi 5 in 2GB, 4GB, and 16GB variants with fast delivery across India.

Tags: file server, home network, linux, NAS, network attached storage, Raspberry Pi, raspberry pi 5, Samba
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Custom Arduino PCB: Design You...
blog custom arduino pcb design your own minimal board 595138
blog raspberry pi syslog server collect and analyze network logs 595148
Raspberry Pi Syslog Server: Co...

Related posts

Svg%3E
Read more

Raspberry Pi Benchmarks: Performance Testing All Models

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi PoE: Power Over Ethernet Setup Guide

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi GSM HAT: SMS and Cellular IoT

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi RS485: Industrial Sensor Network

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi CAN Bus: Vehicle OBD2 Data Reader

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now