Michael Vrable [Tue, 2 Oct 2007 18:54:37 +0000 (11:54 -0700)]
Add a restore-snapshot command to lbs-util.
This is still in development, and not fully tested yet. This is meant to
mostly replace restore.pl, and will eventually have more features (it can
already restore without needing all segments unpacked first).
The restore.pl script won't go away, though, since it is still useful to
include as a small, self-contained bare-bones restore program.
Michael Vrable [Tue, 25 Sep 2007 22:04:51 +0000 (15:04 -0700)]
Add "prune database" command to lbs-util.
This acts like clean, but doesn't perform the step of marking old segments
as expired.
Michael Vrable [Thu, 20 Sep 2007 23:26:21 +0000 (16:26 -0700)]
File reorganization: move non-essential binaries to contrib/.
The top-level directory is now mostly for the main lbs binary, and the
lbs-util script. Other scripts, which are not necessary for backups (but
helpful) can be found in contrib.
Michael Vrable [Mon, 17 Sep 2007 04:25:15 +0000 (21:25 -0700)]
When cleaning the cache of objects, don't be so verbose.
Change the command for cleaning from "rm -rv", dropping the "-v".
Michael Vrable [Sat, 15 Sep 2007 05:04:20 +0000 (22:04 -0700)]
Enhance object-checksums command.
If no segments are specified, dump object checksums for all segments.
Additionally, prompt for a password (to decrypt segments) when needed.
Michael Vrable [Thu, 13 Sep 2007 20:18:19 +0000 (13:18 -0700)]
Move most documentation into a doc/ subdirectory.
Michael Vrable [Wed, 12 Sep 2007 19:26:29 +0000 (12:26 -0700)]
Remove cleandb.sql SQL script since this functionality is now in lbs-util.
Michael Vrable [Wed, 12 Sep 2007 18:01:07 +0000 (11:01 -0700)]
Rename lbs-util.py to lbs-util.
The Python implementation is now the standard utility program for working
with LBS archives. Drop the ".py" suffix. It replaces the old lbs-util
program, which was implemented in Perl.
Michael Vrable [Wed, 12 Sep 2007 17:59:39 +0000 (10:59 -0700)]
Delete the Perl LBS module and the Perl-based lbs-util script.
Michael Vrable [Tue, 11 Sep 2007 17:38:13 +0000 (10:38 -0700)]
Expanded Python module for accessing LBS snapshots, and lbs-util.py.
Expand the lbs Python module with code for reading from LBS archives. This
includes decoding segments and parsing snapshot descriptors and metadata
logs.
Expand the lbs-util.py tool so that it has most of the functionality of
lbs-util (Perl implementation). The Perl code should now be considered
deprecated, and will be removed at some point in the future.
The Python code still needs some cleaning up.
Michael Vrable [Sun, 9 Sep 2007 00:36:43 +0000 (17:36 -0700)]
Suppress error messages from Makefile when git-describe is not available.
Michael Vrable [Sun, 9 Sep 2007 00:32:32 +0000 (17:32 -0700)]
README spelling corrections.
Michael Vrable [Fri, 24 Aug 2007 18:03:51 +0000 (11:03 -0700)]
NEWS file updates in preparation for v0.4 release.
Michael Vrable [Fri, 24 Aug 2007 17:56:15 +0000 (10:56 -0700)]
Preview of a new Python-based management tool; includes segment cleaning.
This adds a Python-based lbs-util program which can perform automatic
segment cleaning. This hasn't been entirely worked out yet, so it may yet
be a little buggy, and the policies implemented can certainly be improved.
Expect future improvements in this area, and don't yet rely on it too
heavily.
Michael Vrable [Fri, 24 Aug 2007 17:24:09 +0000 (10:24 -0700)]
Documentation improvements.
Highlights are a README file with instructions for getting started, and
description of some implementation details, starting with the purpose and
format of the local database.
Michael Vrable [Thu, 23 Aug 2007 18:23:28 +0000 (11:23 -0700)]
Place expired and repacked objects into segments based on database.
The local database can store an integer with each expired object that can
be used to group objects together based on age or other factors. Update
the lbs snapshot utility to place objects into segments based on this
value.
Michael Vrable [Tue, 21 Aug 2007 00:38:20 +0000 (17:38 -0700)]
Implement --signature-filter for signing backup snapshots.
If supplied, the argument to --signature-filter will be a program through
which the text for the root snapshot descriptor is filtered. This filter
should act much like "gpg --clearsign": produce a nearly-identical text
file, with perhaps a few lines at the start or end containing the
signature, but which can be treated as an ordinary segment descriptor by
ignoring this leading and trailing data.
Michael Vrable [Fri, 17 Aug 2007 19:38:03 +0000 (12:38 -0700)]
lbs-util now supports reading encrypted segments (with lbs-filter-gpg).
Change the default to encrypted segments rather than compressed with bzip2.
The default of the lbs program has not been changed; it is still necessary
to specify the correct options there to generate encrypted backups.
Michael Vrable [Fri, 17 Aug 2007 18:52:45 +0000 (11:52 -0700)]
Update NEWS file.
Michael Vrable [Fri, 17 Aug 2007 15:08:11 +0000 (08:08 -0700)]
Bug fix for the rewritten spawn_filter function.
We were accidentally using the wrong variable (filter_pid instead of pid)
when looking at the result of a fork call, with the result that both
processes thought they were the parent.
Michael Vrable [Fri, 17 Aug 2007 04:38:25 +0000 (21:38 -0700)]
Switch to stdio-based I/O for writing descriptor file.
This should be a little bit easier to hook into filtering code (we can open
the output file, spawn the filter, and then fdopen the resulting
descriptor), which will be used when implementing signing of the descriptor
files.
Michael Vrable [Thu, 16 Aug 2007 22:53:29 +0000 (15:53 -0700)]
Cleanup of the tar-store code.
- Make spawn_filter generic, not part of Tarfile, so that it can be used
by other parts of the code. (Specifically, it should be used later
when writing out a segment descriptor, so that the descriptor can be
filtered through gpg for signing.)
- Drop internal_write_object. It had only one caller, so simply inline
the code.
Michael Vrable [Thu, 16 Aug 2007 22:12:40 +0000 (15:12 -0700)]
lbs-filter-gpg should run gpg in batch mode.
Supply the --batch option to gpg so that it can run without a terminal.
Michael Vrable [Thu, 16 Aug 2007 21:19:13 +0000 (14:19 -0700)]
Write an example script for invoking gpg to encrypt backup segments.
This script acts as a filter with options for encrypting, decrypting, and
signing data. Signing uses --clearsign, and will eventually be appropriate
for signing the snapshot descriptor files.
Michael Vrable [Fri, 10 Aug 2007 18:18:49 +0000 (11:18 -0700)]
Include version number in usage message.
Michael Vrable [Fri, 10 Aug 2007 18:13:17 +0000 (11:13 -0700)]
Update NEWS for 0.3 release.
Michael Vrable [Fri, 10 Aug 2007 18:04:57 +0000 (11:04 -0700)]
Preview of a new lbs-util command for snapshot maintenance.
This introduces a new Perl module (LBS.pm) which is an interface for
reading LBS snapshots, and a small command which uses it (lbs-util). Few
commands are implemented yet, but more should follow.
Michael Vrable [Fri, 10 Aug 2007 17:59:33 +0000 (10:59 -0700)]
Include segment checksums as "Checksums" not "Checksum-File" in descriptor.
Avoid the use of a dash in a key name in the descriptor file, since it is
not well-tesetd with the various tools.
Michael Vrable [Fri, 10 Aug 2007 17:23:51 +0000 (10:23 -0700)]
Minor database schema fix.
When constructing the segment_info view, we can no longer do a natural join
on the block_index and segments tables, since the segments table recently
acquired a checksum column. Now explicitly join on the segmentid column
only, which is the desired behavior (and what a natural join used to do).
Michael Vrable [Fri, 10 Aug 2007 03:41:37 +0000 (20:41 -0700)]
NEWS updates.
Michael Vrable [Fri, 10 Aug 2007 03:36:51 +0000 (20:36 -0700)]
Write out a .sha1sums file with checksums for segments in this snapshot.
Some segments might be left out; we only write out lines for those segments
that we know a checksum for. These checksums are stored in the local
database (so we can find checksums for old segments), but entries might be
missing.
Michael Vrable [Fri, 10 Aug 2007 02:23:35 +0000 (19:23 -0700)]
Improve reporting of database errors.
Michael Vrable [Fri, 10 Aug 2007 02:23:20 +0000 (19:23 -0700)]
Compute checksums of segments and store them in the local database.
When a segment is fully written out, compute a checksum of the file
actually written (post-filtering). Store this in the local database so
that it will be possible to write out, at the end of a backup, a file
containing the checksums of all segments used for the snapshot (including
old ones not written out in this execution).
Michael Vrable [Fri, 10 Aug 2007 02:20:30 +0000 (19:20 -0700)]
Fix a double-close of a file descriptor.
When a file is dumped, the file descriptor is opened by scanfile(), so that
is the function which should close it (not dump_inode()).
Michael Vrable [Wed, 8 Aug 2007 23:41:06 +0000 (16:41 -0700)]
Extract the version number from NEWS if git-describe is not available.
This should allow building from tarballs (not the git version), and still
correctly fill in the version number (so it can be incorporated into
generated files).
If git-describe does not return a value, the first word from the NEWS file
is taken as the version number.
Michael Vrable [Wed, 8 Aug 2007 19:09:31 +0000 (12:09 -0700)]
Add a NEWS file summarizing changes in each release.
Michael Vrable [Wed, 8 Aug 2007 17:26:05 +0000 (10:26 -0700)]
Do not include link/inode information for directories.
Directories cannot be hard-linked, so do not bother to include a link count
and inode information for directories in a snapshot.
Michael Vrable [Wed, 8 Aug 2007 17:00:00 +0000 (10:00 -0700)]
Include link counts and inode numbers in metadata dumps.
When the link count on a file is greater than one, include the link count
and a representation of the inode number (actually, inode number and
device). This will provide all information which should be needed for
detecting hard links at restore time. The backup program itself does not
identify hard-linked files and treat them any differently--since storage
for identical files can be shared, the storing a hard-linked file multiple
times should still be relatively efficient.
Michael Vrable [Tue, 7 Aug 2007 20:57:02 +0000 (13:57 -0700)]
Drop dependence on libtar.
Implement everything we need to write TAR files ourself; this isn't too
difficult since we are only ever writing regular files with fixed-length
filenames (so need to worry about long file names). In fact, doing it
directly is really no more complicated than using libtar.
Michael Vrable [Mon, 6 Aug 2007 21:02:23 +0000 (14:02 -0700)]
Update the format documentation to describe the current backup format.
The old documentation referred to the old binary backup format, and was
incomplete at that. Rewrite it to discuss the current format, including a
discussion of segment/object storage, object references, the format of the
metadata listing, and the root backup descriptor.
The documentation can be improved, and some parts are certainly a bit
spotty, but this gives a good quick overview of the entire format.
Michael Vrable [Fri, 3 Aug 2007 05:14:37 +0000 (22:14 -0700)]
Print a help message if no paths are specified to back up.
Rather than defaulting to backing up the current directory, always require
that a path be specified. If no paths are specified, print the usage
message and exit.
Also, fix a crash that previously occurred when no paths were specified.
Michael Vrable [Thu, 2 Aug 2007 23:32:07 +0000 (16:32 -0700)]
Update .gitignore: explicitly ignore .o files.
Michael Vrable [Fri, 27 Jul 2007 18:58:17 +0000 (11:58 -0700)]
Provide a more detailed indication of file status when backing up.
Indicate whether a file is new, or whether we managed to find the old data
in other segments, or whether data is being copied because we are cleaning
segments, etc.
Michael Vrable [Fri, 27 Jul 2007 01:01:01 +0000 (18:01 -0700)]
URI-escape the '@' character.
Ensure that the '@' character is escaped in strings. This isn't necessary
now, but in the future this might be useful so that indirect references are
never ambiguous. (If a "@" appears, it's an indirect reference; if a
literal "@" is needed, it is escaped.)
Michael Vrable [Fri, 20 Jul 2007 21:10:33 +0000 (14:10 -0700)]
Include scheme name in statcache file, so localdb directory can be shared.
Michael Vrable [Fri, 20 Jul 2007 18:27:13 +0000 (11:27 -0700)]
Add support for octal, hexadecimal in restore.pl script.
Michael Vrable [Fri, 20 Jul 2007 17:39:59 +0000 (10:39 -0700)]
Do not warn when fewer than two arguments are provided.
It used to be that a source and destination had to be provided as the last
two arguments. The use of the --dest= option now makes that not true, so
don't print a usage message and exit when only a single source is provided.
Michael Vrable [Fri, 20 Jul 2007 17:20:58 +0000 (10:20 -0700)]
Update the descriptor format string to "v0.2".
The introduction of octal probably makes this fair.
Michael Vrable [Fri, 20 Jul 2007 17:17:18 +0000 (10:17 -0700)]
Really fix the umask problem.
The fix in
bf947741ac8f65e74d594a1e14e94d90320b403e didn't entirely work.
This should be better.
Michael Vrable [Fri, 20 Jul 2007 17:05:06 +0000 (10:05 -0700)]
Add support for octal and hexadecimal output in dumps.
Switch to using octal for file modesin metadata listings, since this is
more readable.
Michael Vrable [Fri, 20 Jul 2007 16:59:32 +0000 (09:59 -0700)]
Rename --name to --scheme, and store the scheme name in the local database.
Michael Vrable [Thu, 19 Jul 2007 22:43:55 +0000 (15:43 -0700)]
Add a --name command-line option for naming snapshots.
This feature is meant to support storing several separate sets of snapshots
in the same directory--for example, snapshots of multiple computers, or
snapshots of different sets of directories. These snapshots can be deleted
independently. The snapshots will be permitted to share segments.
A name is simply applied for management convience, to help in
distinguishing the different sets of backups. The string specified with
--name is included both in the snapshot descriptor filename and as a
"Name:" field within that descriptor.
Michael Vrable [Thu, 19 Jul 2007 16:42:38 +0000 (09:42 -0700)]
Respect umask when creating backup files.
Previously backup files were created with permissions of 0600 before the
umask was subtracted. Set it to 0666 now; the user can adjust the
permissions to make them more restrictive by changing the umask or
permissions in the parent directories.
Michael Vrable [Thu, 19 Jul 2007 04:13:20 +0000 (21:13 -0700)]
Reorganize filesystem traversal and dumping code.
Work to more cleanly separate the parts of the code that scan the
filesystem from the parts which actually generate dump data to the backup
snapshot.
Michael Vrable [Wed, 18 Jul 2007 22:09:32 +0000 (15:09 -0700)]
Slightly improve error-handling during backups.
Michael Vrable [Wed, 18 Jul 2007 21:43:31 +0000 (14:43 -0700)]
Makefile cleanups.
Michael Vrable [Wed, 18 Jul 2007 21:31:32 +0000 (14:31 -0700)]
Rename format.{cc,h} -> util.{cc,h}.
Michael Vrable [Wed, 18 Jul 2007 20:06:03 +0000 (13:06 -0700)]
Extract major/minor components of device numbers.
I hope these are the right macros and include files to use...
Michael Vrable [Wed, 18 Jul 2007 19:59:41 +0000 (12:59 -0700)]
Dump the device number of character/block devices.
Michael Vrable [Wed, 18 Jul 2007 19:03:46 +0000 (12:03 -0700)]
Auto-generate a version number for the program with git-describe.
If compiled from a git repository, embed the version number (output from
git-describe) into the resulting binary. If this does not work for
whatever reason, the version string embedded is "Unknown".
Michael Vrable [Tue, 17 Jul 2007 23:29:14 +0000 (16:29 -0700)]
Add string un-escaping, and fix the statcache reader to use it.
Michael Vrable [Tue, 17 Jul 2007 21:35:09 +0000 (14:35 -0700)]
Rename the generated executable from "scandir" to "lbs".
Michael Vrable [Tue, 17 Jul 2007 20:51:29 +0000 (13:51 -0700)]
Implement a more complex inclusion/exclusion system for files.
Allow multiple paths to be specified for backups, to allow different parts
of the filesystem tree to be selected for backup in a single snapshot.
Michael Vrable [Sat, 14 Jul 2007 22:45:46 +0000 (15:45 -0700)]
Fix a bug in statcache support for file sizes.
This had the effect of renderig the statcache useless (all files would be
entirely read), but apart from the performance issue should have caused any
problems.
Michael Vrable [Thu, 12 Jul 2007 20:05:14 +0000 (13:05 -0700)]
When comparing a file against the stat cache, check size field too.
Michael Vrable [Sat, 7 Jul 2007 21:02:56 +0000 (14:02 -0700)]
Dump statistics of data written at the end of a backup run.
Michael Vrable [Thu, 5 Jul 2007 18:20:21 +0000 (11:20 -0700)]
Include file size in the stat cache (but do not check against it yet).
Michael Vrable [Wed, 4 Jul 2007 17:04:13 +0000 (10:04 -0700)]
Rewrite object reference parser.
This new version should handle all options, including checksums and object
ranges, though it hasn't been fully tested.
Michael Vrable [Thu, 28 Jun 2007 20:30:23 +0000 (13:30 -0700)]
Only trust the results of a stat if two separate backups agree.
This should eliminate races where stat information might not change if
there are two changes to a file within the same second--as long as two
backups are not taken less than a second apart.
Michael Vrable [Thu, 28 Jun 2007 00:10:11 +0000 (17:10 -0700)]
Sort-of-working statcache implementation.
This will use stat information to determine when a file doesn't need to
be read again. There are still some bits left to be implemented; in
particular, parsing of references needs to be fixed, since at the moment
checksums and ranges aren't supported, and any files using them will
have block lists corrupted by the stat cache. (Fortunately, nothing
uses those reference forms yet for file contents.)
Michael Vrable [Wed, 27 Jun 2007 20:20:39 +0000 (13:20 -0700)]
Write the backup descriptor as the very last step in a backup.
For consistency, we should make sure that all segments and other data
needed to reconstruct a backup are written before we write out the
backup descriptor file itself.
Michael Vrable [Thu, 21 Jun 2007 18:02:09 +0000 (11:02 -0700)]
Try an alternate segment cleaning ordering.
This one gives more weight to expiring nearly-empty segments.
Michael Vrable [Tue, 19 Jun 2007 17:46:20 +0000 (10:46 -0700)]
Add a simple script for garbage collecting old segments.
Michael Vrable [Tue, 19 Jun 2007 02:10:57 +0000 (19:10 -0700)]
Preserve the "timestamp" database field when expiring segments.
When segments are repacked, we would like to keep the original timestamp
for the old objects which are written into new segments. These changes
should now propagate that timestamp value.
Michael Vrable [Tue, 19 Jun 2007 00:45:55 +0000 (17:45 -0700)]
Minor formatting fix when outputting the statcache file.
Michael Vrable [Mon, 18 Jun 2007 20:15:05 +0000 (13:15 -0700)]
Partial commit of statcache support.
This will cache the results of stat calls from previous backups, so that
future backups do not need to read the files in their entirety if no data
has changed.
Michael Vrable [Sat, 16 Jun 2007 02:31:51 +0000 (19:31 -0700)]
Rename descriptor files.
Prefix them with "snapshot-", so they will sort after all segment files.
Michael Vrable [Sat, 16 Jun 2007 02:29:54 +0000 (19:29 -0700)]
Wait to write the backup description until a backup is finished.
Michael Vrable [Fri, 15 Jun 2007 04:29:41 +0000 (21:29 -0700)]
Update database schema with views for choosing segments to clean.
Create a couple of database views, one for gathering summary statistics
about segments in use, and one for ranking segments to be cleaned and
rewritten, based on utilization and the age of the data contained in it.
Michael Vrable [Wed, 13 Jun 2007 16:32:49 +0000 (09:32 -0700)]
Fix --localdb= option.
Michael Vrable [Wed, 13 Jun 2007 02:58:02 +0000 (19:58 -0700)]
Factor code to prepare SQLite statements into a separate function.
This cuts down on a little code duplication and also makes it easy to
include SQL statements in inline strings when they are prepared.
Also, switch to the older sqlite3_prepare interface (not _prepare_v2) since
the new interface is still a bit too new to be commonly available.
Michael Vrable [Tue, 12 Jun 2007 17:49:13 +0000 (10:49 -0700)]
Fix typo.
Michael Vrable [Mon, 11 Jun 2007 21:45:12 +0000 (14:45 -0700)]
Make segment compression/encryption filter to command-line-selectable.
Michael Vrable [Mon, 4 Jun 2007 17:40:33 +0000 (10:40 -0700)]
Design note: grouping also allows better compression.
Michael Vrable [Mon, 4 Jun 2007 17:29:17 +0000 (10:29 -0700)]
Create an SQL script for cleaning out the local object database.
Michael Vrable [Mon, 4 Jun 2007 17:28:06 +0000 (10:28 -0700)]
Make parser in restore.pl more tolerant, and reorder descriptor fields.
Michael Vrable [Sun, 3 Jun 2007 00:14:13 +0000 (17:14 -0700)]
Add version information to the backup descriptor files.
This adds a "Format:" line at the start of a backup descriptor, with the
intent that different formats can be recognized if there is a need to make
changes in the future. This can also be used as a magic number to identify
LBS snapshot files.
Also, update the restore.pl script to handle the new format--make the
parser more flexible so that fields can appear in any order, and
unrecognized lines are ignored.
Michael Vrable [Thu, 31 May 2007 05:47:10 +0000 (22:47 -0700)]
Do not bother to split indirect block lists into a separate segment.
For now, just group them with the rest of the metadata. It's not worth
splitting them up now; this could be reverted later.
Michael Vrable [Thu, 31 May 2007 05:44:11 +0000 (22:44 -0700)]
Differentiate between never-before-seen objects and seen-but-expired.
We group seen-but-expired objects into different segments, since the fact
that the content has been seen before is an indicator that the data is
long-lived, and grouping by (expected future) age should help increase
segment utilization.
Michael Vrable [Wed, 30 May 2007 15:51:50 +0000 (08:51 -0700)]
Check for errors when files are opened for dumping.
Before, we could fail to open a file when O_NOATIME was specified but the
file was owned by another user, and we didn't notice this. Now we do, and
we also retry the open without O_NOATIME.
Michael Vrable [Thu, 24 May 2007 19:53:26 +0000 (12:53 -0700)]
Output filename to metadata log after fully processing file.
Previously, if there was an error processing the file, the metadata
dictionary was not output, but the filename was, producing an incorrect
metadata file. This is now fixed.
Michael Vrable [Wed, 23 May 2007 18:12:29 +0000 (11:12 -0700)]
Slightly expand the set of characters which are escaped in filenames.
Michael Vrable [Wed, 23 May 2007 18:12:12 +0000 (11:12 -0700)]
Use NULL in the local database to indicate that blocks are not expired.
Michael Vrable [Tue, 22 May 2007 04:28:46 +0000 (21:28 -0700)]
Extend local database once more.
This should hopefully add most of the features needed for the moment.
Improvements made:
- Normalize segment names by putting them in a separate table and
referring to them by ID everywhere else. This should help quite a bit,
since segment names are ~36 characters long. Add conversion functions
to the C++ code, which aren't optimized yet (we should cache results in
the C++ code and not re-query the database each time).
- Similarly, normalize snapshot names.
- Add an expired field to the object index, so that we can stop using
objects in future backups but still remember how old the data is.
Some more work is still needed in the C++ code, but the hope is that the
database schema itself will be more stable now.
Michael Vrable [Sat, 19 May 2007 05:07:04 +0000 (22:07 -0700)]
Add (probably long-overdue) .gitignore file.
Michael Vrable [Fri, 18 May 2007 22:47:36 +0000 (15:47 -0700)]
Add rudimentary command-line parsing and support for file exclusions.
Michael Vrable [Thu, 17 May 2007 05:41:43 +0000 (22:41 -0700)]
Bugfix in size estimates for filtered tarfile outputs.
Michael Vrable [Thu, 17 May 2007 05:27:31 +0000 (22:27 -0700)]
Bugfix for restore.pl.
Indirect references to data blocks were not being properly handled, so
large files (those using an indirect reference to the data) were not
restored properly.
This was at least caught by the checksums, so no data was ever silently
corrupted.
Michael Vrable [Wed, 16 May 2007 21:50:01 +0000 (14:50 -0700)]
Add timestamps to block when they are inserted into the local database.
Michael Vrable [Tue, 15 May 2007 22:57:24 +0000 (15:57 -0700)]
Handle new-style user/group entries in the restore script.
The new style is
uid (username)
and was previously causing a warning since the entire string is not
numeric, just the first part. Now explicitly split it apart. (For now, we
ignore the username string, but it could possibly be used in the future.)