I have a large directory that I'm tar
ing. It takes a long time and I was wondering what happens when the directory contents change whilst tar
is still doing its thing.
1 Answer
You'll end up with inconsistent data in your tar file.
The question you didn't quite ask is that tar does not grab all of the files atomically at the start of your tar session. It may (or may not) grab a list of the files atomically at the start of your tar session, but it will read and store each file individually and sequentially.
If you have files a
and z
, and between tarring a
and z
you change both a
and z
, then you'll have your old version of a
and your new version of z
in your tar file.
-
The question asks about directory contents rather than file contents but the answer is the same. Archive utilities don't go back when they think the task is done to verify that the current contents of the directory are all accounted for. The archive could end up including deleted files or excluding added files. Sep 25, 2014 at 14:47
-
That's what I thought was probably the case. Thanks for clarifying :) Sep 25, 2014 at 14:54