我正在寻找具有增量备份的备份实用程序,但方式更复杂。
我试过 rsync,但它似乎无法做我想做的事,或者更有可能的是,我不知道如何让它做到这一点。
所以这是我想用它实现的一个例子。我有以下文件:
testdir
??? picture1
??? randomfile1
??? randomfile2
??? textfile1
Run Code Online (Sandbox Code Playgroud)
我想运行备份实用程序并基本上在不同目录中创建所有这些文件的存档(或 tarball):
$ mystery-command testdir/ testbak
testbak
??? 2020-02-16--05-10-45--testdir.tar
Run Code Online (Sandbox Code Playgroud)
现在,假设第二天,我添加了一个文件,使我的结构如下所示:
testdir
??? picture1
??? randomfile1
??? randomfile2
??? randomfile3
??? textfile1
Run Code Online (Sandbox Code Playgroud)
现在,当我运行神秘命令时,我将获得当天的另一个 tarball:
$ mystery-command testdir/ testbak
testbak
??? 2020-02-16--05-10-45--testdir.tar
??? 2020-02-17--03-24-16--testdir.tar
Run Code Online (Sandbox Code Playgroud)
这里的踢球者:我想备份实用程序检测到的事实是picture1,randomfile1,randomfile2和textfile1上次备份没有改变,和新的/更改的文件只备份,在这种情况下randomfile3,这样的:
tester@raspberrypi:~ $ tar -tf testbak/2020-02-16--05-10-45--testdir.tar
testdir/
testdir/randomfile1
testdir/textfile1
testdir/randomfile2
testdir/picture1
tester@raspberrypi:~ $ tar -tf testbak/2020-02-17--03-24-16--testdir.tar
testdir/randomfile3
Run Code Online (Sandbox Code Playgroud)
所以作为最后一个例子,假设第二天我改变了textfile1,并添加了picture2和picture3:
$ …Run Code Online (Sandbox Code Playgroud)