btrbk icon indicating copy to clipboard operation
btrbk copied to clipboard

How to remove stray subvolumes?

Open unfa opened this issue 6 years ago • 8 comments

Hi!

I've interrupted btrbk's operation at one point and now very time I use it is says this:

WARNING: Target subvolume "/mnt/backup/data/data.20190526" exists, but is not a receive target of "/mnt/data/backup_snapshots/data.20190526"
WARNING: Please delete stray subvolume ("btrbk clean"): /mnt/backup/data/data.20190526
WARNING: Skipping backup of: /mnt/data/backup_snapshots/data.20190526
Creating backup: /mnt/backup/data/data.20190602

I've tried this:

$ btrbk clean /mnt/backup/data/data.20190526
ERROR: Command line argument does not match any volume, subvolume, target or group declaration: /mnt/backup/data/data.20190526

What can I do to clean this up safely?

unfa avatar Jun 02 '19 00:06 unfa

I think it's btrbk -c /path/to/configfile clean

1n5aN1aC avatar Jun 11 '19 01:06 1n5aN1aC

simply call btrbk clean, and btrbk will check all subvolumes (add -n, --dry-run if you like).

You can be more specific by adding a filter statement, in your case this would be a <target-directory>/<snapshot-name>, i.e. /mnt/backup/data/data (without the date postfix)

digint avatar Jun 13 '19 10:06 digint

would it be possible to ask btrbk to do that automatically instead of complaining and asking me to do it by hand ?

symphorien avatar Dec 30 '21 16:12 symphorien

would it be possible to ask btrbk to do that automatically instead of complaining and asking me to do it by hand ?

I would back that. Or maybe have a flag one can pass to btrbk run that will then do the cleanup first.

bdaase avatar Dec 30 '21 21:12 bdaase

Unfortunately this doesn't actually resolve the issue for me. I'm seeing:

$ sudo btrbk clean
--------------------------------------------------------------------------------
Cleanup Summary (btrbk command line client, version 0.29.1)

    Date:   Thu Jan 27 18:07:13 2022
    Config: /etc/btrbk.conf

Legend:
    ---  deleted subvolume (incomplete backup)
--------------------------------------------------------------------------------
/.backup/home/home.*
<no_action>
$ sudo btrbk run
WARNING: Target subvolume "/.backup/home/home.20220120T081129-0800" exists, but is not a receive target of "/.snapshots/home/home.20220120T081129-0800"
WARNING: Please delete stray subvolumes: "btrbk clean /.backup/home"
WARNING: Skipping backup of: /.snapshots/home/home.20220120T081129-0800
--------------------------------------------------------------------------------
Backup Summary (btrbk command line client, version 0.29.1)

    Date:   Thu Jan 27 18:07:17 2022
    Config: /etc/btrbk.conf

Legend:
    ===  up-to-date subvolume (source snapshot)
    +++  created subvolume (source snapshot)
    ---  deleted subvolume
    ***  received subvolume (non-incremental)
    >>>  received subvolume (incremental)
--------------------------------------------------------------------------------
//home
+++ /.snapshots/home/home.20220127T180717-0800
!!! /.backup/home/home.20220120T081129-0800
>>> /.backup/home/home.20220127T180717-0800

NOTE: Some errors occurred, which may result in missing backups!
Please check warning and error messages above.
Please delete stray subvolumes: "btrbk clean /.backup/home"

Am I missing something?

matthuszagh avatar Jan 28 '22 02:01 matthuszagh

This looks strange. Maybe the "stray subvolume" was created from another source (using another config?), or perhaps an ancient version of btrfs-progs?

  1. Please provide more information about the subvolumes in question, i.e.:
btrfs subvolume show /.backup/home/home.20220120T081129-0800
btrfs subvolume show /.snapshots/home/home.20220120T081129-0800
  1. Please try with latest master:
cd /tmp/
wget https://raw.githubusercontent.com/digint/btrbk/master/btrbk
chmod +x btrbk
sudo ./btrbk clean -n

digint avatar Feb 06 '22 18:02 digint

Thanks for the response. I don't think I created a snapshot for another source + config. I'm currently running 0.29.1, which is indeed a bit old.

$ sudo btrfs subvolume show /.backup/home/home.20220120T081129-0800/
home/home.20220120T081129-0800
        Name:                   home.20220120T081129-0800
        UUID:                   24fc7c6c-c1c0-6e44-91f1-dd2b352c8f12
        Parent UUID:            834402ba-081d-c947-b067-e6231c8b7258
        Received UUID:          a4fcc0a7-6c72-d54a-868c-29b6e42715fa
        Creation time:          2022-01-20 08:11:31 -0800
        Subvolume ID:           21470
        Generation:             71328
        Gen at creation:        71327
        Parent ID:              5
        Top level ID:           5
        Flags:                  -
        Snapshot(s):

Unfortunately, I no longer have the snapshot as I only keep those for a week.

I've encountered this issue at least once before. If it occurs again I'll try with the latest master as suggested and will post what I get. Thanks for the help!

matthuszagh avatar Feb 15 '22 05:02 matthuszagh

I have the same problem with 0.31.3 :

I think it occurred after manipulation of source snapshots (delete and later recreate a snapshot with same name) :

Source : btrfs subvolume show /mnt/btrfs/current.20220806 current.20220806 Name: current.20220806 UUID: aef48464-2a8c-304b-ae82-603e38eca1ed Parent UUID: 5932a641-1ad3-6c44-b0e7-8b7ef3120fc9 Received UUID: - Creation time: 2022-08-06 15:32:53 +0200 Subvolume ID: 1888 Generation: 12511 Gen at creation: 12511 Parent ID: 5 Top level ID: 5 Flags: readonly Snapshot(s):

Destination : btrfs subvolume show /mnt/nas-backup/current.20220806 current.20220806 Name: current.20220806 UUID: 477dc9d2-074d-c444-bd85-3e032112f31c Parent UUID: 5b32b0df-bb1e-804e-a903-27b6cdf95701 Received UUID: 7165d244-d67b-7f4f-bf4f-d8b7a01e4a1f Creation time: 2022-08-06 09:53:13 +0200 Subvolume ID: 1526 Generation: 3309 Gen at creation: 3305 Parent ID: 5 Top level ID: 5 Flags: readonly Snapshot(s):

btrbk clean says nothing needs to be done. btrbk run complains about subvolume already existing.

mv /mnt/nas-backup/current.20220806 /mnt/nas-backup/current.20220806.bak (or rdeleting the subvolume) solves the problem.

gpacgpac avatar Aug 08 '22 08:08 gpacgpac