snapshot.texi 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. @c This is part of the paxutils manual.
  2. @c Copyright (C) 2005, 2007, 2014, 2016-2017 Free Software Foundation,
  3. @c Inc.
  4. @c Written by Sergey Poznyakoff
  5. @c This file is distributed under GFDL 1.1 or any later version
  6. @c published by the Free Software Foundation.
  7. A @dfn{snapshot file} (or @dfn{directory file}) is created during
  8. incremental backups (@pxref{Incremental Dumps}). It
  9. contains the status of the file system at the time of the dump and is
  10. used to determine which files were modified since the last backup.
  11. @GNUTAR{} version @value{VERSION} supports three snapshot file
  12. formats. The first format, called @dfn{format 0}, is the one used by
  13. @GNUTAR{} versions up to and including 1.15.1. The second format, called
  14. @dfn{format 1} is an extended version of this format, that contains more
  15. metadata and allows for further extensions. It was used by alpha release
  16. version 1.15.90. For alpha version 1.15.91 and stable releases
  17. version 1.16 up through @value{VERSION}, the @dfn{format 2} is used.
  18. @GNUTAR{} is able to read all three formats, but will create
  19. snapshots only in format 2.
  20. This appendix describes all three formats in detail.
  21. @enumerate 0
  22. @cindex format 0, snapshot file
  23. @cindex snapshot file, format 0
  24. @item
  25. @samp{Format 0} snapshot file begins with a line containing a
  26. decimal number that represents a @acronym{UNIX} timestamp of the
  27. beginning of the last archivation. This line is followed by directory
  28. metadata descriptions, one per line. Each description has the
  29. following format:
  30. @smallexample
  31. [@var{nfs}]@var{dev} @var{inode} @var{name}
  32. @end smallexample
  33. @noindent
  34. where:
  35. @table @var
  36. @item nfs
  37. A single plus character (@samp{+}), if this directory is located on
  38. an @acronym{NFS}-mounted partition, otherwise empty.
  39. (That is, for non-NFS directories, the first character on the
  40. description line contains the start of the @var{dev} field.)
  41. @item dev
  42. Device number of the directory;
  43. @item inode
  44. I-node number of the directory;
  45. @item name
  46. Name of the directory. Any special characters (white-space,
  47. backslashes, etc.) are quoted.
  48. @end table
  49. @cindex format 1, snapshot file
  50. @cindex snapshot file, format 1
  51. @item
  52. @samp{Format 1} snapshot file begins with a line specifying the
  53. format of the file. This line has the following structure:
  54. @smallexample
  55. @samp{GNU tar-}@var{tar-version}@samp{-}@var{incr-format-version}
  56. @end smallexample
  57. @noindent
  58. where @var{tar-version} is the version number of @GNUTAR{}
  59. implementation that created this snapshot, and
  60. @var{incr-format-version} is the version number of the snapshot format
  61. (in this case @samp{1}).
  62. Next line contains two decimal numbers, representing the
  63. time of the last backup. First number is the number of seconds, the
  64. second one is the number of nanoseconds, since the beginning of the
  65. epoch.
  66. Lines that follow contain directory metadata, one line per
  67. directory. Each line is formatted as follows:
  68. @smallexample
  69. [@var{nfs}]@var{mtime-sec} @var{mtime-nsec} @var{dev} @var{inode} @var{name}
  70. @end smallexample
  71. @noindent
  72. where @var{mtime-sec} and @var{mtime-nsec} represent last
  73. modification time of this directory with nanosecond precision;
  74. @var{nfs}, @var{dev}, @var{inode} and @var{name} have the same meaning
  75. as with @samp{format 0}.
  76. @cindex format 2, snapshot file
  77. @cindex snapshot file, format 2
  78. @item
  79. @samp{Format 2} snapshot file begins with a format identifier, as described for
  80. version 1, e.g.:
  81. @smallexample
  82. GNU tar-@value{VERSION}-2
  83. @end smallexample
  84. This line is followed by newline. Rest of file consists of
  85. records, separated by null (@acronym{ASCII} 0)
  86. characters. Thus, in contrast to the previous formats, format 2
  87. snapshot is a binary file.
  88. First two records are decimal integers, representing the
  89. time of the last backup. First number is the number of seconds, the
  90. second one is the number of nanoseconds, since the beginning of the
  91. epoch. These are followed by arbitrary number of directory records.
  92. Each @dfn{directory record} contains a set of metadata describing a
  93. particular directory. Parts of a directory record are delimited with
  94. @acronym{ASCII} 0 characters. The following table describes each
  95. part. The @dfn{Number} type in this table stands for a decimal integer
  96. in @acronym{ASCII} notation. (Negative values are preceded with a "-"
  97. character, while positive values have no leading punctuation.)
  98. @multitable @columnfractions 0.25 0.15 0.6
  99. @headitem Field @tab Type @tab Description
  100. @item nfs @tab Character @tab @samp{1} if the directory is located on
  101. an @acronym{NFS}-mounted partition, or @samp{0} otherwise;
  102. @item timestamp_sec @tab Number @tab Modification time, seconds;
  103. @item timestamp_nsec @tab Number @tab Modification time, nanoseconds;
  104. @item dev @tab Number @tab Device number;
  105. @item ino @tab Number @tab I-node number;
  106. @item name @tab String @tab Directory name; in contrast to the
  107. previous versions it is not quoted;
  108. @item contents @tab Dumpdir @tab Contents of the directory;
  109. @xref{Dumpdir}, for a description of its format.
  110. @item
  111. @end multitable
  112. Dumpdirs stored in snapshot files contain only records of types
  113. @samp{Y}, @samp{N} and @samp{D}.
  114. @cindex snapshot file field ranges
  115. @opindex show-snapshot-field-ranges
  116. The specific range of values allowed in each of the @dfn{Number} fields
  117. depends on the underlying C datatypes as determined when @command{tar}
  118. is compiled. To see the specific ranges allowed for a particular
  119. @command{tar} binary, you can use the
  120. @option{--show-snapshot-field-ranges} option:
  121. @smallexample
  122. $ @kbd{tar --show-shapshot-field-ranges}
  123. This tar's snapshot file field ranges are
  124. (field name => [ min, max ]):
  125. nfs => [ 0, 1 ],
  126. timestamp_sec => [ -9223372036854775808, 9223372036854775807 ],
  127. timestamp_nsec => [ 0, 999999999 ],
  128. dev => [ 0, 18446744073709551615 ],
  129. ino => [ 0, 18446744073709551615 ],
  130. @end smallexample
  131. (This example is from a GNU/Linux x86_64 system.)
  132. @end enumerate
  133. @c End of snapshot.texi