jLuger.de - FreeBSDBackup Update 2017

In 2012 and 2014 I've blogged about my FreeBSD based backup system. Lucky me didn't need it until now. But this month I've got a new computer and took this as a chance of testing the full  restoring of all data. I've learned two lessons I've want to share here.

1) rsync doesn't like --delete and --exclude together.  In fact if used both it won't delete old files. Thus after restoring all my data I had a lot of already delete files making the backup somehow unusable to work right with it (but still better than having no data at all).

In order to get around this bug I had to call rsync for all the wanted directories. So instead of one rsync call I had to do 13. Putting 13 calls in a script is easy but entering 13 passwords is awful. After some searching I've found that you can use the environment variable RSYNC_PASSWORD and read the password via read. This is the resulting script:

#!/bin/bash
stty -echo
read -p "Password: " passw; echo
stty echo

export RSYNC_PASSWORD=$passw
cd /home/user/data
backup_dir() {
        dir=$1
        echo $dir
        rsync -ax --delete $dir/ user@10.1.1.X::archive/working_backup/machine/$dir
}
backup_dir dir1
backup_dir dir2


2) The splitting of the pool into subdirectories isn't necessary. You can clone a snapshot. The clone is direct accessible and costs no additional disc space. I've read that you can access snapshots via /mnt/zfs/.zfs but I couldn't find ith on my FreeBSD machine but I can confirm the clone method.