Hello, in rear documentation (man pages, etc.) they say, that currently it is not possible to backup the btrfs root partition in full glory because rear cannot work with snapshots, at least not with the snapshots stored automatically by snapper (or manually) in the /.snapshots directory. The other tools (dd, rsnapshot, fsarchiver, rsync, cp, clonezilla, etc.) cannot deal with subvolumes in btrfs partitions either, not to mention snapshots.
So, given a desktop, or laptop, and an external USB drive (the latter with plenty of free xfs formatted space), how would I go about backing up my desktop in full glory by means of a Rescue CD and the USB drive? Two further constraints are: (a) laptop cannot boot using USB drive, only using CD or its internal HDD, and (b) I also want to be able to recover my /.snapshots subvolume, and I want to see those snapshots in my boot menu.
I worked on that problem for nearly one month full time but could not get anywhere with it.
Just as an example, if you use fsarchiver to backup /dev/sda2 (the btrfs root partition) and /dev/sda3 (the home partition) on an xfs formatted /dev/sdb1 on USB drive, that works without errors. If you fsarchive your fsa archive back to id=0,dest=/dev/sda2 id=1,dest=/dev/sda3, that SEEMS to work fine. Even at Page 1 they say that fsarchiver will also work for btrfs. However, the subvolumes are getting lost thereby and turned into mere directories. Therefore grub2 cannot mount the missing subvolumes for which entries are to be found in /etc/fstab and you are lost in outer booting space.
Doing a full binary copy using dd/ddresue or perhaps cloneziila.
Thanks for your reponse, may I ask one more question about your answer? Do you know, if dd / ddrescue / clonezilla can deal (a) with btrfs and subvolumes being used, and, furthermore (b) even snapshots being used (i.e., opensuse leap / tumbleweed the /.snapshots subvolume with snapper-generated snapshots therein)?
I tried dd and clonezilla, because that seemed to be a reasonable step to take, but they seemed to produce a multiple of backed-up space, and they couldn’t come to and end, tumbleweed was 5GiB or so, and they produced more than 200 GiB, before I stopped them from going on.
What is your experience on this one, please? – Thank you in advance!
Well depends if you do a full disk backup they should since it is full binary. Note clonezilla may or may not deal with snapshots if it only copies stuff it sees which it does ifif compressed but dd should since it does a full sector byte by byte by sector copy if you copy whole partitions. Problem is the snapshots are hidden from most programs what you see in the snapper directories is just metadata
dd does not deal with btrfs at all. dd does byte to byte copy of device; it does not care about content of this device. So all your subvolumes will be present on destination exactly as they were on source.
Thank you very much for your hint.
Yes, that’s a point I completely misunderstood. dd just does not care about what’s “inside” the /dev/sda2 btrfs partition. Adding the fact, that this 2nd opensuse tumbleweed partition “only” takes 40 GiB in space, using dd I could backup the opensuse tumbleweed system partition in about an hour on my dual core celeron (2.0 GHz) laptop. Writing it back from the 40 GiB image to /dev/sda2 also worked well, system immediately was able to boot, snapshots were also listed in boot menu. Am about to consider this as a solution of my problem.
At this moment, I’m writing back a dd’ed and gzipped image (about 19 GiB) back to /dev/sda2, gzipping cost me a little more than an hour, backup space is cut in half, so if THAT worked, I’d recommend dd if=/dev/sda2 bs=1M | gzip -c > myimage1.img.gz as a decent way of backing up an opensuse tumbleweed / leap system partition these days.
By the way, wanted to know what partclone could do for me here, but they have a bug still open (last update 2016-03-06) dealing with an – guess what – opensuse btrfs partition cloning issue. Somebody poking around with clonezilla reported it at the end of 2015.
Thanks for your answer.
Yes, that’s right, these days most clone / backup programs still have difficulties dealing with a full-fledged btrfs partition sporting subvolumes and even snapshots thereof. So my answer to this problem would be, just resort to dd-like block-level utilities, because they somewhat circumvent the fact of dealing with btrfs partitions in the first place. (Also see arvidjaar 'r reply. )