btrbk icon indicating copy to clipboard operation
btrbk copied to clipboard

Re-establish parent child relationship after btrbk restore

Open babyygemperor opened this issue 1 year ago • 2 comments

I recently lost my 16TB hard disk (/disk1) due to a mechanical failure. Thankfully I had a btrbk set up to create backups to my second disk (/disk2). This is how my btrbk.conf looks

transaction_log            /var/log/btrbk.log
snapshot_dir               snapshots
snapshot_preserve_min      24h
snapshot_preserve          7d 4w *m

target_preserve_min        24h
target_preserve            7d 4w *m

volume /disk1
    subvolume photos
        target send-receive /disk2/photos
    subvolume media
        target send-receive /disk2/media

In order to restore the backups, I copied everything using btrfs send /disk2/photos/photos.20240814 | btrfs receive /disk1 and then used btrfs subvolume snapshot /disk1/photos.20240814 /disk1/phtotos and then finally btrfs sub volume delete /disk1/photos.20240814 to restore my backups.

Everything was fine so far but I wanted my backups of (new) /disk1 to continue building on top of those already in /disk2.

Now the issue is that the new UUIDs of the subvolumes of /disk1 are not the matching the Parent UUID of the backups in /disk2, therefore my backups aren't incremental anymore. They are copied entirely separately.

I get the following warning in my btrbk: No common parent subvolume present, creating full backup...

Is there any way to somehow restore the parent child relationship for btrbk or my incremental backups to work again?

babyygemperor avatar Aug 14 '24 13:08 babyygemperor

and then finally btrfs sub volume delete /disk1/photos.20240814

I think that was the mistake. If you read "Restoring Backups", it is advised to keep the copied subvolume until at least one new backup has been created:

Make sure to keep data.20150101 subvolumes on both disks at least until you created a new backup using btrbk, in order to keep the incremental chain alive.

This way, btrbk can detect a new common parent (the one you restored) on both the target and local disk and bases its incremental backup on this.

mipro98 avatar Sep 10 '24 12:09 mipro98

@mipro98 / do you know how btrbk identifies the parent? Does it list uuid's of all snapshots on either side (disk1 and disk2) and then copy based on what it finds? Or does the parent snapshot have to be in the proper directory on disk1, under which all snapshots are being stored? Or ...?

I've only just gone through a messy restore process and realized I'm not totally clear on all this.

Bonus question: how does incremental_prefs work? Why does it look for the oldest parent, rather than the most recent?

DiagonalArg avatar Sep 11 '25 09:09 DiagonalArg