usage.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 --encryption=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 have already been stored in
  31. other archives.
  32. Examples
  33. ~~~~~~~~
  34. ::
  35. # Backup ~/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/check.rst.inc
  62. .. include:: usage/delete.rst.inc
  63. This command deletes an archive from the repository. Any disk space not
  64. shared with any other existing archive is also reclaimed.
  65. .. include:: usage/list.rst.inc
  66. This command lists the contents of a repository or an archive.
  67. Examples
  68. ~~~~~~~~
  69. ::
  70. $ attic list /data/myrepo
  71. my-files Thu Aug 1 23:33:22 2013
  72. my-documents Thu Aug 1 23:35:43 2013
  73. root-2013-08-01 Thu Aug 1 23:43:55 2013
  74. root-2013-08-02 Fri Aug 2 15:18:17 2013
  75. ...
  76. $ attic list /data/myrepo::root-2013-08-02
  77. drwxr-xr-x root root 0 Jun 05 12:06 .
  78. lrwxrwxrwx root root 0 May 31 20:40 bin -> usr/bin
  79. drwxr-xr-x root root 0 Aug 01 22:08 etc
  80. drwxr-xr-x root root 0 Jul 15 22:07 etc/ImageMagick-6
  81. -rw-r--r-- root root 1383 May 22 22:25 etc/ImageMagick-6/colors.xml
  82. ...
  83. .. include:: usage/prune.rst.inc
  84. The ``prune`` command prunes a repository by deleting archives not matching
  85. any of the specified retention options. This command is normally
  86. used by automated backup scripts wanting to keep a certain number of historic
  87. backups.
  88. Examples
  89. ~~~~~~~~
  90. ::
  91. # Keep 7 end of day and 4 additional end of week archives:
  92. $ attic prune /data/myrepo --keep-daily=7 --keep-weekly=4
  93. # Same as above but only apply to archive names starting with "foo":
  94. $ attic prune /data/myrepo --keep-daily=7 --keep-weekly=4 --prefix=foo
  95. # Keep 7 end of day, 4 additional end of week archives,
  96. # and an end of month archive for every month:
  97. $ attic prune /data/myrepo --keep-daily=7 --keep-weekly=4 --monthly=-1
  98. # Keep all backups in the last 10 days, 4 additional end of week archives,
  99. # and an end of month archive for every month:
  100. $ attic prune /data/myrepo --keep-within=10d --keep-weekly=4 --monthly=-1
  101. .. include:: usage/info.rst.inc
  102. This command displays some detailed information about the specified archive.
  103. Examples
  104. ~~~~~~~~
  105. ::
  106. $ attic info /data/myrepo::root-2013-08-02
  107. Name: root-2013-08-02
  108. Fingerprint: bc3902e2c79b6d25f5d769b335c5c49331e6537f324d8d3badcb9a0917536dbb
  109. Hostname: myhostname
  110. Username: root
  111. Time: Fri Aug 2 15:18:17 2013
  112. Command line: /usr/bin/attic create --stats /data/myrepo::root-2013-08-02 / --do-not-cross-mountpoints
  113. Number of files: 147429
  114. Original size: 5344169493 (4.98 GB)
  115. Compressed size: 1748189642 (1.63 GB)
  116. Unique data: 64805454 (61.80 MB)
  117. .. include:: usage/mount.rst.inc
  118. This command mounts an archive as a FUSE filesystem. This can be useful for
  119. browsing an archive or restoring individual files. Unless the ``--foreground``
  120. option is given the command will run in the background until the filesystem
  121. is ``umounted``.
  122. Examples
  123. ~~~~~~~~
  124. ::
  125. $ attic mount /data/myrepo::root-2013-08-02 /tmp/mymountpoint
  126. $ ls /tmp/mymountpoint
  127. bin boot etc lib lib64 mnt opt root sbin srv usr var
  128. $ fusermount -u /tmp/mymountpoint
  129. .. include:: usage/change-passphrase.rst.inc
  130. The key files used for repository encryption are optionally passphrase
  131. protected. This command can be used to change this passphrase.
  132. Examples
  133. ~~~~~~~~
  134. ::
  135. # Create a key file protected repository
  136. $ attic init --key-file /tmp/encrypted-repo
  137. Initializing repository at "/tmp/encrypted-repo"
  138. Enter passphrase (empty for no passphrase):
  139. Enter same passphrase again:
  140. Key file "/home/USER/.attic/keys/tmp_encrypted_repo" created.
  141. Keep this file safe. Your data will be inaccessible without it.
  142. # Change key file passphrase
  143. $ attic change-passphrase /tmp/encrypted-repo
  144. Enter passphrase for key file /home/USER/.attic/keys/tmp_encrypted_repo:
  145. New passphrase:
  146. Enter same passphrase again:
  147. Key file "/home/USER/.attic/keys/tmp_encrypted_repo" updated