STOREBACKUP(1)
โจ STOREBACKUP(1) โจ
the User Contributed Perl Documentation girlies know ๐ซถ
okay so bestie, gather round, because we are about to talk about a script that is genuinely iconic and I need you to be seated for it ๐
๐ NAME ๐
storeBackup.pl โ it's literally a fancy compressing, managing, checksumming, hard-linking, deduplicating cp -ua โจ no cap, that's the whole vibe.
๐ธ DESCRIPTION ๐ธ
okay so here's the tea. This program copies trees to another location. Every single file it copies is potentially compressed (peep --exceptSuffix for the deets ๐).
The backups after the first backup will compare the files with an md5 checksum against the last stored version. If they're equal, it literally just makes a hard link to it. That's it. That's the whole flex. ๐ฅ
It will also check mtime, ctime and size to recognize identical files in older backups very fast โ like, speedrun fast, no thoughts head empty fast ๐
And get this: it can also backup big image files fast and efficiently on a per block basis (that's data deduplication, bestie, iykyk ๐).
Also you can overwrite options in the configuration file on the command line. Main character energy honestly.
โจ 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 ...]
(and yes bestie, I know that kdey in there looks like a typo. I am reporting, not fixing. It's not my job. She stays. ๐)
๐ OPTIONS ๐
okay this is the long part, grab a snack ๐
--helpโ show this help ๐ซถ--generate,-gโ generate a template of the configuration file โจ like, auto-magic setup, we love her--checkCompr,-Cโ check compression for all files bigger than1kto check if it makes sense to compress them ๐ overwrites options:exceptSuffixaddExceptSuffixminCompressSizecomprRule
--printโ print configuration read from configuration file or command line, and then stop ๐ she said that's enough--file,-fโ configuration file (instead of, or additionally to, options on the command line)--sourceDir,-sโ source directory (must exist ๐ no imaginary dirs on her watch)--backupDir,-bโ top level directory of all backups (also must exist, she does not create it for you bestie)--series,-Sโ series directory, default is'default'โจ it's a relative path frombackupDirbtw--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๐
heads up bestie: this type of lock file does not work across multiple servers, and it is not designed to separatestoreBackup.plandstoreBackupUpdateBackup.plor any otherstoreBackupprocess in a separate PID space. like, she is doing her best but she is not doing that.
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 backug up โ likeexceptRule(yes bestie, "backug". she said what she said, and what she said stays ๐ ) see README:'including / excluding files and directories'--writeExcludeLogโ write a file name.storeBackup.notSaved.bz2with the names of all skipped files ๐ byeee to those files, hello to receipts--exceptTypesโ do not save the specified type of files, allowed:Sbcfpl๐Sโ 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 filesSโ 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๐ 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 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๐ก stay home bestie, no wandering--highLatencyโ use this for a very high latency line (eg. vpn over the internet) for better parallelization ๐ yes queen, optimize that sad connection--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 โ so it's fine, it's slay, don't panic--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'๐ she will be waiting you have to runstoreBackupUpdateBackup.pllater โ see description for that program ๐--lateCompressโ only does anything when you also pass--lateLinks, bestie. With this on, compressing files that are>=minCompressSizegets pushed to later, and the file is (temporarily) copied into the backup in the meantime. โจ--autorepair,-aโ fixes simple inconsistencies (the ones that come fromlateLinks) all by itself, no "hey bestie can I do this?" prompt. it's giving self-sufficient queen ๐--checkBlocksSuffixโ files with this suffix get an md5 check on blocks of that file fromstoreBackup. This one 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 you named with--checkBlocksSuffix. default is$checkBlocksBSdefault(that's1megabyte). ๐ธ--checkBlocksComprโ if you set it, the blocks made because ofcheckBlocksSuffixget compressed. default is'no'. set it to'check'and it tries to estimate whether compression actually helps. lowkey smart ๐ง--checkBlocksParallelโ reads the files you named here in parallel to the "normal" ones. heads up: this only makes sense if they live on a different disk. default value is'no'. ๐--queueBlockโ how long the queue is for storing files before block checking. default =$queueBlock. ๐--checkBlocksRule0โ the files thatstoreBackupwill do an md5 check on, decided based on blocks of that file. ๐--checkBlocksBS0โ block size for thecheckBlocksRuleoption. default is$checkBlocksBSdefault(that's1megabyte). โญ--checkBlocksCompr0โ if you set it, the blocks made because of this rule get compressed. ๐--checkBlocksRead0โ a filter for reading the file so it's treated as a blocked file. example:'gzip -d'if the file is compressed. default is no read filter. this parameter gets parsed just like a line in the configuration file, so normally you gotta quote it, e.g.'gzip -9'. โจ--checkBlocksParallel0โ reads the files you specified here in parallel to the "normal" ones. again: only makes sense on a different disk. default value is'no'. ๐ฆ--checkBlocksRule1,--checkBlocksBS1,--checkBlocksCompr1,--checkBlocksRead1,--checkBlocksParallel1โ literally the exact same set as the0versions above, just for rule1. ๐--checkBlocksRule2,--checkBlocksBS2,--checkBlocksCompr2,--checkBlocksRead2,--checkBlocksParallel2โ same deal, rule2. ๐ธ--checkBlocksRule3,--checkBlocksBS3,--checkBlocksCompr3,--checkBlocksRead3,--checkBlocksParallel3โ same deal, rule3. ๐--checkBlocksRule4,--checkBlocksBS4,--checkBlocksCompr4,--checkBlocksRead4,--checkBlocksParallel4โ same deal, rule4. that's the whole set, no cap ๐ซถ
--checkDevices0โ a list of devices to md5 check, based on blocks of those devices (thinkeg. /dev/sdboreg. /dev/sdb1). ๐--checkDevicesDir0โ the directory where the backup of the device gets stored. ๐--checkDevicesBS0โ block size for thecheckDevices0option. default is1M(1megabyte). โญ--checkDevicesCompr0โ compress the blocks that come out of thecheckDevices0option. possible values are'check','yes'or'no', default is'no'. ๐--checkDevicesParallel0โ read the devices you named in parallel to the rest of the backup. once more: only makes sense if they're on a different disk. default value is'no'. ๐--checkDevices1,--checkDevicesDir1,--checkDevicesBS1,--checkDevicesCompr1,--checkDevicesParallel1โ the0crew again, but wearing a1bracelet. ๐ฆ--checkDevices2,--checkDevicesDir2,--checkDevicesBS2,--checkDevicesCompr2,--checkDevicesParallel2โ same, number2. ๐--checkDevices3,--checkDevicesDir3,--checkDevicesBS3,--checkDevicesCompr3,--checkDevicesParallel3โ same, number3. โจ--checkDevices4,--checkDevicesDir4,--checkDevicesBS4,--checkDevicesCompr4,--checkDevicesParallel4โ same, number4. and that's all five slots bestie ๐ธ
--saveRAMโ writes the temporary dbm files into--tmpdirinstead. use this when you do not have enough RAM, like a true survivor ๐ญ--compress,-cโ the compress command (with its options). default is<bzip2>. this parameter gets parsed just like a line in the configuration file, so normally you have to quote it, e.g.'gzip -9'. ๐ฅ--uncompress,-uโ the uncompress command (with its options). default is<bzip2 -d>. same as above: parsed like a config file line, normally needs quotes, eg.'gzip -d'. ๐--postfix,-pโ the postfix to slap on after compression. default is<.bz2>. ๐--exceptSuffixโ do not compress files with the following suffix (uppercase included, periodt):'\.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 do not want any compression at all, set this option to'.*'. ๐ฆ--addExceptSuffixโ like--exceptSuffix, but it does not replace the defaults, it adds to them. ๐ซถ--compressSuffixโ like--exceptSuffix, except the files you mention here will be compressed. and heads up: if you pick this option, then files that aren't 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, just copied. no notes โญ--comprRuleโ an alternative to--exceptSuffix,compressSuffixandminCompressSize: you define a rule for which files will be compressed. ๐--noCompressโ the maximal number of parallel compress operations. default = chosen automatically. ๐--queueCompressโ length of the queue where files hang out before compression. default =1000. ๐--noCopyโ the maximal number of parallel copy operations. default =1. ๐ธ--queueCopyโ length of the queue where files hang out before being copied. default =1000. โจ--withUserGroupStatโ writes statistics about used space into the log file. ๐--userGroupStatFileโ writes statistics about used space into a name file โ and yes, it will be overridden each time. ๐--doNotCompressMD5Fileโ don't compress.md5CheckSumFile. ๐--chmodMD5Fileโ the permissions of.md5CheckSumFileand the corresponding.storeBackupLinksdirectory. default is0600. ๐ฅ
--verbose,-vโ verbose messages. she's chatty, we love her ๐ฃ๏ธ--debug,-dโ generates debug messages. levels are0(none, default),1(some),2(many) messages, especially in--exceptRuleand--includeRule. ๐--resetAtimeโ resets the access time in the source directory โ but plot twist, this will changectime(time of last modification of file status information). ๐ซข--doNotDeleteโ check only, do not delete any backup. ๐--deleteNotFinishedDirsโ deletes old backups which have not been finished. heads up: this will only happen ifdoNotDeleteis set. ๐--maxHardLinksโ maximum number of hard links to use.zero(default) means the limit depends on the file system used only. โญ--keepAllโ keeps backups which are not older than the specified amount of time. think of it like a default value for all days in--keepWeekday. deleting begins at the end of the script. the time range has to be specified in format'dhms', e.g.
10d4h
means 10 days and 4 hours. default = 20d. ๐
--keepWeekdayโ keeps backups for the specified days for the specified amount of time. overwrites the default values chosen in--keepAll.'Mon,Wed:40d Sat:60d10m'means:- keep backups from
MonandWed40days +5mins - keep backups from
Sat60days +10mins - keep backups from the rest of the days like specified in
--keepAll(default$keepAll)
- keep backups from
and if you also use the 'archive flag' it means to not delete the affected directories via --keepMaxNumber:
a10d4hmeans10days and4hours and'archive flag'
e.g. 'Mon,Wed:a40d5m Sat:60d10m' means:
- keep backups from
MonandWed40days +5mins +'archive' - keep backups from
Sat60days +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 istimePeriodwith possible'archive flag'. ๐--keepLastOfYearโ do not delete the last backup of a year. format istimePeriodwith possible'archive flag'. ๐--keepFirstOfMonthโ do not delete the first backup of a month. format istimePeriodwith possible'archive flag'. ๐--keepLastOfMonthโ do not delete the last backup of a month. format istimePeriodwith 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 istimePeriodwith possible'archive flag'. ๐--keepLastOfWeekโ do not delete the last backup of a week. format istimePeriodwith possible'archive flag'. ๐--keepDuplicateโ keep multiple backups of one day up totimePeriod. format istimePeriod, and nope,'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โ try to keep only that maximum of backups. if you have more backups than that, this is the sequence of deleting that happens:- delete all duplicates of a day, beginning with the old ones, except the last of every day
- if this is not enough, delete the rest of the backups beginning with the oldest, but *never* a backup with the
'archive flag'or the last backup ๐
--keepRelative,-Rโ the alternative deletion scheme, bestie. The second you turn this on, every other keep option is โจignoredโจ, fr fr, no exceptions. This one preserves your backups by their relative age. Watch:
-R '1d 7d 61d 92d'
...will (try to) make sure there's always:
- one backup that's between 1 day and 7 days old
- one backup that's between 5 days and ~2 months old
- one backup that's between ~2 months and ~3 months old
And if there's no backup for one of those timespans โ like the last backup happened more than 2 weeks ago โ then the next older backup gets used for that timespan instead. ๐ซถ
--progressReport,-Pโ prints a progress report after each number of files. You can also slap a time frame on there so a message gets printed after that much time too. So if you want a report every 1000 files and after one minute and 10 seconds, you go:-P 1000,1m10sโฑ๏ธ--printDepth,-Dโ prints the depth of the directory it's actually reading right now during the backup. yes it's as nosy as it sounds--ignoreReadErrorโ ignores read errors in the source directory, so directories that you can't read won't makestoreBackup.plstop doing its thing. ๐--suppressWarningโ suppresses the (unwanted) warnings in the log files. The keys you can use for this are:excDirโ suppresses the warning that excluded directories do not existfileChangeโ suppresses the warning that a file has changed during the backupcrSeriesโ suppresses the warning that storeBackup had to create thedefaultserieshashCollisionโ 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 the 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
psst: you can repeat this option multiple times on the command line.
--suppressInfoโ suppresses the (unwanted) infos in the log files. The keys for this one:readCheckSumsโ suppresses the information that checksums of blocked files are read
Also repeatable multiple times on the command line, ๐ same energy.
--linkToRecentโ after a successful backup, sets a symbolic link pointing to that backup, and deletes any existing older links with the same name. fresh link, who dis ๐--logFile,-lโ the log file (default isSTDOUT).--plusLogStdoutโ if you gave a log file with--logFile, this flag also prints the output toSTDOUTon top of that. Best of both worlds, honestly.--suppressTimeโ suppresses the output of time in the logfile. ๐ฐ๏ธ bye bye timestamps--maxFilelen,-mโ the maximal length of the log file, default1e6.--noOfOldFiles,-nโ how many old log files stick around, default5.--saveLogsโ saves log files with a date and time instead of deleting the old ones (the ones handled by [-noOfOldFiles]).--compressWithโ compresses the saved log files (like, say, withgzip -9). Default isbzip2. Heads up: this parameter gets parsed exactly like a line in the configuration file, so normally you have to quote it. quote it or perish ๐--logInBackupDirโ writes the log file (also) into the backup directory.
โ ๏ธ Be aware that this log does not contain all the error messages that the one you specified with --logFile has!
--compressLogInBackupDirโ compresses that log file in the backup directory. ๐๏ธ--logInBackupDirFileNameโ the filename to use when writing that log file from up above, default is.storeBackup.log.otherBackupSeriesโ a list of other backup series to consider for hard linking. The path is relative tobackupDir! The format looks like this (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 throw wildcards into series names ๐ โ check the documentation, section 'Using Wildcards for Replication', for the deets. Default is to link to the last backup in every series.
๐ 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 ๐
and that's a wrap on the whole page!! ๐ This one's riding with perl v5.40.1 and dated 2026-05-23. go forth and back up literally everything, you've got this ๐โจ๐ฆ
๐ฆ where this page comes from
- ubuntu stonking: storebackup 3.5.2-2 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms