3

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

1 Answer 1

4

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.

1
  • 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, 2018 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .