TARSNAP(1)
๐พ TARSNAP(1) โ manipulate remote encrypted backups ๐พ
okay bestie, welcome to the General Commands Manual page for tarsnap, aka your remote encrypted backup baddie. we're talking create, read, delete, and otherwise manage online backups โ and yes, it's literally giving main character energy. ๐ซถ
โจ NAME โจ
tarsnap โ manipulate remote encrypted backups.
๐ธ SYNOPSIS ๐ธ
the synopsis is giving choose-your-own-adventure, so here it is exactly, no cap:
tarsnap {-c} --keyfile key-file --cachedir cache-dir -f archive-name
[options] [files | directories]
tarsnap {-d} --keyfile key-file --cachedir cache-dir -f archive-name
[options]
tarsnap {-t | -x} --keyfile key-file -f archive-name [options]
[patterns]
tarsnap {-r} --keyfile key-file -f archive-name
tarsnap {--list-archives} --keyfile key-file
tarsnap {--print-stats} --keyfile key-file --cachedir cache-dir
[-f archive-name]
tarsnap {--recover} --keyfile key-file --cachedir cache-dir
tarsnap {--fsck} --keyfile key-file --cachedir cache-dir
tarsnap {--fsck-prune} --keyfile key-file --cachedir cache-dir
tarsnap {--initialize-cachedir} --keyfile key-file --cachedir cache-dir
tarsnap {--nuke} --keyfile key-file
tarsnap --verify-config
tarsnap --version
๐ DESCRIPTION ๐
tarsnap creates, reads, deletes, and otherwise manages online backups. iconic behavior, honestly.
bestie, the very first option you give tarsnap is a mode indicator, and it has to be one of these:
-cโ Create an archive containing the specified items and name. ๐-dโ Delete the specified archive.-tโ List archive contents to stdout.-xโ Extract to disk from the archive.-rโ Read the specified archive, convert it to a tar stream, and write it to stdout.--list-archivesโ Print the names of archives stored. If the-vflag is specified one or more times, the creation time of each archive is also printed; if the-vflag is specified two or more times, the command line with whichtarsnapwas invoked to create each archive is also printed. ๐--print-statsโ Print global statistics concerning the archives stored, and optionally information about individual archive(s). See โPRINTING ARCHIVE STATISTICSโ below for information on the output format.--recoverโ Recover a partial archive from a checkpoint if such an archive exists. This is also done automatically the next time an archive is created or deleted.--fsckโ Perform some integrity checks on the archives stored, and reconstruct the cache directory cache-dir. In the unlikely event that there are corrupted archives,tarsnapwill exit and request that it be run with the--fsck-pruneoption.--fsck-pruneโ Run as--fsck, but if corrupt archives are detected, prune the broken data.--initialize-cachedirโ Create and initialize the cachedir. This option is intended for the GUI and is not needed for command-line usage.--nukeโ Delete all of the archives stored. To protect against accidental data loss,tarsnapwill ask you to type the textNo Tomorrowwhen using the--nukecommand. ๐--verify-configโ Check the configuration file(s) for syntactic errors.--versionโ Print version number oftarsnap, and exit.
in -c mode, each specified file or directory is added to the archive in the order specified on the command line. by default, the contents of each directory are also archived. ๐ฆ
in -t or -x mode, the entire command line is read and parsed before the archive is opened. the pathnames or patterns on the command line indicate which items in the archive should be processed. patterns are shell-style globbing patterns as documented in tcsh(1). note that these follow the POSIX rules for pattern matching, e.g., [] are special characters which can be escaped with a backslash. โจ
two concurrent create or delete operations may not be performed with the same key. extracting or listing archives may be performed in parallel with any other operation.
๐ OPTIONS ๐
okay now the options โ and bestie, I did not skip a single one. ๐
@archive-fileโ (c mode only) The specified archive file is read and the entries in it will be appended to the current archive. If archive-file is-then the archive will be read from the standard input. As an example, this little cutie:
tarsnap -c --keyfile key-file --cachedir cache-dir -f
mybackup @backup.tar
reads the archive file backup.tar from disk and stores it using tarsnap.
@@archive-nameโ (c mode only) The specifiedtarsnaparchive is read and the entries in it will be appended to the current archive.--aggressive-networkingโ (c mode only) Use multiple TCP connections to send data to thetarsnapserver. If the upload rate is congestion-limited rather than being limited by individual bottleneck(s), this may allowtarsnapto use a significantly larger fraction of the available bandwidth, at the expense of slowing down any other network traffic. ๐ฅ--archive-namesfilename โ Read a list of archive names from filename.-Cdirectory โ (c and x modes only) Incmode, this changes the directory before adding the following files. Inxmode, change directories after opening the archive but before extracting entries from the archive.--cachedircache-dir โ (c, d, print-stats, and fsck modes only) Cache information about the archives stored bytarsnapin the directory cache-dir. The contents of this directory will not be backed up bytarsnap, so it should not be used for any other purpose. If the directory cache-dir is lost, it can be reconstructed by runningtarsnap --fsck. ๐ซถ--check-linksโ (c mode only) Issue a warning message unless all links to each file are archived.--checkpoint-bytesbytespercheckpoint โ (c mode only) Create a checkpoint after every bytespercheckpoint bytes of uploaded data. The value bytespercheckpoint must be at least1000000, and a higher value is recommended since creating a checkpoint in an archive can take a few seconds and several hundred kB of bandwidth.--chrootโ (x mode only)chroot()to the current directory after processing any-Coptions and before extracting any files.--configfilefilename โ Add filename to the list of configuration files to be read; options set via these take priority over the default configuration files. This option can be specified multiple times, in which case all the files will be read; where settings conflict, the earlier configuration file will take priority.--creationtimeX โ (c mode only) Manually specify a creation time (a unix timestamp) for the archive. This is unlikely to be useful whentarsnapis being invoked directly from the command line.--csv-filefilename โ (use with--print-stats) Write statistics in CSV format to a file.--disk-pauseX โ (c mode only) Pause for X ms between storing archive entries and after every64 kBof file data. This will slow downtarsnapand thereby reduce its impact on other applications. For archiving files which are stored on an ATA disk and are not in the operating system disk cache, a value of--disk-pause 10will approximately double the time taken.--dry-runโ (c mode only) Don't really create an archive; just simulate doing so. The list of paths added to an archive (if the-voption is used), progress messages (if the--progress-bytesoption is used), and final statistics printed (if the--print-statsoption is used) will be almost identical (typically within a few kB or a fraction of a percent) to iftarsnapis run without the--dry-runoption.
Note that the --maxbw option does not work in combination with --dry-run, since no bandwidth is actually used, and that since tarsnap does not contact the tarsnap server when performing a dry run, it will not detect an attempt to create an archive with the same name as one which already exists. If an existing archive is being copied via @@archive-name, then some network bandwidth will be used while tarsnap reads metadata about archive-name from the tarsnap server.
Furthermore, --dry-run will not check whether the cache directory is out of sync.
--dry-run-metadataโ (c mode only) Don't really create an archive; just simulate doing so. This is similar to--dry-run, except that it doesn't read any files; it only processes filesystem metadata.
This is significantly faster than a regular --dry-run, but it is still suitable for checking which filesystem entries will be archived (with -v), or getting the total uncompressed archive size (via --totals or --progress-bytes).
This option cannot be used with --print-stats.
--dump-configโ Print out the command-line and all non-blank lines read from config files.--excludepattern โ (c, x, and t modes only) Do not process files or directories that match the specified pattern. Note that exclusions take precedence over patterns or filenames specified on the command line.-farchive-name โ (c, d, x, t, r, list-archives, and print-stats modes only) Operate on the archive archive-name. In modec, if archive creation is interrupted by^Q, theSIGQUITsignal, or reaching the bandwidth limit specified via a--maxbwoption, the archive will be stored with.partappended to its name. In modeprint-stats, if archive-name is*, statistics will be printed for every archive. In theprint-statsanddmodes,-f archive-namecan be specified multiple times, in which case the operation (printing statistics, or deletion) will be performed for each of the specified archives.
Note that each archive created must have a different name; consequently many users find it useful to include timestamps in archive names when repeatedly creating archives from the same files/directories (e.g., daily backups).
As a special case, if used with --list-archives --hashes then -f indicates a tapehash instead of an archive-name, and will print metadata about the specified archive(s). This combination of options is intended for the GUI and is not needed for command-line usage. (-f cannot be used with --list-archives if it does not also include --hashes.)
--force-resourcesโ bestie, this one lets the decryption of a passphrase-encrypted key file keep going even when itโs expected to eat a whole lot of memory or CPU time. Like, itโs gonna be a lot, but youโre forcing it anyway. ๐-Hโ (c mode only) symlinks named right on the command line get followed; the target of the link is what gets archived, not the link itself. Slay for following the vibe.-hโ (c mode only) literally just a synonym for-L. Same energy.--hashesโ (list-archives mode only) prints hashes of archive names. If you specify-vone or more times, it also prints the archive name. This is for the GUI, and ngl you donโt need it for command-line usage. ๐ซถ--humanize-numbersโ uses SI prefixes to make the numbers printed by--print-statsandSIGINFOmore readable. Cute little numbers, no cap.-Iโ synonym for-T. iconic shortcut behavior.--includepattern โ (c, x, and t modes only) process only files or directories that match the specified pattern. Important: exclusions specified with--excludetake precedence over inclusions. If no inclusions are explicitly specified, all entries are processed by default. The--includeoption is especially useful when filtering archives. For example, this command
tarsnap -c -f foo-backup --include='*foo*' @@all-backup
creates a new archive foo-backup containing only the entries from all-backup containing the string โfooโ. Obsessed with a filtered archive moment.
--insane-filesystemsโ (c mode only) allows descent into synthetic filesystems such asprocfs. Normally archiving those filesystems is a silly thing to do, hence the name. Itโs giving โweโre doing it anywayโ energy. ๐ญ--iso-datesโ (t mode only) prints file and directory dates asyyyy-mm-dd hh:mm:ss. The default is to use the same format asls -l: if the files were modified within the past six months, print the month, day, hour, and minutes; otherwise, print the month, day, and year. Date formatting but make it ISO.-kโ (x mode only) do not overwrite existing files. Specifically, if a file appears more than once in an archive, later copies will not overwrite earlier copies. Respecting the existing files fr fr.--keep-goingโ (d and print-stats modes only) keep deleting or printing statistics after finding that one of the archives specified does not exist. No rage-quitting the whole run over one missing archive. ๐ซถ--keep-newer-filesโ (x mode only) do not overwrite existing files that are newer than the versions appearing in the archive being extracted. Protect the newer files, periodt.--keyfilekey-file โ (all modes) obtain encryption, authentication, and access keys from key-file. This file should have been generated bytarsnap-keygen(1). Key file is the main character here.-Lโ (c mode only) all symbolic links will be followed. Normally, symbolic links are archived as such. With this option, the target of the link will be archived instead. Follow the link, bestie.-lโ synonym for the--check-linksoption. Just a little alias moment.--lowmemโ (c mode only) reduces memory usage by not caching small files. This may be useful when backing up files of average size less than1 MBif the available RAM in kilobytes is less than the number of files being backed up. Low memory, high vibes.-mโ (x mode only) do not extract modification time. By default, the modification time is set to the time stored in the archive. So-mis like โleave the mtime alone.โ--maxbwnumbytes โ (c mode only) interrupt archival if more than numbytes bytes of upstream bandwidth is used (seeINTERRUPTING ARCHIVALbelow for details). Bandwidth limit with a dramatic exit.--maxbw-ratebytespersecond โ limit download and upload bandwidth used to bytespersecond bytes per second. Both directions get the cap. โจ--maxbw-rate-downbytespersecond โ limit download bandwidth used to bytespersecond bytes per second. Down only, bestie.--maxbw-rate-upbytespersecond โ limit upload bandwidth used to bytespersecond bytes per second. Up only, no cap on the down.-nโ (c mode only) do not recursively archive the contents of directories. Just the directory itself, not the whole tree. Shallow but on purpose.--newerdate โ (c, x, t modes only) only include files and directories newer than the specified date. This comparesctimeentries. Newer-than filter, ctime edition. ๐ฐ๏ธ--newer-mtimedate โ (c mode only) like--newer, except it comparesmtimeentries instead ofctimeentries. Same idea, mtime flavor.--newer-thanfilename โ (c mode only) only include files and directories newer than the specified file. This comparesctimeentries. Compare against a file instead of a date, ctime style.--newer-mtime-thanfilename โ (c mode only) like--newer-than, except it comparesmtimeentries instead ofctimeentries. File comparison, mtime edition.--no-aggressive-networkingโ ignore anyaggressive-networkingoption specified in a configuration file. Config said aggressive, command line said no thanks. ๐--no-config-excludeโ ignore anyexcludeoption specified in a configuration file. Normally exclude options specified via configuration files and the command line all take effect. This one just tells the config excludes to chill.--no-config-includeโ ignore anyincludeoption specified in a configuration file. Normally include options specified via configuration files and the command line all take effect. Config includes? Not today.--no-default-configโ do not read the default configuration files/etc/tarsnap/tarsnap.conf,$XDG_CONFIG_HOME/tarsnap/tarsnap.conf, and~/.tarsnaprc. No default config, no extra opinions.--no-disk-pauseโ ignore anydisk-pauseoption specified in a configuration file. The disk-pause vibe has been cancelled.--no-force-resourcesโ ignore anyforce-resourcesoption specified in a configuration file. No forcing from the config.--no-humanize-numbersโ ignore anyhumanize-numbersoption specified in a configuration file. Numbers stay un-humanized if config tried it.--no-insane-filesystemsโ ignore anyinsane-filesystemsoption specified in a configuration file. The config cannot make the filesystems insane on your behalf. ๐ญ--no-iso-datesโ ignore anyiso-datesoption specified in a configuration file. The configโs ISO date agenda is ignored.--no-maxbwโ ignore anymaxbwoption specified in a configuration file. Config bandwidth cap? Not necessarily.--no-maxbw-rate-downโ ignore anymaxbw-rate-downoption specified in a configuration file. If amaxbw-rateoption is specified in a configuration file, it will not affect the download bandwidth used, but may affect the upload bandwidth used (unless--no-maxbw-rate-upis also specified). Careful with the cross-effects, bestie. ๐ซถ--no-maxbw-rate-upโ ignore anymaxbw-rate-upoption specified in a configuration file. If amaxbw-rateoption is specified in a configuration file, it will not affect the upload bandwidth used, but may affect the download bandwidth used (unless--no-maxbw-rate-downis also specified). Same energy, opposite direction.--no-noatimeโ ignore anynoatimeoption specified in a configuration file. Config noatime? Ignored.--no-nodumpโ ignore anynodumpoption specified in a configuration file. Config nodump? Ignored.--no-print-statsโ ignore anyprint-statsoption specified in a configuration file. No stats from config, thank you.--no-progress-bytesโ ignore anyprogress-bytesoption specified in a configuration file. Progress bytes from config? Nope.--no-quietโ ignore anyquietoption specified in a configuration file. Config tried to be quiet; you said no.--no-retry-foreverโ ignore anyretry-foreveroption specified in a configuration file. Forever-retry vibe from config gets dismissed.--no-snaptimeโ ignore anysnaptimeoption specified in a configuration file. Config snaptime? Ignored.--no-store-atimeโ ignore anystore-atimeoption specified in a configuration file. Config atime storage? Also ignored.--no-totalsโ ignore anytotalsoption specified in a configuration file. The config cannot force totals on you.--noatimeโ (c mode only) ask the operating system to not update theatimewhen reading files or directories. Not supported by all operating systems and filesystems. When it works, itโs a little time-saver; when it doesnโt, itโs not supported. ๐คท--nodumpโ (c mode only) honor thenodumpfile flag by skipping this file or directory. If the file says nodump, we skip it. Respect.--noisy-warningsโ be verbose when warning about network glitches. This is probably only useful for debugging purposes. Loud warnings, debugging bestie energy.--normalmemโ ignore anylowmemorverylowmemoption specified in a configuration file. Going back to normal memory behavior, no matter what the config wanted.--nullโ (use with-I,-T, or-X) synonym for--null-input. Kept for historical reasons and compatibility with other tar utilities. A legacy icon. ๐--null-inputโ (use with-I,-T, or-X) filenames, archive names, and patterns are separated by null characters, not by newlines. This is often used to read filenames output by the-print0option tofind(1). Null-separated input, super handy withfind -print0. โจ--null-outputโ (x, t, list-archives, and print-stats modes only) archive names, filenames, and lines in output are separated by null characters, not by newlines. If there are multiple fields on a line, they will be separated by two null characters. If a command line is printed within one of those fields, each argument will be separated by three null characters. Null-separated output with very specific null counts โ keep them exact, bestie.--numeric-ownerโ (x mode only) ignore symbolic user and group names when restoring archives to disk; only numericuidandgidvalues will be obeyed. Numbers only, no names.-Oโ (x and t modes only) in extract (-x) mode, files will be written to standard out rather than being extracted to disk. In list (-t) mode, the file listing will be written tostderrrather than the usualstdout. Output redirection but make it iconic.-oโ (x mode only) use the user and group of the user running the program rather than those specified in the archive. Note that this has no significance unless-pis specified, and the program is being run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner information in the archive will be discarded. Important caveat, not me forgetting it. ๐ซถ--one-file-systemโ (c mode only) do not cross mount points. Stay on this filesystem, bestie.-Pโ (c, x, and t modes only) preserve pathnames. By default, absolute pathnames (those that begin with a/character) have the leading slash removed both when creating archives and extracting from them. Also, tarsnap will refuse to extract archive entries whose pathnames contain..or whose target directory would be altered by a symlink. This option suppresses these behaviors. Big safety behavior;-Pturns it off. Be careful, no cap.-pโ (x mode only) preserve file permissions. Attempt to restore the full permissions, including owner, file modes, file flags and ACLs, if available, for each item extracted from the archive. By default, newly-created files are owned by the user running tarsnap, the file mode is restored for newly-created regular files, and all other types of entries receive default permissions. If tarsnap is being run by root, the default is to restore the owner unless the-ooption is also specified. Permission preservation with all the details intact.--passphrasemethod:arg โ read the passphrase using the specified method. Passphrase method selected, periodt.dev:tty-stdinโ tries to read your passphrase from/dev/tty, and if that's a no-go, it falls back to stdin. Lowkey this is the default behaviour, so it's probably what you're already getting. ๐dev:stdin-onceโ reads the passphrase from stdin, and does it only once even when you're encrypting. Heads up tho: you can't use this ifinfileis also stdin (aka-). ๐ซถdev:tty-onceโ reads the passphrase from/dev/tty, and again, only once even when encrypting. โจenv:VARโ reads the passphrase from the environment variable named byVAR.
โ ๏ธ Storing a passphrase in an environment variable may be a security risk. Only use this option if you are certain that you know what you are doing. Like, actually certain bestie ๐ญ
file:FILENAMEโ reads the passphrase from the file specified byFILENAME.
โ ๏ธ Storing a passphrase in a file may be a security risk. Only use this option if you are certain that you know what you are doing. (Same energy, same warning, no cap.) ๐
--print-statsโ (canddmodes only) prints statistics for the archive being created (cmode) or deleted (dmode). Wanna know what the output even looks like? Check out "PRINTING ARCHIVE STATISTICS" below, it's all laid out there. ๐--progress-bytes Xโ shows a progress message every timeXbytes get processed โ same vibe as the one you'd get fromSIGUSR1orSIGINFO. It happens at most once per file. โจ-q,--fast-readโ (xandtmodes only) extracts or lists only the first archive entry that matches each pattern or filename operand, then dips out as soon as every specified pattern or filename has been matched. By default tarsnap always reads the archive all the way to the very end, because there can be multiple entries with the same name and, by convention, later entries overwrite earlier ones. This one's literally just a performance optimization, iykyk ๐โโ๏ธ๐จ--quietโ skips printing some warnings. Right now the ones this silences are"Removing leading '/' ...","Not adding cache directory to archive","... file may have grown while being archived", and"Skipping entry on filesystem of type ..."โ but it's likely that other warnings will get silenced by this option in future versions of tarsnap. So like, don't be shocked if the list grows ๐ซฃ--resume-extractโ (xmode only) doesn't extract files whose filesize and mtime match files that already exist on disk. Mainly used to resume an archive extraction that got interrupted (annoying ๐ค). The mtime comparison ignores sub-second timestamp precision, since not all filesystems support that. This differs from-kin that--resume-extractwill overwrite a file if the size or modification time don't match โ which can happen if tarsnap gets killed partway through extracting a file. ๐--retry-foreverโ makes tarsnap keep trying to reconnect to the tarsnap server forever, instead of giving up after 5-10 minutes. Super useful for people with excessively flaky networks, or on mobile devices that regularly lose their internet connections for extended periods of time. It's not enabled by default since continued failures generally indicate a problem which should be investigated by the user โ so like, it's a choice, not a fix ๐โจ-Sโ (xmode only) extracts files as sparse files. For every block on disk, it checks first if it contains any non-NULL bytes and seeks over it otherwise. Works similar to theconv=sparseoption ofdd. Iconic efficiency behaviour honestly ๐ฆ-s patternโ modifies file or archive member names according topattern. The pattern has the format/old/new/[gps]. Here's the breakdown, bestie:oldis a basic regular expression.- If it doesn't apply, the pattern is skipped.
newis the replacement string of the matched part.~is substituted with the match, and\1to\9with the contents of the corresponding captured group.- The optional trailing
gspecifies that matching should continue after the matched part and stop on the first unmatched pattern. - The optional trailing
sspecifies that the pattern applies to the value of symbolic links. - The optional trailing
pspecifies that after a successful substitution the original path name and the new path name should be printed to standard error. ๐
--snaptime filenameโ (cmode only) this option MUST be specified when creating a backup from a filesystem snapshot, andfilenamemust have a modification time prior to when the filesystem snapshot was created. (This is necessary to prevent races between file modification and snapshot creation which could result in tarsnap failing to recognize that a file has been modified.) Like, it's not optional, it's a must-must. ๐ฅ--store-atimeโ (cmode only) enables the storing of file access times. The default behaviour of tarsnap is to not store file access times, since this can cause a significant amount of bandwidth and storage to be wasted when the same set of files are archived several times (e.g., if daily backup archives are created) โ because tarsnap itself accesses files and thereby causes their access times to be changed. Basically it'd be tarsnap snitching on itself ๐ญ--strip-components countโ (xmode only) removes the specified number of leading path elements. Pathnames with fewer elements will be silently skipped (no drama, just quietly ignored ๐ซถ). Note that the pathname is edited after checking inclusion/exclusion patterns but before security checks. Order matters, bestie.-T filenameโ (c,x, andtmodes only) inxortmode, tarsnap will read the list of names to be extracted fromfilename. Incmode, tarsnap will read names to be archived fromfilename. The special nameโ-Cโon a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by newlines unless--null-inputis specified. Note that--null-inputalso disables the special handling of lines containingโ-Cโ. Iffilenameisโ-โthen the list of names will be read from the standard input. ๐
๐ก Note: If you are generating lists of files usingfind(1), you probably want to use-nas well. Trust, you'll want it.
--totalsโ (cmode only) prints the size of the archive after creating it. This option is provided mainly for compatibility with GNU tar; in most situations the--print-statsoption will be far more useful. So like, it's giving legacy support ๐ธ-Uโ (xmode only) unlinks files before creating them. Without this option, tarsnap overwrites existing files, which preserves existing hardlinks. With this option, existing hardlinks will be broken, as will any symlink that would affect the location of an extracted file. So yeah,-Uis the "break the links" girlie ๐-vโ (c,d,t,x, andlist-archivesmodes only) produces verbose output. In create and extract modes, tarsnap will list each file name as it is read from or written to the archive. In delete mode, tarsnap will list the name of each archive as it is deleted. In list mode, tarsnap will produce output similar to that ofls(1). Additional-voptions will provide additional detail. Stack 'em up for maximum tea โโจ--verify-configโ checks the configuration file(s) for syntactic errors. A little vibe check for your config ๐ง--versionโ prints the version number of tarsnap, and exits. Short, sweet, slays ๐--verylowmemโ (cmode only) reduces memory usage by approximately a factor of 2 beyond the memory usage when--lowmemis specified, by not caching anything. For when your machine is struggling ๐ญ-wโ (candxmodes only) asks for confirmation for every action. Yes, every single one. Very "are you sure?" of it ๐-X filenameโ (c,x, andtmodes only) reads a list of exclusion patterns from the specified file. See--excludefor more information about the handling of exclusions. ๐
๐จ SIGNALS ๐จ
tarsnap handles the following signals โ here's the whole lineup, bestie:
๐ซ SIGUSR1 & SIGINFO
On receipt of the SIGUSR1 signal or (on platforms where it exists) the SIGINFO signal, tarsnap prints the current file or directory being processed, and (for files) its progress within the file. It also prints the number of files and the number of uncompressed bytes processed. โจ
โ ๏ธ Note that due to network buffering the file position will not align precisely with how much data has been sent to or received from the tarsnap server. So like, don't @ me if the numbers are a little off ๐
๐ด SIGSTOP & SIGTSTP
On receipt of a SIGSTOP or SIGTSTP signal, the kernel will suspend the tarsnap process. Upon receiving a SIGCONT signal, tarsnap will reconnect to the server (if necessary) and continue the specified task. It's giving "nap time then back to business" ๐โก๏ธ๐
๐ SIGUSR2
On receipt of the SIGUSR2 signal, if tarsnap is creating an archive (mode c), it will create a checkpoint at the current position. Little save point, love that for you ๐
๐ SIGQUIT
On receipt of the SIGQUIT signal, if tarsnap is creating an archive (mode c) it will truncate the archive at the current position and exit (see "INTERRUPTING ARCHIVAL" below). Like, it actually stops โ so know what you're doing before you send it ๐ค
๐ PRINTING ARCHIVE STATISTICS ๐
okay so there are literally four commands that print stats about archives, and they're all serving different vibes:
- Global statistics, that's it:
tarsnap --print-stats - Global statistics plus info about specific archive(s):
tarsnap --print-stats -f archive-name1 [-f ...] - Global statistics plus info about all the archives:
tarsnap --print-stats -f '*' - Global statistics plus info about the archive(s) you just created or deleted:
tarsnap -c --print-stats -f archive-name DIRโ and โtarsnap -d --print-stats -f archive-name1 [-f ...]
tarsnap will print a table that looks like this, bestie:
Total size Compressed size
All archives 104491640436 51510524844
(unique data) 14830618089 7733620463
This archive 808723344 289077325
New data 17858641 5658308
So in this example, the combined size of every archive tarsnap has stored using the same keys is 104 GB, and combined post-compression that would be 51 GB โ but after the duplicate blocks get yeeted, there's only 14.8 GB left, which compresses down to 7.7 GB. (And it's that 7.7 GB that actually lives on the Tarsnap service, so that's the amount you're paying for, periodt.) The newly created archive is 808 MB (compressible to 289 MB), but only 17.8 MB of that is actually new data, and after compression only 5.6 MB gets uploaded to the Tarsnap server. efficient queen ๐
When tarsnap --print-stats is executed as a command, the table goes to the standard output. But when the --print-stats option is used while you're creating or deleting archives, the table is printed to the standard error device instead. different stage, same star โจ
Global statistics are calculated based on the current cache directory โ no keyfile needed, no querying the Tarsnap servers. it just knows. ๐ฎ
โ INTERRUPTING ARCHIVAL โ
Upon receipt of the SIGQUIT signal or Ctrl+Q, or if the bandwidth limit specified via a --maxbw option is reached, tarsnap will interrupt the creation of an archive and truncate it at the current position. When an archive is truncated, it gets named according to the user-specified name plus ".part" โ that suffix is literally there to denote the fact that it's incomplete. Such a truncated archive may be useful in its own right, but it also has the benefit that future attempts to archive the same data will be faster and use less bandwidth. sad for the archive, iconic for your future self ๐ซถ
๐ฅ FIREWALLS ๐ฅ
tarsnap communicates with the tarsnap server via a TCP connection to port 9279; in some environments it may be necessary to add a firewall rule to allow outgoing TCP connections to this port. At the present time (July 2009) there is only one IP address in use for the tarsnap server, so network administrators may wish to hard-code that IP address โ however, it is likely that at some point in the future that IP address will change and/or other IP addresses will be added. so don't get too attached to it, ngl ๐
๐ฟ ENVIRONMENT ๐ฟ
The following environment variables affect the execution of tarsnap:
LANGโ the locale to use. Seeenviron(7)for more information.TZโ the timezone to use when displaying dates. Seeenviron(7)for more information.
๐ FILES ๐
/etc/tarsnap/tarsnap.confโ the system global tarsnap configuration file. Parameters specified here only take effect if they are not specified via the current user's local configuration file or via the command line. hierarchy, bestie ๐$XDG_CONFIG_HOME/tarsnap/tarsnap.confโ a tarsnap configuration file for the current user. If the environment variableXDG_CONFIG_HOMEis empty, the default value of~/.config/tarsnap/tarsnap.confwill be used. Parameters specified here take effect unless they are specified via~/.tarsnaprcor the command line.~/.tarsnaprcโ another location for the tarsnap configuration file for the current user. Parameters specified here take effect unless they are specified via the command line. the classic, the original, the moment ๐
๐ฌ EXIT STATUS ๐ฌ
The tarsnap utility exits 0 on success, and >0 if an error occurs.
An exit code of 2 indicates that an error has occurred and the server-side state was modified. so like, it broke but it also changed stuff on the server โ read that number carefully ๐ด
๐ซ EXAMPLES ๐ซ
Register with the server and generate keys:
tarsnap-keygen --keyfile /usr/tarsnap.key --user me@example.com
--machine myserver
Perform a backup of /usr/home and /other/stuff/to/backup:
tarsnap --keyfile /usr/tarsnap.key --cachedir /usr/tarsnap-cache
-c -f backup-2008-04-24 /usr/home /other/stuff/to/backup
Perform another backup, a day later; this is much faster since tarsnap will avoid storing data which was previously stored:
tarsnap --keyfile /usr/tarsnap.key --cachedir /usr/tarsnap-cache
-c -f backup-2008-04-25 /usr/home /other/stuff/to/backup
List the archives:
tarsnap --keyfile /usr/tarsnap.key --list-archives
Delete the first backup, leaving the second backup intact:
tarsnap --keyfile /usr/tarsnap.key --cachedir /usr/tarsnap-cache
-d -f backup-2008-04-24
List the files in the remaining backup:
tarsnap --keyfile /usr/tarsnap.key -tv -f backup-2008-04-25
Restore two users' home directories from the backup:
tarsnap --keyfile /usr/tarsnap.key -x -f backup-2008-04-25
usr/home/auser usr/home/anotheruser
In /etc/crontab to create a backup of the entire system at 10:32 each day:
32 10 * * * root tarsnap --keyfile /usr/tarsnap.key --cachedir
/usr/tarsnap-cache -c -f backup-`date +\%Y\%m\%d` /
Note that the --keyfile and --cachedir options can be specified via the tarsnap.conf(5) configuration file, in which case they may be omitted from the command line. your crontab stays clean, your backups stay cute ๐ธ
๐ก๏ธ SECURITY ๐ก๏ธ
Certain security issues are common to many archiving programs, including tarsnap. In particular, carefully-crafted archives can request that tarsnap extract files to locations outside of the target directory. This can potentially be used to cause unwitting users to overwrite files they did not intend to overwrite. And if the archive is being extracted by the superuser, literally any file on the system can potentially be overwritten. ๐ญ There are three ways this can happen. Although tarsnap has mechanisms to protect against each one, savvy users should be aware of the implications:
- Archive entries can have absolute pathnames. By default,
tarsnapremoves the leading/character from filenames before restoring them to guard against this problem. - Archive entries can have pathnames that include
..components. By default,tarsnapwill not extract files containing..components in their pathname. - Archive entries can exploit symbolic links to restore files to other directories. An archive can restore a symbolic link to another directory, then use that link to restore a file into that directory. To guard against this,
tarsnapchecks each extracted path for symlinks. If the final path element is a symlink, it will be removed and replaced with the archive entry. If-Uis specified, any intermediate symlink will also be unconditionally removed. If neither-Unor-Pis specified,tarsnapwill refuse to extract the entry. the audacity ๐
Although tarsnap cryptographically signs archives in such a manner that it is believed to be unfeasible for an attacker to forge an archive without having possession of key-file, you may wish to examine the contents of archive(s) with
tarsnap -t --keyfile key-file -f archive-name
before extraction. Note that the -P option to tarsnap disables the security checks above and allows you to extract an archive while preserving any absolute pathnames, .. components, or symlinks to other directories. so like, -P is that girl but she plays fast and loose, yk? โ ๏ธ
๐ SEE ALSO ๐
tarsnap-keygen(1), tar(5), tarsnap.conf(5)
๐ HISTORY ๐
A tar command appeared in Seventh Edition Unix, which was released in January, 1979. There have been numerous other implementations, many of which extended the file format. John Gilmore's pdtar public-domain implementation (circa November, 1987) was quite influential, and formed the basis of GNU tar. GNU tar was included as the standard system tar in FreeBSD beginning with FreeBSD 1.0, but was replaced by Tim Kientzle's bsdtar utility and libarchive(3) library in FreeBSD 5.3.
tarsnap is built around bsdtar and libarchive(3). ancestry reveal, honestly ๐งฌโจ
๐ BUGS ๐
- This program follows ISO/IEC 9945-1:1996 (โPOSIX.1โ) for the definition of the
-loption totar(5). Note that GNU tar prior to version 1.15 treated-las a synonym for the--one-file-systemoption. - To archive a file called
@foo,@@foo, or-fooyou must specify it as./@foo,./@@foo, or./-foo, respectively. - In create mode, a leading
./is always removed. A leading/is stripped unless the-Poption is specified. - Hard link information may be lost if an archive file which is included via the
@archive-fileoption is in a non-"tar" format. (This is a consequence of the incompatible ways that different archive formats store hardlink information.) - There are alternative long options for many of the short options that are deliberately not documented. secret menu, no cap ๐คซ
- The limit specified by a
--maxbwoption is not strictly enforced; in particular, due to the need to cleanly terminate an archive, the amount of bandwidth used may slightly exceed the limit. - If
tarsnapis run with standard input, standard output, and standard error redirected and inside a chroot where terminal devices are not exposed, Ctrl+Q will not be mapped toSIGQUITand will consequently not trigger the truncation of the current archive.
and that's the whole page, bestie! ๐ this one's from the Debian fam, dated March 20, 2025 โ go forth and back up responsibly, mwah ๐๐ฆ
๐ฆ where this page comes from
- arch rolling: tarsnap 1.0.41-1 ยท custom
- Copyright 2007-2025 Tarsnap Backup Inc
- Copyright (c) 2003-2007 Tim Kientzle
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms