NAME

BASTRAMA - Backup Strategy Manager


SYNOPSIS

        bastrama.pl -n2 -k2 -l0 "backup*.gz"
        bastrama.pl -n2 -k2 -l0 --calc 1000


DESCRIPTION

The Backup Strategy Manager is a command-line tool to manage sets of backup files that are stored on random access memory (eg. hard drives). You could also call this ``Virtual Tape Rotation''. It implements an infinite grandfather-father-son strategy by deleting a defined subset of all backup files, therefore saving storage space.

Bastrama does so by numbering (adding [BASTRAMAnnnnn] suffix to the filename) all files that match the specified fileglob according to their modification date. Then some of the files are deleted (depending on the specified backup strategy). The oldest and the latest file will always be kept.

It is a good idea to play around with the --calc option to get a feeling about how Bastrama works prior to using it for backup file management.


ARGUMENTS & OPTIONS

Bastrama takes as argument one or more fileglobs, each fileglob describing files that are to be treated as one set of backup files. (Remember to quote the globs, so that they won't be expanded by the shell.)

Recommended options:

-n nnn
specifies the amount of children every element of the tree has. Default is 3. (Use --calc to see the effect.)

--keep nnn | -k nnn
specifies how many files are kept from each level of the tree. Must be equal or larger than n. Default is n. (Use --calc to see the effect.)

--levels nnn | -l nnn
specifies maximal depth of tree. A value of zero means infinite, which also is the default. (Use --calc to see the effect.)

Optional options:

--calc nnn | -c nnn
calculate which files would be deleted for given n, k and l and the amount of nnn files. No further action is taken.

--delete | -d
truely delete files. Default is not deleting, just adding .delete suffix to files.

--force | -f
force true file deletions even if Bastrama senses the possibility of trouble. (Use with care!)

--size | -s
minimal file size in bytes for Bastrama to accept a file as valid. If one or more files are detected as invalid, Bastrama drops to trouble mode, therefore not deleting any files except if --delete *and* --force is specified. Default minimal file size is 8192 bytes.

--help | -h
display help screen and exit.

--version | -V
display version number at startup.

--undelete | -u
remove the .delete suffix from files. (This is done before any other action.)


BACKUP STRATEGY

Bastrama by default uses a n=3, k=3, l=0 strategy. This is not very much more than a random pick and it by no means implies that this setting will suit your needs.

As said at other places, the --calc parameter is very useful to experiment with different setting of n, k and l.

Once you have chosen your settings, stick to them. Especially: DON'T CHANGE N AFTER YOU'VE BEEN USING BASTRAMA FOR SOME TIME! This defeats the whole purpose of Bastrama which is CONTROLLED deletion of a DEFINED SUBSET of all files. Be sure that you understand what you are doing, before you change k and l, either!


SAFETY

Bastrama takes great care in the handling of your precious backup files. Files are not deleted, just renamed per default. Only if the --delete option is specified, files are deleted. If Bastrama detects potential problems (missing recommended parameters, time inconsistency, file size suspiciously small) files are not deleted unless --delete *and* --force are specified.

The set of files that Bastrama is working on should not be in use by another program since Bastrama renames all and deletes some of them.

Running two Bastrama instances on the same set of files at the same time is asking for trouble.

It should be safe to kill the Bastrama process at any time.

Of course there is no warranty of any kind (see also section WARRANTY). On my box Bastrama is not deleting any more files than it should, though.


EXIT CODES

(Subject to change)

exit code 0
Everything worked alright.

exit code 1
One or more arguments had no wildcards in them. You probably forgot to escape them from the shell.

exit code 2
One or more fileglobs came up empty.


TODO


CHANGELOG

v0.15
added --size option (check files for minimal filesize)
improved docs
v0.14
did some cleanup (created MakeTree($) sub)
verified that time resolution is high enough (1 second)
added --help and --version switches
docs improved
v0.13
docs improved
tar.gz packaging
v0.12
added --undelete function
added --levels function
bugs fixed
docs improved
v0.11
functionality improved
bugs fixed
docs improved
v0.1

Initial Release


AUTHOR & COPYRIGHT

Copyright (C) 2002 Thiemo Nagel (thiemonagel@gmx.de)

Your feedback is greatly appreciated!


LICENSE & WARRANTY

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


to SourceForge project page Valid HTML 4.01! Valid CSS!