Build your own NAS server using a Raspberry Pi Zero 2W using samba. Step-by-step tutorial for biginers.
I will use samba for creating our NAS storage server.
- Connect your raspberry pi zero 2w using the
sshcommand,ssh username@<rpi IP>. - Connect an external storage device to the rpi and unmount it using
sudo umount <path to the device>if it's auto mounted. - Create a new directory and name it
storagein the/mntdirectory,sudo mkdir /mnt/storage - Now mount the device to the directory we created above,
sudo mount /dev/sdb1 /mnt/storage. (The device path can be different for you)
- Get the
UUIDof the storage device by using the command:sudo blkid /dev/sda1. (change the path for your device). - Add this line,
UUID=your_uuid /mnt/storage ext4 defaults,nofail 0 2, to thesudo nano /etc/fstabfile. - This will ensure the storage is auto mounted and set-up after device reboots.
- Install
sambafrom the bash shell,sudo apt update && sudo apt install samba samba-common-bin -y
- Before editing the
smb.conffile create a backup for the original file:sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak. - Copy and paste the
smb.conffile in this repository. (replace the in the valid users line in the file) - Create a new user for SMB or use any existing user to set the password for the smb service and add it in valid users in the smb.conf file.
- Set the passowrd for the smb service using:
sudo smbpasswd -a <username>. - Change the ownership:
sudo chown -R 777 username:username /mnt/storage - Restart the services:
sudo systemctl restart smbd nmbd
- Press
Win+Rand type\\<IPofRPI>\storage. Press enter. (Example:\\192.168.172.180\storage). - It will ask for the username and password for the SMB service.
- You can also access the storage from a browser, type the
\\<IPofRPI>\storagein the address field.
- Click Storage Server to view a step-by-step tutorial for this project.
- For any issues check out the
Troubleshoot.txtfile in this repository. - For other issues you can open up new Issue in this repository.