Thank you for answering. > And that's not. You use old snapshot file here (testbk) and that > instructs tar to archive only those files that have changed since this > file was created. For example, if nothing has changed, the test01.tar > will be effectively empty (it will contain only the directory structure, > not files). This is hardly what you need. Sorry I didn't make it clear that test0.tar is the first full dump. So test01.tar shouldn't be empty. I want it to be the new full dump in place of test0.tar.
> When listing or extracting, snapshot file is not used, but it is > required syntactically (because the -g option requires an argument). I don't think so. It's because snapshot file is provided that tar will delete files that should be deleted correctly, instead of extracting every file directly. 2012/5/26 Sergey Poznyakoff <[email protected]>: > CUI Hao <[email protected]> ha escrit: > >> As time goes by, a lot of archives is made. I want to merge some old >> backups to one archive. >> I simply tried to restore old ones and re-archive them: >> tar -g testbk -xvpf test0.tar test >> tar -g testbk -xvpf test1.tar test > > Yes, that's right. > >> tar -g testbk -cvpf test01.tar test > > And that's not. You use old snapshot file here (testbk) and that > instructs tar to archive only those files that have changed since this > file was created. For example, if nothing has changed, the test01.tar > will be effectively empty (it will contain only the directory structure, > not files). This is hardly what you need. > > To create a full backup you should start with a clean snapshot file, i.e.: > > > testbk > tar -g testbk -cvpf test01.tar test > > If you use tar version 1.23 or later, you can use the --level=0 option > for that, e.g.: > > tar -g testbk --level=0 -cvpf test01.tar test > > It will clear the contents of testbk prior to archiving, just as the > shell command "> testbk" does. > >> As I am not sure about the content of data file (testbk in above >> example), > > A snapshot file preserves the state of the file system at the moment when > the archive was created. In general, wherever you start a full dump you > should clear it, using one of the methods above. In contrast, if you do > an incremental dump, use the snapshot file created previously. > > When listing or extracting, snapshot file is not used, but it is > required syntactically (because the -g option requires an argument). It > is a common practice to use /dev/null in these cases, e.g.: > > tar -g /dev/null -xvpf test0.tar test > > Regards, > Sergey >
