usage.rst 6.2 KB

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