My main data store is a pretty old NAS, a Zyxel NSA320, with 2Tb in RAID 1.
I use that NAS for archived jobs, pictures, documentations, downloads, and things that I not often use.
This NAS can install packages from a zyxel offical repository.
A few usufull packages I suggest are:
- NFS: install NFS server features
- TFTP: add a TFTP server
- SMART: Use S.M.A.R.T. (Self Monitoring, Analysis, and Reporting Technology) to monitor hard disks.
Once the repository was installed, I've just added a few packages:
- Dropbear: now I can access the SSH without using any trick, I'm talking about this one http://zyxel.nas-central.org/wiki/Telnet_backdoor
- RandomTools: some random tools like unrar, nano and so on
- Tweaks: usefull tweaks like the crontab, a shutdown daemon and so on
- Entware-ng: the Entware-ng package system, then I've installed
- openssh-client
- openssh-server
- rsync
I use my developement PC as a data store for jobs not archived and that I often use.
My main backup store it is build around two NetGear Stora NAS I've laying around.
The main changes I've made are:
- NFS server mod, to run a NFS server on this NAS, this mod is fully described here http://www.openstora.com/wiki/index.php?title=Kernel_mode_NFS
- Two drive mounted separately, in this way I can use all the space on the two drives mounted. This is described here: http://www.openstora.com/forum/viewtopic.php?f=1&t=399
That two store are in my garage. One thing i like from the Stora is that is spin down disk, so power consumption is being reduced.
In a previous post I've talk about my hypervisor and hosts backup, you can find it here: http://davidegironi.blogspot.com/2017/06/vsphere-esxi-backup-strategies-for.html.
The Zyxel NSA320 backup consists of a bash script that uses rsync to mirror the entirire NAS volume over a NFS folder.
In order to make this backup works you have to make a NFS share on a remote device.
Create a share for administrators, this one is optional, you can even put this in your admin share, for now let's suppose the administrators path to be /i-data/______/administrators.
Create a backup folder for data and bin on your Zyxel
In order to make this backup works you have to make a NFS share on a remote device.
Create a share for administrators, this one is optional, you can even put this in your admin share, for now let's suppose the administrators path to be /i-data/______/administrators.
Create a backup folder for data and bin on your Zyxel
$mkdir /i-data/______/administrators/backups/bin
$mkdir /i-data/______/administrators/backups/data
Copy the backup.sh script to the backups/bin folder.
Make the script executable for all users
$chmod a+x /i-data/______/administrators/backups/bin/backups.sh
Edit the script preferences according to your enviroment, you can as example use vi
$vi /i-data/______/administrators/backups/bin/backups.sh
Add the script to crontab, you can access the crontab by the Tweaks package. As example, if you would like to run the script at 2 o'clock at day 5 of week, and have the backup status returned to a txt file, just add the line below to your crontab
0 2 * * 5 /i-data/______/administrators/backups/bin/backup.sh > /i-data/______/administrators/backups/bin/lastbackupstatus.txt 2>&1
Find the backup script below:
Find the backup script below:
#!/bin/sh #preferences LOCALSOURCE=/i-data/_______/ LOCALDESTINATION=/i-data/_______/administrators/backups/data NFSMOUNTHOST=backupnas NFSMOUNTPOINT=/home/_______/backups/NAS320 echo "Running backup" echo "" #unmount umount $LOCALDESTINATION #mount mount.nfs $NFSMOUNTHOST:$NFSMOUNTPOINT $LOCALDESTINATION -v -o nolock #check if is mount if [[ $(nfsstat -m | grep -A 1 $NFSMOUNTPOINT | head -c1 | wc -c) -ne 0 ]]; then echo "NFS folder $NFSMOUNTHOST:$NFSMOUNTPOINT mounted on $LOCALDESTINATION" echo "" rsync -rltxuv --delete $LOCALSOURCE $LOCALDESTINATION else echo "Error: can not mount NFS folder $NFSMOUNTHOST:$NFSMOUNTPOINT to $LOCALDESTINATION" fi #umount umount $LOCALDESTINATION
Note that this script mount the NFS location instead of using rsync over NFS or rsync over ssh. That's because I've notice a better trasfer performance working that way, I'm talking of almost 10Mb/s.
On my developement PC I use two software for backup.
- Create Synchronicity: find it here http://synchronicity.sourceforge.net/. To mirror the VMWare machines of my development pc over a shared folder. This can be used to syncronize data that does not need to be incremental.
- Duplicati: find it here: https://www.duplicati.com/. To backup data of my pc over a shared folder. I set up Duplicati with a regex that backups each Project* and Documents* folder, that way all the folder on my main mounted environment that starts with that prefix are been backupped. I can create a new Project tree, like "Projects ESP8266", and that would be added to my backups. Duplicati performs incremental backup, allowing me to reastore data older that 30 days.
That's almost all about my actual datastore and backup environment.
Notes- read risk disclaimer
- excuse my bad english
No comments:
Post a Comment