Pi NAS

Forums:

Commands for installing a simple NAS server with your RP.
Reference:
https://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-p...

NTFS Support
sudo apt-get install ntfs-3g

View disks
sudo fdisk -l

Create share mount
sudo mkdir /media/USBHDD1
sudo mount -t auto /dev/sda1 /media/USBHDD1

sudo mkdir /media/USBHDD1/shares

Install Samba
sudo apt-get install samba samba-common-bin
Backup samba config
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old

Edit config
sudo nano /etc/samba/smb.conf
Workgroup=workgroupname

Unremark #security=user

Add section to end of file. Change ["backup" ]to whatever you want to name it.
[Backup]
comment = Backup Folder
path = /media/USBHDD1/shares
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

Restart daemon
sudo /etc/init.d/samba restart

Create the access user
sudo useradd svcbackups -m -G users
sudo passwd svcbackups (enter pwd when prompted)

Add backups as a samba user
sudo smbpasswd -a backups

Add to startup
sudo nano /etc/fstab

Add mount
/dev/sda1 /media/USBHDD1 auto noatime 0 0

To add second drive sync
sudo apt-get install rsync

crontab -e

Add line:
0 5 * * * rsync -av --delete /media/USBHDD1/shares /media/USBHDD2/shares/
--Delete will allow removals on the second drive when it is removed from the first drive. This
backups up every day at 5am.

Manually fire off the initial sync
rsync -av --delete /media/USBHDD1/shares /media/USBHDD2/shares/

-6.1193329,39.1580149,05-20-2019 01:44:11 AM,!Stopped for gas