Raspberry Pi - File Server (NAS)

This is to set up a simple NAS to store backups and some files using some parts lying around.  I can't really call this "NAS" though -- It's just a RPi + External USB HDDs, running Samba.

Materials


  • RPi Zero W
  • Powered USB Hub, https://www.amazon.com/gp/product/B005P2BY5I/
  • 1TB 2.5" HDD x 2
  • 2.5" USB HDD enclosure x 2

Note

  • Tried RPi Zero + USB Wifi dongle.  Not enough power.  Replaced with Zero W.
  • RPi will be powered from the USB Hub.
I found this combination is the most cost effective.  Powered HDD enclosure is more expensive.

Setup

  1. Download and install Raspbian stretch lite, https://www.raspberrypi.org/downloads/raspbian/ on microSD, and go through the usual setup process running 'raspi-cnofig'
    • ! WARNING ! don't change the password until localization and keyboard are all set.  Otherwise your password may not work after changing localization/keyboard if any non-alphanumeric character is used.
    • Configure to use SSHD, disable all unused s/w and interfaces. (e.g. VNC, 1-wire, camera, etc)
  2. Install samba, and configure this file as needed: /etc/samba/smbd.conf
    • Optional: installed tree, screen, lighthttpd

Note on Samba

  • Samba 4 will be installed.  Samba4 does not have any GUI (e.g. SWAT) to help to configure.  There is no alternatives either.

Some Note to Self

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install samba samba-common-bin tree screen lighttpd

vi /etc/samba/smbd.conf
sudo smbpasswd -a pi
sudo smbpasswd -a kimworks

* fstab entries for USB HDD:

LABEL=NAS1   /mnt/nas1   auto   nofail,user,noatime   0   0
LABEL=NAS2   /mnt/nas2   auto   nofail,user,noatime   0   0

* /etc/samba/smbd.conf -- added lines:

[share]
Comment = public share
Path = /mnt/nas1/share
Browseable = yes
Writeable = yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes

[NAS2]
path = /mnt/nas2
read only = no
writeable = yes
browseable = yes
valid users = kimworks
create mask = 0640
directory mask = 0750



No comments:

Powered by Blogger.