commands.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. .. include:: global.rst.inc
  2. .. _detailed_usage:
  3. Commands
  4. ========
  5. |project_name| consists of a number of commands. Each command accepts
  6. a number of arguments and options. The following sections will describe each
  7. command in detail.
  8. Quiet by default
  9. ----------------
  10. Like most UNIX commands |project_name| is quiet by default but the ``-v`` or
  11. ``--verbose`` option can be used to get the program to output more status
  12. messages as it is processing.
  13. .. _attic_init:
  14. attic init
  15. ----------
  16. .. include:: usage/init.rst.inc
  17. This command initializes an empty :ref:`repository <repository_def>`.
  18. A repository is a filesystem directory
  19. containing the deduplicated data from zero or more archives.
  20. Encryption is enabled at repository initialization time.
  21. Examples
  22. ~~~~~~~~
  23. ::
  24. # Local backup repository
  25. $ attic init /data/mybackuprepo.attic
  26. # Remote backup repository
  27. $ attic init user@hostname:mybackuprepo.attic
  28. # Encrypted remote backup repository
  29. $ attic init --passphrase user@hostname:mybackuprepo.attic
  30. attic create
  31. ------------
  32. .. include:: usage/create.rst.inc
  33. This command creates a backup archive containing all files found while
  34. recursively traversing all paths specified. The archive will consume almost
  35. no disk space for files or parts of files that has already been archived by
  36. other archives.
  37. Examples
  38. ~~~~~~~~
  39. ::
  40. # Backups ~/Documents into an archive named "my-documents"
  41. $ attic create /data/myrepo.attic::my-documents ~/Documents
  42. # Backup ~/Documents and ~/src but exclude pyc files
  43. $ attic create /data/myrepo.attic::my-files \
  44. ~/Documents \
  45. ~/src \
  46. --exclude *.pyc
  47. # Backup the root filesystem into an archive named "root-YYYY-MM-DD"
  48. NAME="root-`date +%Y-%m-%d`"
  49. $ attic create /data/myrepo.attic::$NAME / --do-not-cross-mountpoints
  50. .. _attic_extract:
  51. attic extract
  52. -------------
  53. .. include:: usage/extract.rst.inc
  54. This command extracts the contents of an archive. By default the entire
  55. archive is extracted but a subset of files and directories can be selected
  56. by passing a list of ``PATHs`` as arguments. The file selection can further
  57. be restricted by using the ``--exclude`` option.
  58. Examples
  59. ~~~~~~~~
  60. ::
  61. # Extract entire archive
  62. $ attic extract /data/myrepo::my-files
  63. # Extract entire archive and list files while processing
  64. $ attic extract -v /data/myrepo::my-files
  65. # Extract the "src" directory
  66. $ attic extract /data/myrepo::my-files home/USERNAME/src
  67. # Extract the "src" directory but exclude object files
  68. $ attic extract /data/myrepo::my-files home/USERNAME/src --exclude *.o
  69. attic verify
  70. ------------
  71. .. include:: usage/verify.rst.inc
  72. This command is similar to :ref:`attic_extract` but instead of writing any
  73. files to disk the command just verifies that all files are extractable and
  74. not corrupt. |project_name| will not compare the the archived files with the
  75. files on disk.
  76. attic delete
  77. ------------
  78. .. include:: usage/delete.rst.inc
  79. This command deletes an archive from the repository. Any disk space not
  80. shared with any other existing archive is also reclaimed.
  81. .. _attic_list:
  82. attic list
  83. ----------
  84. .. include:: usage/list.rst.inc
  85. This command lists the contents of a repository or an archive.
  86. Examples
  87. ~~~~~~~~
  88. ::
  89. $ attic list /data/myrepo
  90. my-files Thu Aug 1 23:33:22 2013
  91. my-documents Thu Aug 1 23:35:43 2013
  92. root-2013-08-01 Thu Aug 1 23:43:55 2013
  93. root-2013-08-02 Fri Aug 2 15:18:17 2013
  94. ...
  95. $ attic list /data/myrepo::root-2013-08-02
  96. drwxr-xr-x root root 0 Jun 05 12:06 .
  97. lrwxrwxrwx root root 0 May 31 20:40 bin -> usr/bin
  98. drwxr-xr-x root root 0 Aug 01 22:08 etc
  99. drwxr-xr-x root root 0 Jul 15 22:07 etc/ImageMagick-6
  100. -rw-r--r-- root root 1383 May 22 22:25 etc/ImageMagick-6/colors.xml
  101. ...
  102. attic prune
  103. -----------
  104. .. include:: usage/prune.rst.inc
  105. The ``prune`` command prunes a repository by deleting archives not matching
  106. any of the specified retention options specified. This command is normally
  107. used by automated backup scripts wanting to keep a certain number of historic
  108. backups.
  109. Examples
  110. ~~~~~~~~
  111. ::
  112. # Keep 7 end of day and 4 end of week archives
  113. $ attic prune /data/myrepo --daily=7 --weekly=4
  114. # Same as above but only apply to archive names starting with "foo"
  115. $ attic prune /data/myrepo --daily=7 --weekly=4 --prefix=foo
  116. attic info
  117. ----------
  118. .. include:: usage/info.rst.inc
  119. This command displays some detailed information about the specified archive.
  120. Examples
  121. ~~~~~~~~
  122. ::
  123. $ attic info /data/myrepo::root-2013-08-02
  124. Name: root-2013-08-02
  125. Fingerprint: bc3902e2c79b6d25f5d769b335c5c49331e6537f324d8d3badcb9a0917536dbb
  126. Hostname: myhostname
  127. Username: root
  128. Time: Fri Aug 2 15:18:17 2013
  129. Command line: /usr/bin/attic create --stats /data/myrepo::root-2013-08-02 / --do-not-cross-mountpoints
  130. Number of files: 147429
  131. Original size: 5344169493 (4.98 GB)
  132. Compressed size: 1748189642 (1.63 GB)
  133. Unique data: 64805454 (61.80 MB)
  134. attic mount
  135. -----------
  136. .. include:: usage/mount.rst.inc
  137. This command mounts an archive as a FUSE filesystem. This can be useful for
  138. browsing an archive or restoring individual files. Unless the ``--foreground``
  139. option is given the command will run in the background until the filesystem
  140. is ``umounted``.
  141. Examples
  142. ~~~~~~~~
  143. ::
  144. $ attic mount /data/myrepo::root-2013-08-02 /tmp/mymountpoint
  145. $ ls /tmp/mymountpoint
  146. bin boot etc lib lib64 mnt opt root sbin srv usr var
  147. $ fusermount -u /tmp/mymountpoint
  148. attic change-passphrase
  149. -----------------------
  150. .. include:: usage/change-passphrase.rst.inc
  151. The key files used for repository encryption are optionally passphrase
  152. protected. This command can be used to change this passphrase.
  153. Examples
  154. ~~~~~~~~
  155. ::
  156. # Create a key file protected repository
  157. $ attic init --key-file /tmp/encrypted-repo
  158. Initializing repository at "/tmp/encrypted-repo"
  159. Enter passphrase (empty for no passphrase):
  160. Enter same passphrase again:
  161. Key file "/home/USER/.attic/keys/tmp_encrypted_repo" created.
  162. Keep this file safe. Your data will be inaccessible without it.
  163. # Change key file passphrase
  164. $ attic change-passphrase /tmp/encrypted-repo
  165. Enter passphrase for key file /home/USER/.attic/keys/tmp_encrypted_repo:
  166. New passphrase:
  167. Enter same passphrase again:
  168. Key file "/home/USER/.attic/keys/tmp_encrypted_repo" updated