Btrfs failed at checking quota groups when resizing partition

Hello.

Long story short: I am running out of space on root partition. There’s still 12/60 GB left free. I am encountering btrfs errors when I try to resize / move root partition. Please advise how I can resolve this.

Longer version:

My partition structure is as follows:

[ few windows partitions] [ nvme0n1p5 - ntfs for file storage ] [ unallocated 100 GB ] [ nvme0n1p6 - btrfs root] [ 2 GB swap ]

I was able to shrink nvme0n1p5 without issues. Problems started when I try to increase nvme0n1p6 root partition.

First I tried Yast Partitioner but it won’t let me increase the size backwards.

Second I tried to do that using gparted live cd, but when I try to resize or move the partition it fails due to the btrfs error.

Third I used Tumebleweed live cd to boot into rescue mode to check if I can fix these errors or get more info.

I run this command
btrfs check /dev/nvme0n1p6
The output was (sorry if there is a typo, I rewrite it from a photo)

Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p6
UUID: cf574c4e-042c-40aa-95d1-9dcc7c4d2513
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups
ERROR: failed to add qgroup relation, member=4204 parent=281474976710656: No such file or directory
ERROR: loading qgroups from disk: -2
ERROR: failed to check quota groups
found 47952371712 bytes used, error(s) found
total csum bytes: 40221984
total tree bytes: 1180696576
total fs tree bytes: 1063436288
total extent tree bytes: 68861952
btree space waste bytes: 259125908
file data blocks allocated: 142329028608
referenced 72943894528
extent buffer leak: start 153844924416 len 16384
extent buffer leak: start 154452344832 len 16384
itty1:rescue:/dev #

I tried to run btrfs check --repair but the output is exactly the same as the command without --repair.
I tried btrfs rebalance command without any filters (sorry, I don’t remember exact command right now). It run for 5 min, finished, that didn’t help.

A thread with similar problem, but not the same, is here btrfs fails to load qgroups from disk with error -2 (out of memory)
If I understand it correctly, the user there fixed his issue by deleting docker subvolumes. I am using docker as well, but I am afraid I will lose data if I delete docker subvolumes. Is this true? I tried docker prune, but that didn’t change anything regarding btrfs errors.

Please advise how can I proceed from here.

Can you mount this filesystem?

1 Like

It’s mounted as / when I boot into my regular Tumbleweed installation. System is working normally. These btrfs errors only occur when I try to boot into live cd to resize or move the partition.

Try quota rescan

btrfs quota rescan -w /

If it does not help, try disabling/enabling quota.

btrfs quota disable /
btrfs quota enable /
1 Like

Thank you, your solution using quota disable and enable worked!

Rescan run for about 30s but didn’t fix the issue. Gparted live cd and Tumebleweed live cd still gave the same errors.

nbd@nbd-x300:~> sudo btrfs quota rescan -w /
[sudo] password for root:
quota rescan started
nbd@nbd-x300:~>

Following you second solution, I used quota disable command, enable, disable again (I wasn’t sure what’s the proper order of things). Then I booted into gparted live cd and moving and resizing went smoothly. System booted normally without issues. Lastly, I used quota enable command again. Now I enjoy extra 100 GB on / partition.

Thank you again!