Uma ideia possível, a partir de Roland (Cybso) Tapken , é usar rsync --fuzzy com diretórios por data
Put the archive in directories named by the date
and called current.tar and parent.tar, where parent.tar is a
hardlink to the previous current.tar. In conjunction with
--hard-links this should work, since the Levenshtein Distance of current.tar and parent.tar is below 25 (actually it is 3). Of
course, source and target filesystems have to support hardlinks, and
you must ensure that parent.tar is transmitted before current.tar.
Eu interpreto isso como (completamente não testado):
cd $backups
dir=$(date +%s)
latest=$(ls | tail -n 1) # N.B. we control names in this directory!
mkdir $dir
ln $latest/01-current.tar $dir/01-parent.tar
$do_backup > $dir/02-current.tar
rsync -arz --fuzzy --hard-links ./ $server/backups/
A linha rsync acima pode ser executada novamente se falhar e deve continuar de onde parou. Eu nomeei os arquivos no diretório diário com prefixos numéricos para encorajar a transferência do arquivo principal primeiro. Eu propositalmente não incluí o --delete , para que os diretórios totalmente transferidos pudessem ser removidos com segurança do cliente e os backups permanecessem no servidor.
Você deve acabar com uma estrutura de diretórios como esta:
$backups
1437502724
02-current.tar-\
1437589112 |
01-parent.tar--/
02-current.tar---\
1437675488 |
01-parent.tar----/
02-current.tar
onde as linhas de conexão indicam links físicos (ou seja, o mesmo inode).