snapshot.texi 5.8 KB

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