Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

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.

share|improve this answer
1  
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. –  Wim Coenen Oct 11 '10 at 10:25
    
Please see the update to my question. –  Mansour Oct 11 '10 at 11:50
add comment

I think apparently there isn't such a tool (yet, ATM).

share|improve this answer
add comment

just fyi ext2/3/4 dump doesen't do what you want to do ... only fs capable of doing this i am aware of are ntfs (using ntfs-3g) and zfs

though you could pull this off using lvm and and experimental thin provisioning ...

Edit: got back to this few years later realizing, you can do this with any filesystem using squashfs ...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.