yakup0.20050819.tar.gz.000 yakup0.20050819_last.tar.gz.001
yakup - backup and restore files to fixed disk and CD/DVD media
yakup [OPTIONS] [FILES]
yakup is yet another backup script:
Full and multi-level differential backups.
Backup up and restore from fixed disk or removable CD/DVD media.
Media spanning.
tar(1) formatted archives.
Optional gzip or bzip2 compression.
Single bash(1) shell script — trivial installation, runs on any Linux system.
Flexible customizable configuration options.
yakup can execute the following commands:
Create a new archive. FILES specifies the files and/or directories to archive. If no FILES are specified then files specified in INCLUDED_FILE. See ARCHIVES and ARCHIVE FILE SELECTION below.
Burn an archive to removable media. If combined with the archive command then burn the newly created archive else burn archive chunk FILES specified in the command-line arguments. Rewritable media is blanked prior to writing.
Restore an archive. Restore from archive chunk FILES (in argument order), if no command-line FILES are specified then restore from removable media. If combined with the burn command then the archive is recovered from removable media. Files are restored to RESTORE_DIR directory (see —restore-dir option) or to the current directory if RESTORE_DIR is not set. See ARCHIVES and ARCHIVE FILE SELECTION below.
Write the list of archived file names (one per line) to a file. The table of contents is extracted from archive chunk FILES (in argument order), if no command-line FILES are specified then read archive chunks from removable media. If combined with the burn command then the table of contents is recovered from removable media. The table of contents file is written to ARCHIVE_DIR directory (see —archive-dir option and ARCHIVES below).
Commands can be combined but they will be executed in the following order: archive, burn, restore,toc — regardless of the order they appear in the command-line.
Archive chunks, table of contents, and backup level files are written to this directory. Each backup regime should have it's own archive directory. Applies to archive and toc commands.
Additional cdrecord(1) options. Applies to burn command.
Media device name. Applies to burn command.
Prompt for the first disk in archive backup set (the user is always prompted for second and subsequent disks). If a yakup command ascertains the archive has more than one chunk then this option is enabled for all subsequent commands. Applies to burn, restore, toc commands.
Dump the accumulated hardwired, configuration file and command-line program parameters then exit. Useful for debugging.
Read CONF_FILE configuration file. This option is processed first. Applies to all commands.
Print command-line syntax and program options to stdout.
Only extract archive file or directory names matching PATTERN. Applies to restore and toc commands.
Files to include are specified in a tar include INCLUDE_FILE (see tar(1) —files-from option). See ARCHIVE FILE SELECTION below. Applies to archive command.
Sets backup level (0..9). See BACKUP LEVELS below. Applies to archive command.
Don't automatically eject the media on disk change or at burn completion. This option is useful for computer enclosures with front closing doors.
Write messages to LOG_FILE. If LOG_FILE is empty then don't write log messages. If LOG_FILE=syslog then log to syslog(3). Applies to all commands.
dvd, cdr, cdrw. Applies to burn, restore, toc commands.
Media mount directory. Must coincide with a media mount point defined in fstab(5). See yakup.conf(5). Applies to burn, restore, toc commands.
mkisofs(8) options. Applies to burn command.
Don't do anything just print what would have been done. Bear in mind that because commands are not actually executed subsequent dependent commands don't always generate the expected output. Maximum verbosity to console but does generate create log file entries. Applies to all commands.
Don't cross file system boundaries when creating an archive. Applies to archive command.
Sets the file name prefix for archive chunks and table of contents files. %l in PREFIX is replaced by LEVEL. Defaults to yakup%l.yyyymmdd. Applies to archive command.
Directory to restore to. Applies to restore and toc commands.
Set size of archive chunks. Size can be specified in bytes, kilobytes (K suffix), megabytes (M suffix), gigabytes (G suffix). Decimal fractions allowed. The default size for each media type can be set in a configuration file (see yakup.conf(5)). Applies to archive command.
Additional tar(1) options. Applies archive, restore, toc commands.
If more than one disk is required to burn archive or user intervention is required to mount removable media then an error exit occurs. Applies to burn, restore, toc commands.
Print operational details to stderr. A second -v options will print additional diagnostic information to stderr. Applies to all commands.
Print yakup version to stdout.
Set media volume ID. %l in VOLUME_ID is replaced by LEVEL. %n in VOLUME_ID is replaced by current disk number. %N in VOLUME_ID is replaced by total number of disks. Defaults to yakup%l yyyy-mm-dd (%n of %N). Applies to burn command.
Files to exclude are specified in a tar exclude EXCLUDE_FILE (see tar(1) —exclude-file option). If EXCLUDE_FILE is set to an empty string file exclusion is disabled. See ARCHIVE FILE SELECTION below. Applies to archive command.
Set archive compression: gzip or bzip2. Applies to archive, restore, toc commands.
When yakup(1) starts program option values are accumulated from the following sources in the following order:
Internally defined values hardwired into the yakup script.
The optional global /etc/yakup/yakup.conf configuration file.
The optional user $HOME/.yakup/yakup.conf configuration file.
Configuration files specified by the —conf-file command-line option.
Command-line options.
See also yakup.conf(5).
A yackup archive is a tar archive (optionally compressed) that has been split into one or more files (chunks).
Archives are written to the ARCHIVE_DIR directory, so the containing file system must have enough free space for the complete archive.
Archives are split into chunks as they are written (see —chunk-size option).
Each chunk is named like: <prefix>[_last].tar[.<compression>].<chunk>
<prefix> is the archive prefix (see —prefix option).
<compression> is the optional compression name (see —compression option).
<chunk> is the three digit chunk number 000, 001, …
The last chunk in the archive has _last inserted after <prefix> in the file name.
Examples:
yakup0.20050819.tar.gz.000 yakup0.20050819_last.tar.gz.001
If the —burn command option is specified the archive is written (one chunk per disk) to the designated removable media.
An archive table of contents is a text file, generated by the —toc command, containing the names (one per line) of the files and directories stored in an archive:
Table of contents files are written to the ARCHIVE_DIR directory and are named like <prefix>.toc where <prefix> is the file name prefix of the source archive.
Backup levels facilitate multi-level differential backups.
The backup level 0..9 is set by the —level option.
Level 0 backup backs up all files. Levels 1..9 only back up files that have changed since the most recent lower level backup.
Backup levels are implemented using the tar(1) —newer FILE option in conjunction with backup level files.
Backup level files are stored in the ARCHIVE_DIR directory (see —archive-dir option) and are named like: yakup.level.<level>.
After successful archive creation any higher backup level files are deleted to ensure multi-level archive coherence.
If the backup level is not specified a full backup is performed and no backup level file is created.
For example after completing a level 0 backup a backup level file named yakup.level.0 is created in the ARCHIVE_DIR, it's modification time is set to the time the level 0 backup began, subsequent level 1 backups only backup changes since the yakup.level.0 file's modification time.
Files and directories written to and extracted from yakup archives are specified in:
Command-line arguments (archive command).
The —pattern option (restore and toc commands).
Include and exclude files (archive command).
If a directory is specified it's contents are also included/excluded.
Wildcard characters are allowed.
Include and exclude file names are passed directly to the tar(1) —files-from and —exclude-from options respectively. See also the GNU tar(1) documentation.
During archive creation tar(1) recursively traverses included directories matching file system paths against exclusion patterns. A match occurs if an exclusion pattern matches the file system path or any sub-path.
For example, archiving /, the file /home/me/project/abc.txt will be excluded if one or more exclusion patterns matches any of the files sub-paths:
home me home/me project me/project home/me/project abc.txt project/abc.txt me/project/abc.txt home/me/project/abc.txt
A leading / on the pattern anchors the match to the file system root directory and are only matched if the specified archive paths start with /.
Don't use trailing /'s if you do the pattern won't match anything.
If the pattern matches a directory name then both the directory and its contents are excluded.
The default behavior is modified by the tar(1) —anchored, —no-wildcards-match-slash options.
See also the GNU tar(1) documentation.
yakup(1) uses the following programs, all of which normally come standard with modern UNIX distributions:
GNU coreutils, bash(1), tar(1), getopt(1), bc(1) are mandatory and are installed by default on virtually all Linux distributions.
eject(1) is required when reading or writing removable media.
mkisofs(8), cdrecord(1) are required to write CD media.
mkisofs(8), growisofs(1) are required to write DVD media.
List the default yakup(1) configuration options:
$ yakup --dump-conf
Do an archive and burn dry run with full verbosity:
$ yakup -abvvn ~/doc
Do a level 0 (full backup and burn archives to removable media using options in default configuration files:
$ yakup --archive --burn --level=0
Differential backup and verify (long and short option versions):
$ yakup --archive --burn --toc --level=1 $ yakup -abtl 1
Restore to /tmp/restore from archive chunk files:
# yakup -r -R /tmp/restore /var/local/yakup/yakup1.20050820.tar.gz.*
Restore files archived from /etc/init.d/:
# yakup -r -i 'etc/init.d/*'
Backup home directory to CDRW:
# yakup -abvm cdrw ~
Extract table of contents file from archive on removable media (this is one way to verify removable media):
# yakup --toc
List files in a TOC file (exclude directory names):
$ egrep -v '/$' yakup1.20050820.toc
Restore missing files (don't overwrite any existing files) to user home directory from archive media:
# yakup -rR / -i 'home/srackham/*' --tar-opts=--keep-old-files
Optional global configuration file (see yakup.conf(5)).
Optional user configuration file (see yakup.conf(5)).
Fifo created during media based restore and toc command execution. <pid> is the yakup(1) instance process ID.
See also BACKUP LEVELS and ARCHIVE FILES above.
Please report any bugs to the author.
Written by Stuart Rackham <srackham@methods.co.nz>.
yakup.conf(5), tar(1), mkisofs(8), cdrecord(1), growisofs(1).
Copyright (C) 2005-2006 Stuart Rackham. Free use of this software is granted under the terms of the GNU General Public License (GPL).