Homunculus Reticulli
Homunculus Reticulli

Reputation: 68436

tar: /: file changed as we read it. Does this mean that tar skipped one or more files?

I am running Ubuntu 16.0.4 LTS and I'm compressing a directory that contains 32Gb of (CSV) files, so that I can remove the 800k+ files in my directory and create some space..

I run the following command tar czxvf /path/to/archive.tar.gz /path/to/source/directory

The last line before the command prompt returned (i.e. tar completed the task) was:

tar: /path/to/some/folder: file changed as we read it.

From the tar documentation, this is only a warning message. However, I need assurance that the 800K+ files have all been correctly archived and compressed by tar, before deleting the original files.

Does the fact that the only message from tar did not contain an error message mean that no errors occured and that it is safe to delete the original files?

Upvotes: 4

Views: 11117

Answers (1)

thomasrutter
thomasrutter

Reputation: 117373

The tar documentation doesn't specify, but from other sources (including this) it is apparent that tar does archive the file, but it may have captured a mixture where parts of the file were from before a change and parts were after.

For example, tar reads the first X bytes of a file. File changes. Tar reads the next Y bytes of the file. The archived version now contains X bytes from before the change and Y bytes from after.

In many cases, such as when the file is merely being appended to like a log file, this won't really matter since the only changes occur after the end of the file and the existing file data isn't touched. But it varies.

Note: there are some situations, like a file being truncated during reading, in which tar cannot continue and outputs an error. However, if all you received was the warning "file changed as we read it", then it did archive the file.

Upvotes: 3

Related Questions