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