I am trying to restore incremental backups, but to do so I have to extract each archive in a sequence:

tar cvf archive.1.tar -g archive.snar backup

Making changes in backup folder

tar cvf archive.2.tar -g archive.snar backup

Making changes

tar cvf archive.3.tar -g archive.snar backup

When I do

tar --list --incremental --verbose --verbose --file archive.3.tar

I can see the list of files from the current snapshot. but I need to run:

tar xvf archive.1.tar -g /dev/null -C destination
tar xvf archive.2.tar -g /dev/null -C destination
tar xvf archive.3.tar -g /dev/null -C destination

in sequence to get the last backup. Is there a way to do this with one command?

tar {some options} archive.3.tar

cat archive.*tar |tar xvf - -g /dev/null --ignore-zeros -C destination

At the end of tar files, is the 'end-of-archive' marker (2x 512 blocks of zero bytes. Tar will continue to read past the marker in some cases, but will not take any data.

--ignore-zeroes will tell it to keep reading regardless.

Related: Tar supports appending to archives; it does this by seeking to the end, rewinding two blocks, then continuing to write.

| improve this answer | |
  • Please do not use gtar's incrementals. Gtar is able to do incremental backups but it cannot do incremental restores for non-trivial changes between two incrementals. The related bugs have been reported in 2004, 2011, 2016 and 2018 to no avail. – schily Jun 28 '18 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.