Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have used this command on a big-sized (TB),constant changing directory with sub-folders and files.

$ tar c dir/* |gzip - | ssh user@host 'cd /dir/ && tar xz'

What would be the outcome at the end side?

Will it have only the files as of the start of tar?

share|improve this question
up vote 1 down vote accepted

From a test it seems that tar creates a filelist before continuing, so the end result will be that the files present when tar scanned the directories are the one transfered.

This is how I tested:

  • Created 2 large text files (around 3-400M each) called bigfile1 and bigfile2
  • Prepared a touch in another shell window, for a file called c-notsobigfile
  • began to tar the dir in which the files where and when it finished backing bigfile1 I fired the touch

This is my end result

tar czvf test2/
a test2
a test2/bigfile
a test2/bigfile2

my c-notsobigfile was missing.

share|improve this answer
Give that even scanning the directory is not instant, this can result in an inconsistent mix of files compared to how applications are updating the directory tree. That's in addition to updates of file contents. If you want a consistent snapshot, use btrfs and let the application that makes updates do a volume snapshot, then tar the snapshot volume. It depends on how critical it is to be consistent. Ask the application designer. – Skaperen Aug 17 '12 at 13:23
If LVM is used that can be used to create snapshots as well. Actually that is quite a good idea. Make a snapshot, mount it and transfer the files form it. – Frands Hansen Aug 17 '12 at 13:28
If no LVM or brtfs is used how can someone find out the archived files at the instant that tar was started? So that later I can sync or use the mtime option. – pl1nk Aug 17 '12 at 15:08
@pl1nk take a look at rsync – Iain Aug 17 '12 at 15:48
@Iain Sure, but still rsync will need to regenerate the whole structure. I have already started this tar approach. – pl1nk Aug 17 '12 at 16:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.