STOREBACKUP(1)
πΈ STOREBACKUP(1) β storeBackup.pl π
okay bestie, so this is the manpage for the Perl script storeBackup.pl β filed under User Contributed Perl Documentation β and it's literally the most extra backup tool you'll ever meet. grab a strawberry drink π, we're going in.
β¨ NAME β¨
storeBackup.pl β a fancy compressing managing checksumming hard-linking deduplicating cp -ua π«Ά
like, it's cp -ua but it went to the gym, got a personality, and now remembers everything. iconic.
π¦ DESCRIPTION π¦
So the whole vibe: this program copies trees to another location. that's the assignment. π
Every file copied is potentially compressed (peep --exceptSuffix for the deets). and every backup after the very first one compares the files against the last stored version using an md5 checksum. if they match? slay, it just makes a hard link to it β no new copy, no wasted space. β¨
It will also check mtime, ctime and size to recognize identical files in older backups very fast β like, it clocks them instantly. π₯
And it can also backup big image files fast and efficiently on a per block basis (that's data deduplication, iykyk). π
Also very important bestie: you can overwrite options in the configuration file on the command line. yes. command line wins. periodt.
π SYNOPSIS π
storeBackup.pl --help
or
storeBackup.pl -g configFile
or
storeBackup.pl [-f configFile] [-s sourceDir]
[-b backupDirectory] [-S series] [--checkCompr] [--print]
[-T tmpdir] [-L lockFile] [--unlockBeforeDel]
[--exceptDirs dir1] [--contExceptDirsErr]
[--includeDirs dir1]
[--exceptRule rule] [--includeRule rule]
[--exceptTypes types]
[--specialTypeArchiver archiver [--archiveTypes types]]
[--cpIsGnu] [--linkSymlinks]
[--precommand job] [--postcommand job]
[--followLinks depth] [--stayInFileSystem] [--highLatency]
[--ignorePerms] [--lateLinks [--lateCompress]] [--autorepair]
[--checkBlocksSuffix suffix] [--checkBlocksMinSize size]
[--checkBlocksBS] [--checkBlocksCompr check|yes|no]
[--checkBlocksParallel] [--queueBlock]
[--checkBlocksRule0 rule [--checkBlocksBS0 size]
[--checkBlocksCompr0 key] [--checkBlocksRead0 filter]
[--checkBlocksParallel0]]
[--checkBlocksRule1 rule [--checkBlocksBS1 size]
[--checkBlocksCompr1 key] [--checkBlocksRead1 filter]
[--checkBlocksParallel1]]
[--checkBlocksRule2 rule [--checkBlocksBS2 size]
[--checkBlocksCompr2 kdey] [--checkBlocksRead2 filter]
[--checkBlocksParallel2]]
[--checkBlocksRule3 rule [--checkBlocksBS3 size]
[--checkBlocksCompr3 key] [--checkBlocksRead3 filter]
[--checkBlocksParallel3]]
[--checkBlocksRule4 rule [--checkBlocksBS4 size]
[--checkBlocksCompr4 key] [--checkBlocksRead4 filter]
[--checkBlocksParallel4]]
[--checkDevices0 list [--checkDevicesDir0]
[--checkDevicesBS0] [checkDevicesCompr0 key]
[--checkDevicesParallel0]]
[--checkDevices1 list [--checkDevicesDir1]
[--checkDevicesBS1] [checkDevicesCompr1 key]
[--checkDevicesParallel1]]
[--checkDevices2 list [--checkDevicesDir2]
[--checkDevicesBS2] [checkDevicesCompr2 key]
[--checkDevicesParallel2]]
[--checkDevices3 list [--checkDevicesDir3]
[--checkDevicesBS3] [checkDevicesCompr3 key]
[--checkDevicesParallel3]]
[--checkDevices4 list [--checkDevicesDir4]
[--checkDevicesBS4] [checkDevicesCompr4 key]
[--checkDevicesParallel1]]
[--saveRAM] [-c compress] [-u uncompress] [-p postfix]
[--noCompress number] [--queueCompress number]
[--noCopy number] [--queueCopy number]
[--withUserGroupStat] [--userGroupStatFile filename]
[--exceptSuffix suffixes] [--addExceptSuffix suffixes]
[--compressSuffix] [--minCompressSize size] [--comprRule]
[--doNotCompressMD5File] [--chmodMD5File] [-v]
[-d level] [--progressReport number[,timeframe]]
[--ignoreReadError] [--suppressInfo]
[--suppressWarning key] [--linkToRecent name]
[--doNotDelete] [--deleteNotFinishedDirs] [--maxHardLinks]
[--resetAtime] [--keepAll timePeriod] [--keepWeekday entry]
[[--keepFirstOfYear] [--keepLastOfYear]
[--keepFirstOfMonth] [--keepLastOfMonth]
[--firstDayOfWeek day] [--keepFirstOfWeek]
[--keepLastOfWeek] [--keepDuplicate] [--keepMinNumber]
[--keepMaxNumber]
| [--keepRelative] ]
[-l logFile
[--plusLogStdout] [--suppressTime] [-m maxFilelen]
[[-n noOfOldFiles] | [--saveLogs]]
[--compressWith compressprog]]
[--logInBackupDir [--compressLogInBackupDir]
[--logInBackupDirFileName logFile]]
[otherBackupSeries ...]
ngl that's a lot of brackets, but we're gonna get through every single one together, bestie. π«Ά
π OPTIONS π
okay so here's the full menu. no skipping, no summarizing β this is the whole thing, fr fr.
--helpβ show this help π--generate,-gβ generate a template of the configuration file β¨--checkCompr,-Cβ check compression for all files bigger than1kto check if it makes sense to compress them. heads up: this overwrites the optionsexceptSuffix,addExceptSuffix,minCompressSize,comprRuleπ--printβ print configuration read from configuration file or command line, and then stop. like, it just shows you what it read and peaces out. π--file,-fβ configuration file (instead of or additionally to options on the command line) π--sourceDir,-sβ source directory (must exist) π¦--backupDir,-bβ top level directory of all backups (must exist) π--series,-Sβ series directory, default is'default'. it's a relative path frombackupDirβ--tmpdir,-Tβ directory for temporary files, default is</tmp>π§--lockFile,-Lβ lock file. if it exists, new instances will finish if an old one is already running. default is$lockFile. okay so important caveat: this type of lock file does not work across multiple servers, and it's not designed to separatestoreBackup.plandstoreBackupUpdateBackup.plor any otherstoreBackupprocess in a separate PID space. also, default lock file for root is in/var/lock, for others in$HOMEπ--unlockBeforeDelβ remove the lock file before deleting old backups. default is to delete the lock file after removing old backups ποΈ--exceptDirs,-eβ directories to except from backing up (relative path). wildcards are possible and should be quoted to avoid replacements by the shell. use this parameter multiple times for multiple directories π«--contExceptDirsErrβ continue if one or more of the exceptional directories do not exist (default is to stop processing) π--includeDirs,-iβ directories to include in the backup (relative path). wildcards are possible and have to be quoted. use this parameter multiple times for multiple directories β--exceptRuleβ Files to exclude from backing up. see README:'including / excluding files and directories'π--includeRuleβ Files to include in the backup β likeexceptRule. see README:'including / excluding files and directories'π--writeExcludeLogβ write a file name.storeBackup.notSaved.bz2with the names of all skipped files π--exceptTypesβ do not save the specified type of files, allowed:SbcfplS- file is a socketb- file is a block special filec- file is a character special filef- file is a plain filep- file is a named pipel- file is a symbolic linkSbccan only be saved when using option[cpIsGnu]π
--archiveTypesβ save the specified type of files in an archive instead saving them directly in the file system. use this if you want to backup those file types but your target file or transport (eg.sshfsor non gnu-cp) system does not support those types of files π¦S- file is a socketb- file is a block special filec- file is a character special filep- file is a named pipe- you also have to set
--specialTypeArchiverwhen using this option β οΈ
--specialTypeArchiverβ possible values are'cpio'or'tar'. default is'cpio'.taris not able to archive sockets.cpiois not part of the actual posix standard any more π¬--cpIsGnuβ Activate this option if your system'scpis a full-featured GNU version. in this case you will be able to also backup several special file types like sockets π₯--linkSymlinksβ hard link identical symlinks π--precommandβ exec job before starting the backup, checkslockFile(-L) before starting (e.g. can be used forrsync). stops execution if job returns exit status!= 0. also, this parameter is parsed like a line in the configuration file and normally has to be quoted π¬--postcommandβ exec job after finishing the backup, but before erasing of old backups. reports if job returns exit status!= 0. this parameter is also parsed like a line in the configuration file and normally has to be quoted π¬--followLinksβ follow symbolic links like directories up to depth. default =0-> do not follow links πͺ’--stayInFileSystemβ only store the contents of file systems named by--sourceDirand symlinked via--followLinksπ--highLatencyβ use this for a very high latency line (eg. vpn over the internet) for better parallelization πβ‘οΈπ--ignorePermsβ If this option is selected, files will not necessarily have the same permissions and owner as the originals. this speeds up backups on network drives a lot. recovery withstoreBackupRecover.plwill restore them correctly π«Ά--lateLinksβ do not write hard links to existing files in the backup during the backup. you have to call the programstoreBackupWriteLateLink.pllater on your server if you set this flag to'yes'. you have to runstoreBackupUpdateBackup.pllater β see description for that program β³
and that's part 1, bestie β the rest is coming, don't go anywhere πβ¨
--lateCompressβ only does anything when you also pass--lateLinks. With this on, compression for files>= minCompressSizegets postponed to later β the file gets (temporarily) copied into the backup first, and the squeezing happens afterwards. β¨--autorepair,-aβ fixes simple inconsistencies (the ones coming fromlateLinks) all by itself, no questions asked, no "hey bestie can you click yes". It just handles it. π«Ά--checkBlocksSuffixβ files with this suffix get an md5 check on blocks of that file fromstoreBackup. Runs after--checkBlocksRule(n). You can repeat this option as many times as you want. π--checkBlocksMinSizeβ only bother checking the files named in--checkBlocksSuffixif their file size is at least this value. Default is100M.--checkBlocksBSβ block size for the files named in--checkBlocksSuffix. Default is$checkBlocksBSdefault(that's 1 megabyte, iconically).--checkBlocksComprβ if set, the blocks generated because ofcheckBlocksSuffixget compressed. Default is'no'. If you set it to'check', it tries to estimate whether compression actually helps. π--checkBlocksParallelβ reads the files named here in parallel with the "normal" ones. This only makes sense if they're on a different disk, fr. Default value is'no'.--queueBlockβ how long the queue is for storing files before block checking. Default =$queueBlock.
the numbered block-check rules (0 through 4, bestie, there are five of each) π¦
Here's how the set works β 0 gets the full explanation, and 1 through 4 are literally the same thing with a bigger number glued on:
--checkBlocksRule0β files for whichstoreBackupwill make an md5 check depending on blocks of that file.--checkBlocksBS0β block size for thecheckBlocksRuleoption. Default is$checkBlocksBSdefault(1 megabyte).--checkBlocksCompr0β if set, the blocks generated because of this rule get compressed.--checkBlocksRead0β a filter for reading the file, so it gets treated as a blocked file. e.g.'gzip -d'if the file is compressed. Default is no read filter. Heads up: this parameter is parsed like the line in the configuration file, so normally you have to quote it, e.g.'gzip -9'.--checkBlocksParallel0β reads the files named here in parallel with the "normal" ones. Only makes sense if they're on a different disk. Default value is'no'.
And then the rest of the squad, same energy, just different indices:
--checkBlocksRule1,--checkBlocksBS1,--checkBlocksCompr1,--checkBlocksRead1,--checkBlocksParallel1--checkBlocksRule2,--checkBlocksBS2,--checkBlocksCompr2,--checkBlocksRead2,--checkBlocksParallel2--checkBlocksRule3,--checkBlocksBS3,--checkBlocksCompr3,--checkBlocksRead3,--checkBlocksParallel3--checkBlocksRule4,--checkBlocksBS4,--checkBlocksCompr4,--checkBlocksRead4,--checkBlocksParallel4
device checks, aka md5-ing your actual disks π
--checkDevices0β list of devices to md5 check, depending on blocks of these devices (e.g./dev/sdbor/dev/sdb1).--checkDevicesDir0β the directory where the backup of the device gets stored.--checkDevicesBS0β block size of thecheckDevices0option. Default is1M(1 megabyte).--checkDevicesCompr0β compress the blocks resulting fromcheckDevices0. Possible values are'check','yes'or'no', default is'no'.--checkDevicesParallel0β read the devices named here in parallel to the rest of the backup. Only makes sense if they're on a different disk. Default value is'no'.
And the matching quartet, 1 through 4, exactly like above:
--checkDevices1,--checkDevicesDir1,--checkDevicesBS1,--checkDevicesCompr1,--checkDevicesParallel1--checkDevices2,--checkDevicesDir2,--checkDevicesBS2,--checkDevicesCompr2,--checkDevicesParallel2--checkDevices3,--checkDevicesDir3,--checkDevicesBS3,--checkDevicesCompr3,--checkDevicesParallel3--checkDevices4,--checkDevicesDir4,--checkDevicesBS4,--checkDevicesCompr4,--checkDevicesParallel4
--saveRAMβ writes the temporary dbm files into--tmpdir. Use this if you don't have enough RAM, no cap. π--compress,-cβ the compress command (with its options). Default is <bzip2>. This parameter is parsed like the line in the configuration file, so normally it has to be quoted, e.g.'gzip -9'.--uncompress,-uβ the uncompress command (with options). Default is <bzip2 -d>. Also parsed like a config file line, so quote it, e.g.'gzip -d'.--postfix,-pβ postfix tacked on after compression. Default is <.bz2>.--exceptSuffixβ nope, don't compress files with these suffixes (uppercase included, bestie β the case matters!). The defaults are:'\.zip''\.bz2''\.gz''\.tgz''\.jpg''\.gif''\.tiff?''\.mpeg''\.mpe?g''\.mpe?[34]''\.ogg''\.gpg''\.png''\.lzma''\.xz''\.mov'
You can repeat this option multiple times. And if you want no compression at all, just set this option to '.*' and watch the chaos unfold. π
--addExceptSuffixβ like--exceptSuffix, except it doesn't replace the defaults, it adds to them. Iconic behaviour, honestly.--compressSuffixβ like--exceptSuffix, but the files you mention here do get compressed. If you pick this option, then any files not touched byexceptSuffix,addExceptSuffixor these suffixes get rated by the rule functionCOMPRESSION_CHECKto decide whether to compress or not. π§--minCompressSizeβ files smaller than this size will never be compressed, they just get copied. Periodt.--comprRuleβ an alternative to--exceptSuffix,compressSuffixandminCompressSize: it's a definition of a rule for which files get compressed.--noCompressβ max number of parallel compress operations. Default = chosen automatically. β¨--queueCompressβ length of the queue to store files before compression. Default =1000.--noCopyβ max number of parallel copy operations. Default =1.--queueCopyβ length of the queue to store files before copying. Default =1000.--withUserGroupStatβ writes statistics about used space into the log file.--userGroupStatFileβ writes statistics about used space into name file. Heads up: this gets overridden every single time. π--doNotCompressMD5Fileβ do not compress.md5CheckSumFile.--chmodMD5Fileβ permissions of.md5CheckSumFileand the corresponding.storeBackupLinksdirectory. Default is0600.--verbose,-vβ verbose messages. She's chatty. π£οΈ--debug,-dβ generate debug messages. The levels are0(none, default),1(some) and2(many) messages, especially in--exceptRuleand--includeRule.--resetAtimeβ resets the access time in the source directory β but bestie, be aware this will changectime(time of last modification of file status information). Not a vibe if you're relying on that.--doNotDeleteβ check only, do not delete any backup. Look but don't touch. π--deleteNotFinishedDirsβ delete old backups which weren't finished. This only happens ifdoNotDeleteis set.--maxHardLinksβ maximum number of hard links to use. Zero (the default) means the limit depends on the file system you're using, and only that.
the retention saga, aka how long we keep the girlies πΈ
--keepAllβ keeps backups that aren't older than the amount of time you specify. It's basically a default value for all the days in--keepWeekday. Deletion begins at the end of the script. The time range has to be in'dhms'format, e.g.10d4hmeans 10 days and 4 hours. Default =20d.--keepWeekdayβ keeps backups for the specified days for the specified amount of time. It overwrites the default values chosen in--keepAll. So'Mon,Wed:40d Sat:60d10m'means:- keep backups from Mon and Wed 40days + 5mins
- keep backups from Sat 60days + 10mins
- keep backups from the rest of the days like specified in
--keepAll(default$keepAll)
And if you also use the 'archive flag', it means not deleting the affected directories via --keepMaxNumber. So a10d4h means 10 days and 4 hours and 'archive flag'. For example, 'Mon,Wed:a40d5m Sat:60d10m' means:
- keep backups from Mon and Wed 40days + 5mins + 'archive'
- keep backups from Sat 60days + 10mins
- keep backups from the rest of the days like specified in
--keepAll(default30d)
--keepFirstOfYearβ do not delete the first backup of a year. Format is timePeriod with a possible 'archive flag'. π--keepLastOfYearβ do not delete the last backup of a year. Format is timePeriod with a possible 'archive flag'.--keepFirstOfMonthβ do not delete the first backup of a month. Format is timePeriod with a possible 'archive flag'.--keepLastOfMonthβ do not delete the last backup of a month. Format is timePeriod with a possible 'archive flag'.--firstDayOfWeekβ default:'Sun'. This value is used for calculating--keepFirstOfWeekand--keepLastOfWeek. ποΈ--keepFirstOfWeekβ do not delete the first backup of a week. Format is timePeriod with a possible 'archive flag'.--keepLastOfWeekβ do not delete the last backup of a week. Format is timePeriod with a possible 'archive flag'.--keepDuplicateβ keeps multiple backups of one day up to timePeriod. Format is timePeriod, and 'archive flag' is not possible here. Default =7d.--keepMinNumberβ keep that minimum of backups. Multiple backups of one day are counted as one backup. Default is10.--keepMaxNumberβ tries to keep only that maximum of backups. If you have more backups than that, this exact deletion sequence happens:- delete all duplicates of a day, beginning with the old ones, except the last of every day
- if that's not enough, delete the rest of the backups beginning with the oldest β but never a backup with the 'archive flag', and never the last backup. π«Ά
--keepRelative,-Rβ this is the alternate deletion scheme, and the moment you use it, all the other keep options are ignored. It preserves backups based on their relative age, like this:
-R '1d 7d 61d 92d'
will (try to) make sure thereβs always:
- one backup between 1 day and 7 days old
- one backup between 5 days and ~2 months old
- one backup between ~2 months and ~3 months old
If thereβs no backup for a specified timespan (e.g. because the last backup was done more than 2 weeks ago), the next older backup gets used for that timespan. Lowkey clever, ngl.
--progressReport,-Pβ prints a progress report after each number of files. You can also add a time frame after which a message gets printed. If you want a report every 1000 files and after one minute and 10 seconds, use:-P 1000,1m10s. Obsessed with a progress update, fr.--printDepth,-Dβ prints the depth of the actual read directory during backup. Itβs giving βwatch me go deeperβ energy.--ignoreReadErrorβ tells it to ignore read errors in the source directory. Not-readable directories do not causestoreBackup.plto stop processing. Slay, resilience.--suppressWarningβ suppresses (unwanted) warnings in the log files. To suppress warnings, these keys are available:excDirβ suppresses the warning that excluded directories do not existfileChangeβ suppresses the warning that a file has changed during the backupcrSeriesβ suppresses the warning thatstoreBackuphad to create the'default'serieshashCollisionβ suppresses the warning if a possible hash collision is detectedfileNameWithLineFeedβ suppresses the warning if a filename contains a line feeduse_DB_Fileβ suppresses the warning that you should install perl moduleDB_Filefor better performanceuse_MLDBMβ suppresses the warning that you should install perl moduleMLDBMif you want to use rule functionsMARK_DIRorMARK_DIR_RECtogether with optionsaveRAMuse_IOCompressBzip2β suppresses the warning that you should install perl moduleIO::Compress::Bzip2for better performancenoBackupForPeriodβ suppresses the warning that there are no backups for certain periods when using optionkeepRelative
This option can be repeated multiple times on the command line. Periodt.
--suppressInfoβ suppresses (unwanted) infos in the log files. To suppress infos, these keys are available:readCheckSumsβ suppresses the information that checksums of blocked files are read
This option can be repeated multiple times on the command line. Cute and consistent.
--linkToRecentβ after a successful backup, sets a symbolic link to that backup and deletes existing older links with the same name. Main character link behavior, honestly.--logFile,-lβ the log file. Default isSTDOUT. Very βtell me everythingβ of it.--plusLogStdoutβ if you specify a log file with--logFile, you can also print the output toSTDOUTwith this flag. Double output, double vibe.--suppressTimeβ suppresses output of time in the logfile. No timestamps, no stress.--maxFilelen,-mβ maximal length of the log file, default =1e6. Keep it under control, bestie.--noOfOldFiles,-nβ number of old log files, default =5. A little log-file family.--saveLogsβ saves log files with date and time instead of deleting the old ones (with[-noOfOldFiles]). Archivists rise.--compressWithβ compresses saved log files (e.g. with'gzip -9'). Default is'bzip2'. This parameter is parsed like a line in the configuration file and normally has to be quoted. Very βread the room, quote itβ energy.--logInBackupDirβ writes the log file (also) in the backup directory.
Be aware that this log does not contain all error messages of the one specified with --logFile! Not me warning you affectionately π
--compressLogInBackupDirβ compresses the log file in the backup directory. Smaller log, same lore.--logInBackupDirFileNameβ filename to use for writing the above log file. Default is.storeBackup.log. Iconic hidden-file moment.otherBackupSeriesβ list of other backup series to consider for hard linking. Relative path frombackupDir! Format (examples):
backupSeries/2002.08.29_08.25.28 -> consider this backup
or
0:backupSeries ->last (youngest) in <backupDir>/backupSeries
1:backupSeries ->one before last in <backupDir>/backupSeries
n:backupSeries ->
n'th before last in <backupDir>/backupSeries
3-5:backupSeries ->
3rd, 4th and 5th in <backupDir>/backupSeries
all:backupSeries -> all in <backupDir>/backupSeries
You can also use wildcards in series names. See documentation, section 'Using Wildcards for Replication' for details. Default is to link to the last backup in every series. Fr fr, the linking possibilities are endless.
π COPYRIGHT π
Copyright (c) 2000-2022 by Heinz-Josef Claes (see README). Published under the GNU General Public License, either version 3 of the License, or (at your option) any later version. Respect the license, bestie π«Ά
This iconic page is STOREBACKUP(1) from perl v5.34.0, dated 2022-04-18 β go back up your fave files and stay hydrated π
β¨
π¦ where this page comes from
- nixos 26.05: store-backup 3.5.2
- nixpkgs unstable: storebackup 3.5.2
- opensuse-leap 16.0: storeBackup 3.5.2-bp160.1.9 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms