tar: Race conditions

1 
1 10.1.3 Race conditions
1 ----------------------
1 
1 If some other process is modifying the file system while 'tar' is
1 reading or writing files, the result may well be inconsistent due to
1 race conditions.  For example, if another process creates some files in
1 a directory while 'tar' is creating an archive containing the
1 directory's files, 'tar' may see some of the files but not others, or it
1 may see a file that is in the process of being created.  The resulting
1 archive may not be a snapshot of the file system at any point in time.
1 If an application such as a database system depends on an accurate
1 snapshot, restoring from the 'tar' archive of a live file system may
1 therefore break that consistency and may break the application.  The
1 simplest way to avoid the consistency issues is to avoid making other
1 changes to the file system while tar is reading it or writing it.
1 
1    When creating an archive, several options are available to avoid race
1 conditions.  Some hosts have a way of snapshotting a file system, or of
1 temporarily suspending all changes to a file system, by (say) suspending
1 the only virtual machine that can modify a file system; if you use these
1 facilities and have 'tar -c' read from a snapshot when creating an
1 archive, you can avoid inconsistency problems.  More drastically, before
1 starting 'tar' you could suspend or shut down all processes other than
1 'tar' that have access to the file system, or you could unmount the file
1 system and then mount it read-only.
1 
1    When extracting from an archive, one approach to avoid race
1 conditions is to create a directory that no other process can write to,
1 and extract into that.
1