dumpdir.texi 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. @c This is part of the paxutils manual.
  2. @c Copyright (C) 2006-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. Incremental archives keep information about contents of each
  8. dumped directory in special data blocks called @dfn{dumpdirs}.
  9. Dumpdir is a sequence of entries of the following form:
  10. @smallexample
  11. @var{C} @var{filename} \0
  12. @end smallexample
  13. @noindent
  14. where @var{C} is one of the @dfn{control codes} described below,
  15. @var{filename} is the name of the file @var{C} operates upon, and
  16. @samp{\0} represents a nul character (ASCII 0). The white space
  17. characters were added for readability, real dumpdirs do not contain
  18. them.
  19. Each dumpdir ends with a single nul character.
  20. The following table describes control codes and their meanings:
  21. @table @samp
  22. @item Y
  23. @var{filename} is contained in the archive.
  24. @item N
  25. @var{filename} was present in the directory at the time the archive
  26. was made, yet it was not dumped to the archive, because it had not
  27. changed since the last backup.
  28. @item D
  29. @var{filename} is a directory.
  30. @item R
  31. This code requests renaming of the @var{filename} to the name
  32. specified with the @samp{T} command, that immediately follows it.
  33. @item T
  34. Specify target file name for @samp{R} command (see below).
  35. @item X
  36. Specify @dfn{temporary directory} name for a rename operation (see below).
  37. @end table
  38. Codes @samp{Y}, @samp{N} and @samp{D} require @var{filename} argument
  39. to be a relative file name to the directory this dumpdir describes,
  40. whereas codes @samp{R}, @samp{T} and @samp{X} require their argument
  41. to be an absolute file name.
  42. The three codes @samp{R}, @samp{T} and @samp{X} specify a
  43. @dfn{renaming operation}. In the simplest case it is:
  44. @smallexample
  45. R@file{source}\0T@file{dest}\0
  46. @end smallexample
  47. @noindent
  48. which means ``rename file @file{source} to file @file{dest}''.
  49. However, there are cases that require using a @dfn{temporary
  50. directory}. For example, consider the following scenario:
  51. @enumerate 1
  52. @item
  53. Previous run dumped a directory @file{foo} which contained the
  54. following three directories:
  55. @smallexample
  56. a
  57. b
  58. c
  59. @end smallexample
  60. @item
  61. They were renamed @emph{cyclically}, so that:
  62. @example
  63. @file{a} became @file{b}
  64. @file{b} became @file{c}
  65. @file{c} became @file{a}
  66. @end example
  67. @item
  68. New incremental dump was made.
  69. @end enumerate
  70. This case cannot be handled by three successive renames, since
  71. renaming @file{a} to @file{b} will destroy the existing directory.
  72. To correctly process it, @GNUTAR{} needs a temporary directory, so
  73. it creates the following dumpdir (newlines have been added for
  74. readability):
  75. @smallexample
  76. @group
  77. Xfoo\0
  78. Rfoo/a\0T\0
  79. Rfoo/b\0Tfoo/c\0
  80. Rfoo/c\0Tfoo/a\0
  81. R\0Tfoo/a\0
  82. @end group
  83. @end smallexample
  84. The first command, @samp{Xfoo\0}, instructs the extractor to create a
  85. temporary directory in the directory @file{foo}. Second command,
  86. @samp{Rfoo/aT\0}, says ``rename file @file{foo/a} to the temporary
  87. directory that has just been created'' (empty file name after a
  88. command means use temporary directory). Third and fourth commands
  89. work as usual, and, finally, the last command, @samp{R\0Tfoo/a\0}
  90. tells tar to rename the temporary directory to @file{foo/a}.
  91. The exact placement of a dumpdir in the archive depends on the
  92. archive format (@pxref{Formats}):
  93. @itemize
  94. @item PAX archives
  95. In PAX archives, dumpdir is stored in the extended header of the
  96. corresponding directory, in variable @code{GNU.dumpdir}.
  97. @item GNU and old GNU archives
  98. These formats implement special header type @samp{D}, which is similar
  99. to ustar header @samp{5} (directory), except that it precedes a data
  100. block containing the dumpdir.
  101. @end itemize
  102. @c End of dumpdir.texi