Last updated on June 2, 2020 by Dan Nanni
tar
archive, but the tar
command fails with "error: file changed as we read it". Why am I getting this error, and how can I fix it?A possible cause for this error is that the tar
archive file being generated is also part of files being archived by tar
command itself.
For example, consider the following example.
$ tar cvf backup.tar .
In this case, you are trying to archive into backup.tar
which is obviously part of. tar
command interprets that backup.tar
is also one of input files, but is being changed during archiving, so throwing the error.
To fix the error, make sure that the output tar
file does not belong to the file(s) being archived.
Another solution is to use --ignore-failed-read
option with tar
command, which allows tar
command to ignore and continue on unreadable files. This may help with getting around the issue.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean