It is currently Sun Jan 17, 2021 11:40 am
All times are UTC + 8 hours

ASUSTOR Snapshot (Time Machine) Backup

Share your awesome tips and tricks here.

ASUSTOR Snapshot (Time Machine) Backup

Postby damascene » Sat Apr 30, 2016 12:33 pm

Hi, there are many tools for snapshot backup style. where you can get a backup of every day where only changes take additional space. You will have for example folder 22-APR-2016, 23-APR-2016 and every one of them will have the complete file tree. If a file is changed in 22 April you will find different version in 23 April backup. the 22 April version will be kept.

The Backup Script:
https://github.com/damascene/backup-scr ... -backup.sh (use this link to get the latest version).

I've tested it on ASUSTOR 202-TE, I'm using it with public key authentication to login to a windows machine remotely. My setup on Windows server is: Windows + Cygwin + Openssh + Rsync. If you are interested in Windows backup setup details you can ask me.

Hopefully some day Rsnapshot package will be available. it's more advanced perl script. I've opened a feature request for it here:
Add Rsnapshot package viewtopic.php?f=23&t=7778

The Script: Version: 0.1.3
Code: Select all
#!/bin/sh
#### Based on Rsync Date Stamped, Snapshot Style, Incremental Backups http://webgnuru.com/linux/rsync_incremental.php ########
## This version is modifed to work on BusyBox Sh shell
## Date command is different in BusyBox from the Bash vrsion


# Copyright 2016 Usama Akkad, Released under GNU General Public License v3.

# BusyBox Snapshot Backup Script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

#Software version 0.1.3

#WARNING - TEST BEFORE YOU USE. A MISTAKE IN RSYNC COULD ERASE YOUR FILES. USE WITH CAUTION.
#Website Backup Script

#Todays date in ISO-8601 format:
day0=$(date -I)

#Yesterdays date in ISO-8601 format that works in Bash:
#DAY1=`date -I -d "1 day ago"`

#Yesterdays date in ISO-8601 format that works in BusyBox:
day1=$(date -I -d @$(( $(date +%s) - (24*60*60) )))


#The source directory:
source="/path/to/source/files/"

#The target directory:
target="/path/to/backup/location/$day0"

#The remote server informaions:
remote="test@example.org"

#The link destination directory:
link="/path/to/backup/location/$day1"

#Rsync options:
#OPT="-avh -e ssh --delete --link-dest=$LNK"

#Execute the backup
#Remove --dry-run to activate the command. With --dry-run it will just demonistrate what will happen.
rsync -avh -e ssh --dry-run --delete --link-dest="$link" "$remote:$source" "$target"

##optional delete old files
##29 days ago in ISO-8601 bash format
##
##DAY29=`date -I -d "29 days ago"`
##29 days ago in ISO-8601 busybox sh format
#day29=`date -I -d @$(( $(date +%s) - (29*24*60*60) ))`

#Delete the backup from 29 days ago, if it exists
#if [ -d /path/to/backup/location/$day29 ]
#then
#rm /path/to/backup/location/$day29
#fi


Hope it will be useful to you, test it before running it on your important files. :)
damascene
 
Posts: 4
Joined: Sat Apr 23, 2016 4:02 pm

Return to Tips & Tricks

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 3 guests

cron