Back to Home

NanoPC-T4 NAS: Setting up Samba on Debian

The article describes assembling NAS on NanoPC-T4 with Debian 13 and Samba. Step-by-step sharing setup, HDD connection, examples for Windows/Linux. Performance optimization and security.

DIY NAS from NanoPC-T4: Samba and network access
Advertisement 728x90

# Building a Compact NAS on NanoPC-T4 with Armbian and Samba

The NanoPC-T4 with 4 GB LPDDR3, 16 GB eMMC, Gigabit Ethernet, and USB 3.0 lets you set up a NAS without buying new hardware. Use Debian 13 from FriendlyElec, connect an external HDD via USB, and configure Samba for network access. This solution is ideal for mid/senior-level developers familiar with Linux and embedded systems.

Choosing the OS Image and Initial Boot

Armbian images sometimes have issues with Wi-Fi on NanoPC-T4 due to driver problems. Download the official Debian 13 from the FriendlyElec website — boot and network connection work stably. Insert the microSD, connect power, and check interfaces: wlan0 comes up automatically.

After the first boot, update the system:

Google AdInline article slot
sudo apt update && sudo apt upgrade -y

Setting up Samba for File Sharing

Install Samba for SMB/CIFS access:

sudo apt install samba

Create a system user:

sudo adduser test-user
sudo smbpasswd -a test-user

Prepare the directory:

Google AdInline article slot
sudo mkdir /opt/shared_test
sudo chmod 775 /opt/shared_test

Reset the Samba config:

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo vim /etc/samba/smb.conf

Insert the configuration:

[global]
   workgroup = WORKGROUP
   security = USER
   server string = %h server
   bind interfaces only = no
   log file = /var/log/samba/log.%m
   log level = 1
   max log size = 1000
   logging = file
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   usershare allow guests = yes
   map to guest = bad user
   idmap config * : backend = tdb
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
[shared_test]
   comment = Test Folder
   path = /opt/shared_test/
   read only = no
   guest ok = no
   writable = yes
   admin users = test-user

Check syntax:

Google AdInline article slot
sudo testparm

Restart the service:

sudo systemctl daemon-reload
sudo systemctl restart smbd

Connecting to the Share from Clients

Determine the server IP:

ip a

Example: wlan0: inet 192.168.0.185/24.

From Windows

  • Explorer → Right-click "This PC" → "Map network drive".
  • Enter \\192.168.0.185\shared_test.
  • Enter test-user and password.

From Linux (GUI)

  • File manager → "Other Locations".
  • smb://[email protected]/shared_test/.
  • Enter password.

From Linux (CLI)

sudo apt install smbclient
smbclient \\192.168.0.185\shared_test -U test-user

In smb: \> ls will show files. Commands: help for reference.

Expanding the NAS: Storage and Access

Connect HDD to USB 3.0. Automount via /etc/fstab or udev rules. For stability, add a disk check to crontab:

@reboot mount /dev/sda1 /mnt/storage

Set up multiple shares:

  • Media share (/mnt/media): read only = yes for streaming.
  • Backup share (/mnt/backup): writable = yes, quotas via quota.
  • General (/opt/shared): ACL with setfacl for granular access.

Monitoring: smbstatus for active connections, tail -f /var/log/samba/log.* for logs.

Performance Optimization

NanoPC-T4 handles gigabit traffic on Samba. Tweaks:

  • Increase socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072 in [global].
  • Enable aio read size = 1 aio write size = 1 for async I/O.
  • Limit processes: max smbd processes = 100.

For PCIe expansion, add NVMe SSD via adapter — up to 500 MB/s write.

Test throughput: iperf3 for network, dd for disk.

Security and Automation

  • Firewall: ufw allow samba.
  • HTTPS for management: Nginx reverse proxy.
  • Auto-backup configs: rsync /etc/samba /mnt/backup in cron.

Automounting disks at boot:

  • blkid for UUID.
  • Add to /etc/fstab: UUID=xxxx /mnt/storage ext4 defaults 0 2.
  • systemctl daemon-reload.

Key Points

  • SBC as NAS: NanoPC-T4 with Gigabit Ethernet and USB 3.0 provides stable access without a dedicated server.
  • Samba config: Minimal template with user auth and writable shares.
  • Cross-platform: Works from Windows, Linux GUI/CLI.
  • Scalability: Easy to add disks, tweaks for perf.
  • Costs: Free using existing components.

— Editorial Team

Advertisement 728x90

Read Next