continue extracting a tarball after job is killed

3

1

I am extracting a big tarball, but the job was killed in the midway. Is it possible to continue extraction without rolling back from the beginning? The command I was using was

tar xvf foo.tar.gz

fanchyna

Posted 2015-05-15T21:10:25.863

Reputation: 141

Answers

3

Short answer: --skip-old-files

Longer answer: tar --skip-old-files -xvf aoeu.tar will make tar silently ignore any files that has a corresponding output file. It is also possible to use the -k flag, but this will result in tar throwing an error and cowardly refuse to do anything further. However, I am not sure how a partially extracted file will be treated, so you may have to identify those manually and do those individually (if tar was aborted mid-operation, there should be only one not matching in size and content).

Jarmund

Posted 2015-05-15T21:10:25.863

Reputation: 5 155

1He could do a --diff or --compare afterwards to check for any corrupted files. – paradroid – 2015-05-15T21:23:07.287

This does not seem to work. After adding this option, it gives me an error message of "tar: --keep-old-files: Cannot open: No such file or directory. tar: Error is not recoverable: exiting now. Could it be because of a bug of tar? They seem to have a patch, but it is not pushed to the official release yet? (see http://unix.stackexchange.com/questions/198588/use-tar-to-extract-and-immediately-compress-files-from-tarball)

– fanchyna – 2015-05-17T20:19:10.183