Since I am now running a QEMU based environment where all my operating systems are virtual machines, and all data is contained within QCOW files, I needed a way to back up my data quickly, and efficiently. Also, I did not want to have to back up all my data in full every time, so I learned you can do incremental backup archives with a specific switch.

In this case, the switch is --listed-incremental , followed by the filename where you want to monitor differences of files in one or many directories. Next time you are creating a backup, specify this will and tar will look for modifications of files and folders, and only record those in future backups.

At some point I need to create a script that can restore all or part of the data, or even one specific file from an earlier timestamp.

I run this script every day now so the worst that can happen is, that I lose the state of files for one day.

Below you can see how you can transfer and compress data through SSH. Make sure that your keepalive value is something like 30 seconds, otherwise the connection may close during backup creation.

Also, I mounted the backup drive "Time Machine" via sshfs to the folder described. The reason is that the incremental files I specified won't write through SSH, so I am creating them locally in a hidden home folder named .timemachine . Then, once the backup for a folder is finished, I copy over the delta file to the sshfs mounted folder. This way I can grab those files on another installation, define the files in the listed-incremental switch and restore to where I want. Note that you will need all your backup files for this - you cannot discard earlier backups.

So depending on the amount of data you will need to back up, make sure that you have plenty of space available. For the initial and subsequent delta backups.

Btw: yad only displays an icon in my Xfce system tray. You may delete that line if you want.


DATE=`date +%F`

yad --notification --image=/home/marcus/.timemachine/tm.png &

# Folders to back up
declare -a bck=(

# Create folder

# Backup folders needed in sequence
for i in "${bck[@]}"
tar zpcvf - --listed-incremental=/home/marcus/.timemachine/$i.timemachine /home/marcus/$i | ssh "cat > /home/marcus/TimeMachine/data/$DATE/$i.tgz"
cp /home/marcus/.timemachine/$i.timemachine $TIMEMACHINE/delta/$i.timemachine

killall yad

Back to content