My tar (GNU tar 1.28) man-page lists the --atime-preserve option, which applies to the time a file is added to the tarball. The full explanation reads thus:

       preserve access times on dumped files, either by restoring the times after reading (METHOD='replace'; default) or by not setting
       the times in the first place (METHOD='system')

However, what is exactly meant by METHOD='replace' and METHOD='system' remains unexplained. Can anyone shed a light on this?


They're simply the values of that option. The online manual (and the info docs as well - check info tar 'Option Summary') make it clearer:


Attempt to preserve the access time of files when reading them. This option currently is effective only on files that you own, unless you have superuser privileges.

--atime-preserve=replace remembers the access time of a file before reading it, and then restores the access time afterwards. This may cause problems if other programs are reading the file at the same time, as the times of their accesses will be lost. On most platforms restoring the access time also requires tar to restore the data modification time too, so this option may also cause problems if other programs are writing the file at the same time (tar attempts to detect this situation, but cannot do so reliably due to race conditions). Worse, on most platforms restoring the access time also updates the status change time, which means that this option is incompatible with incremental backups.

--atime-preserve=system avoids changing time stamps on files, without interfering with time stamp updates caused by other programs, so it works better with incremental backups. However, it requires a special O_NOATIME option from the underlying operating and file system implementation, and it also requires that searching directories does not update their access times. As of this writing (November 2005) this works only with Linux, and only with Linux kernels 2.6.8 and later. Worse, there is currently no reliable way to know whether this feature actually works. Sometimes tar knows that it does not work, and if you use --atime-preserve=system then tar complains and exits right away. But other times tar might think that the option works when it actually does not.

  • Thanks! Very informative. – Roadowl Jun 28 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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