1

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
2

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.

  • As the question is for incremental backup with tar, consider adding "-g /dev/null -C destination" to the above command and I will accept it since no other better solution was provided for more than a year. – Jannes Botis Jan 30 '18 at 15:06
  • @JannesBotis done – robbat2 Jan 30 '18 at 18:59
  • 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.