Backup with rsync documentation
Backup_Restore_Procudure_with_rsync
May 21, 2020 12:48 PM
----putty into FreeNAS - 192.168.2.2 first----
1. Backup FreeNas offsite to Mark's server
root@[~]#rsync -av --no-perms -e ssh /mnt/tank/Folder1 root@YourPublicIPAddress:/mnt/tank/CompanyName/
root@[~]#rsync -av --no-perms -e ssh /mnt/tank/Folder2 root@YourPublicIPAddress:/mnt/tank/CompanyName/
root@[~]#rsync -av --no-perms -e ssh /mnt/tank/Folder3 root@YourPublicIPAddress:/mnt/tank/CompanyName/
root@[~]#rsync -av --no-perms -e ssh /mnt/tank/Folder4 root@YourPublicIPAddress:/mnt/tank/CompanyName/
root@[~]#rsync -av --no-perms -e ssh /mnt/tank/Folder5 root@YourPublicIPAddress:/mnt/tank/CompanyName/
NOTE:
-e ssh = specifies the shell that should be used at the destination machine (secureShell) --no-perms = don't copy permissions to destination but apply destination -default permissions instead (so you can manipulate/access your folders at the destination. Keep in mind that at destination y ou'll have different users being not the same as at the source)
NOTE:
for debugging purposes, log results of your rsync command by useing --log-file=$HOME/.rsyncd.log
#rsync -av --no-perms --log-file=$HOME/.rsync_Folder1.log -e ssh /mnt/tank/Folder1/ rsync-backup@192.168.2.3:/volume1/NetBackup/freenas/Folder1
#rsync -av --no-perms --log-file=$HOME/.rsync_Folder2.log -e ssh /mnt/tank/Folder2/ rsync-backup@192.168.2.3:/volume1/NetBackup/freenas/Folder2
#rsync -av --no-perms --log-file=$HOME/.rsync_Folder3.log -e ssh /mnt/tank/Folder3/ rsync-backup@192.168.2.3:/volume1/NetBackup/freenas/Folder3
#rsync -av --no-perms --log-file=$HOME/.rsync_Folder4.log -e ssh /mnt/tank/Folder4/ rsync-backup@192.168.2.3:/volume1/NetBackup/freenas/Folder4/
#rsync -av --no-perms --log-file=$HOME/.rsync_Folder5.log -e ssh /mnt/tank/Folder5/ rsync-backup@192.168.2.3:/volume1/NetBackup/freenas/Folder5/
====================================================================================================
2.Restore of FreeNAS file share from snapshots
#ls -alh /mnt/tank/Folder3/.zfs/snapshot/auto-20190816.1000-2w/ = list all files in the last snapshot (note that .zfs is hidden) #cd /mnt/tank/Folder3/.zfs/snapshot/folderNamePath
#ls -alh = list all files inside of that specific snapshot
Proceed with the restore/copy of only the files you need to restore or with a full restore
#rm -R /mnt/tank/Folder3/*.*
#cp-rp /mnt/tank/Folder3/.zfs/snapshot/auto-20190616.1000-2w/*.*/mnt/tank/Folder3/
FreeNAS backup documentation
PART 1 – backup of company network files over rsync from FreeNAS over to Synology
SSH user “rsync” from FreeNAS was used to schedule cron jobs on web interface. “rsync” user has the write permissions to Synology server.
Cron job template:
rsync -av --no-perms -e ssh /mnt/tank/Folder3/ rsync-backup@ 192.168.2.3:/volume1/NetBackup/freenas/Folder3/
PART 2 – local FreeNAS backup is done every 2h and retention policy is of 2weeks
This type of backup was setup on FreeNAS GUI management interface for every company network folder. It is set to run every 2h, 6:00 to 18:00 and rotate backups every 2 weeks.
Restore procedure of FreeNAS file share from local snapshots:
#ls -alh /mnt/tank/Folder3/.zfs/snapshot/auto-20190816.1000-2w/ = list all files in the last snapshot (note that .zfs is hidden)
#rm -R /mnt/tank/Folder3/*.*
#cp -rp /mnt/tank/Folder3/.zfs/snapshot/auto-20190616.1000-2w/*.* /mnt/tank/Folder3/