can

Section: (1)
Updated: June 21, 2009
Index Return to Main Contents
 

NAME

can - create/list/extract backup files  

SYNOPSIS

can -c [-v] [-z|-j] [-e PATTERN] [-X FILE] PATTERN [PATTERN ...]
can -x [-v] -f FILE [-e PATTERN] [-X FILE] [PATTERN ...]
can -t -f FILE [-e PATTERN] [-X FILE] [PATTERN ...]
 

DESCRIPTION

can(1) is a utility to create and manage incremental snapshots of parts of the filesystem for backup purposes. It is very similar to the tar(1) program in terms of command line options and handling. The philosophy of can(1) is that creating a snapshot should be cheap in terms of speed and disk space.  

FILE FORMAT

can(1) stores each backup snapshot in an individual archive. To save disk space each snapshot stores only the changes that were made to the filesystem since the previous run. To restore files or parts of a filesystem it is therefore necessary to keep all snapshot files of a collection.  

EXAMPLE

Suppose you want to backup the directories `documents' and `projects' from your home directory to a central backup directory in /var:

    can -c -v -z -f /var/backups/home-dir -C /home/user documents projects

This command will create a snapshot file in a subdirectory in /var/backups. The current date and time will be encoded in the filename. So, if you ran the command above on May 24th 2005 at 15:57, this will be what it looks like:

    /var/backups/home-dir-20050524-1557

If you changed some files in `documents' or `projects` and issue the same command an hour later the listing will look like this:

    /var/backups/home-dir-20050524-1557
    /var/backups/home-dir-20050524-1657

The second snapshot is much smaller than the first one, because it only stores the changes.

The next day you notice that you accidentally deleted your `foo' project directory and want to restore it from the backup:

    can -t -v -f /var/backups/home-dir-20050524-1657 projects/foo

This command will list all files from the backup you made on May 24th at 16:57 below the `projects/foo' directory. To extract these files to the current working directory you simply replace the `-t' option with `-x'.  

ACTION OPTIONS

-h, --help
Show a help message.
-c, --create
Create a new backup snapshot.
-x, --extract
Extract files from an existing backup snapshot.
-t, --list
List files from an existing backup snapshot.
--test
Test the integrity of a backup snapshot.
--version
Show version and license information and exit.
 

COMMON OPTIONS

-v, --verbose
Produce informative runtime output. May be specified multiple times to increase verbosity.
-f, --file SOURCE
Create a backup snapshot with name SOURCE (a timestamp is appended automatically) or extract/list files from an existing snapshot named SOURCE.
-C, --directory DIR
Change to DIR before adding or extracting files.
-T, --files-from FILE
Read filenames one per line from FILE instead from the filesystem, "-" means standard input.
-e, --exclude PAT
Exclude shell pattern PAT from being added, extracted or listed.
-X, --exclude-from FILE
Read exclude patterns from FILE, one per line.
--exclude-tag FILE
Exclude contents of directories containing FILE, except for FILE itself.
-M, --max-size SIZE
Maximum SIZE in megabytes for files to add to a snapshot.
-l, --one-file-system
Do not descend into mounted file systems.
-z, --gzip
Compress compressable files in the snapshot with gzip.
-j, --bzip2
Compress compressable files in the snapshot with bzip2.
-Z, --gzip-all
Compress the complete backup snapshot with gzip.
-J, --bzip2-all
Compress the complete backup snapshot with bzip2.
-K, --keyfile FILE
Encrypt the entire snapshot using the blowfish algorithm and keyfile FILE.
--new
List only new or changed files in a snapshot with -t/--list.
 

COMPRESSION

The data files are not compressed by default. It is recommended to use compression which greatly decreases the size of the snapshot and will save diskspace. can(1) supports two different compression algorithms (gzip and bzip2) and two different compression modes.

In the first mode each file is compressed individually. The advantages are fast random access which results in fast creating and extracting and the possibility to store files that are already compressed (e.g. archives, multimedia files) without compressing them once again. The file `/etc/can/compressed.list' contains a collection of patterns to identify these files.

In the second mode the complete snapshot file is compressed which results in much better compression ratio, but slows down creating and extracting.  

ENCRYPTION

can(1) supports snapshot encryption. The blowfish algorithm is the only one supported at the moment and you need the pycrypto package from http://pycrypto.sourceforge.net/.

To enable encryption use the -K/--keyfile option with a file that contains a passphrase. The keyfile must be available for every action performed on the snapshot (creating new ones, listing, extracting).  

CACHE EXCLUSION

The --exclude-tag option allows to exclude particular directories from a snapshot. This feature is modelled after the solution presented at http://www.brynosaurus.com/cachedir/. Use whatever name you like for the --exclude-tag option, it is not limited to CACHEDIR.TAG. However, CACHEDIR.TAG files are checked for a valid signature.  

FILES

/etc/can/compressed.list  

SEE ALSO

tar(1)  

AUTHOR

Lars Gustaebel <lars@gustaebel.de>


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILE FORMAT
EXAMPLE
ACTION OPTIONS
COMMON OPTIONS
COMPRESSION
ENCRYPTION
CACHE EXCLUSION
FILES
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 15:01:40 GMT, June 21, 2009