usage.rst 6.1 KB

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