Follow this Blog!

May 4, 2015

f Comment

Unix tar command error "File changed as we read it"

Amazon I run this Unix command to compress a directory called repository:

sudo tar -zcf repository.tar.gz repository

But I get the following error or warning message:

tar: repository/sphinx-1.10-beta/log/query.log: file changed as we read it

Obviously it means during the compression, the specified file has been changed. Does it mean the command has been aborted? What does it mean as far as the execution of the compression is concerned? Should I rerun the command?

Find out in the following section of this article.

My Unix version: Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic x86_64)


The answer is the compression has been done despite the discrepancies of the files whose content is changed while the compression is happening.

Therefore, you do not need to rerun the command unless you want to capture the latest status of the files. In my situation, the files that were changed during the compression were logs, and I don't care about their file integrity. So I did not need to rerun the command.

Questions? Let me know!
Please leave a comment here!
One Minute Information - by Michael Wen
Find Michael on Facebook
ADVERTISING WITH US - Direct your advertising requests to Michael