bdar – block device archive

Zach Brown announced another cool tool on fsdevel:

I found myself wanting to backup a copy of an ancient ~75g ext3 file
system.  I got frustrated by of our utilities which don't saturate
storage.  I wanted dd line rates but I also only wanted to copy
referenced data.

So I threw something together which does that.  I made it work roughly
like tar so that people have some idea what to expect.  So you can do
something like:

$ bdar -cf - /dev/sda3 | gzip -c > /tmp/sda3-backup.bdar.gz
...
$ zcat /tmp/sda3-backup.bdar.gz | bdar -xf - /dev/sda3

and it will do exactly what you would guess it would do after reading
those command lines.

The bdar file format is just a header and then a series of regions of
bytes described by their length and offset.  To create a bdar file from
a file system bdar needs to know enough to figure out what extents are
referenced.  Restoring a bdar is generic, though, it just stamps bytes
into the target file.

I only taught it the most basic knowledge of ext[234].  Just enough to
show that generating the bdar is ~4x faster than tar and ~2x faster than
dump :).  There's still some available disk bandwidth to consume with
read-ahead, but it's pretty close.  (single spindle, ~5g of kernel
trees, beefy cpus.)

Source available as a Mercurial repo:

$ hg clone http://www.zabbo.net/hg/bdar

2 thoughts on “bdar – block device archive”

  1. how about errors on disk

    The interesting question is how does it handle errors on the block device. Does it fail or ignores the error and will continue to save what it cant?

    Also, the fs should be umounted right?

  2. Wow!

    Have you already given it a try? )

    It’s another reason to use ext[234], but mine FS of choice is still be Reiserfs.

Comments are closed.