Friday, January 28, 2011

Backup/Clone a btrfs partition

I've been looking for this for sometime to no avail. Is it possible to backup a btrfs partition verbatim (including all the shared structures which save space by marking snapshot trees as COW) to another one? For instance, I'd like to backup my root partition which has couple of btrfs subvolumes (snapshots of the / itself).

The only way I can think is to use a block copying tool like dd but that is inefficient as my partition is only 20% full and I intend to back it up regularly. I already backup everything incrementally using rsync, so this is not a workaround for another problem. I simply need a bit for bit clone of my btrfs partition without having to use a tool such as dd.

I know ext3, for instance, provides a dump and restore utility. That is the kind of thing I'm looking for.

UPDATE

Here is a update to clarify the fact that I want to be able to access the files on the backup storage the same way I can on the live disk (ie I do not want to store dump files on the backup storage).

Thanks in advance

  • Pipe the output of dd through something like bzip2 or your other favourite compression program that'll read from standard input. I've done this on a 500 GB disk that had a relatively small install and ended up with an 8 GB file.

    Wim Coenen : You would have to fill up the free space with zeroes first (e.g. `cat /dev/zero > zeroes`) to get rid of the unlinked data which is still on the disk. But that might not work anymore when BTRFS gets block-level data deduplication in the future.
    mikeY : Please see the update to my question.
    From Cry Havok

0 comments:

Post a Comment