You are not logged in.

#1 2019-06-29 08:51:54

CapSel
Member
Registered: 2011-08-26
Posts: 11

btrfs quota information lost after reboot

So first my environment:
I've leased a server from kimsufi, installed Archlinux (provided by them) and linux-lts kernel. "2TB" disk has 2 partitions - 32GB for swap (sda2), 1.8TB for btrfs (sda1).

I followed btrfs wiki on quota:

# btrfs quota enable /
# btrfs subvolume list / | cut -d' ' -f2 | xargs -I{} -n1 echo btrfs qgroup create 0/{} /
# btrfs rescan /

than I created subvolume for /home

# btrfs subvolume create /home

Then a limit:

# btrfs qgroup limit 50G /home

So the limit is now set:

# btrfs qgroup show -reF /home
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
0/262        16.00KiB     16.00KiB     50.00GiB         none 

I tested it and I can't create file bigger than 50GB there.

After reboot (command reboot = clean shutdown/restart):

# btrfs qgroup show -reF /home
ERROR: can't list qgroups: quotas not enabled
# btrfs quota enable /
# btrfs qgroup show -reF /home
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
0/262        16.00KiB     16.00KiB         none         none 
# btrfs quota rescan /
quota rescan started
# btrfs quota rescan /home
quota rescan started
# btrfs qgroup show -reF /home
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
0/262        16.00KiB     16.00KiB         none         none 
# btrfs qgroup show -reF /
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
0/5           2.85GiB      2.85GiB         none         none 
# btrfs subvolume list /
ID 258 gen 9 top level 5 path var/lib/portables
ID 259 gen 10 top level 5 path var/lib/machines
ID 262 gen 458 top level 5 path home
# btrfs qgroup show -reF /var/lib/portables
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
0/258        16.00KiB     16.00KiB         none         none 
# btrfs qgroup show -reF /var/lib/machines
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
0/259        16.00KiB     16.00KiB         none         none 
# btrfs qgroup show /
qgroupid         rfer         excl 
--------         ----         ---- 
0/5           2.85GiB      2.85GiB 
0/258        16.00KiB     16.00KiB 
0/259        16.00KiB     16.00KiB 
0/262        16.00KiB     16.00KiB 

Same problem is on linux kernel:

# uname -a
Linux at 5.1.15-arch1-1-ARCH #1 SMP PREEMPT Tue Jun 25 04:49:39 UTC 2019 x86_64 GNU/Linux

There is nothing in dmesg after reboot about qgroup.

# dmesg | grep -i btrfs
[    2.004634] Btrfs loaded, crc32c=crc32c-intel
[    2.008484] BTRFS: device label / devid 1 transid 447 /dev/sda1
[    2.030486] BTRFS info (device sda1): disk space caching is enabled
[    3.622562] BTRFS info (device sda1): enabling auto defrag
[    3.622563] BTRFS info (device sda1): disk space caching is enabled
[   58.136236] BTRFS info (device sda1): qgroup scan completed (inconsistency flag cleared)
[   82.043208] BTRFS info (device sda1): qgroup scan completed (inconsistency flag cleared)
[   84.943045] BTRFS info (device sda1): qgroup scan completed (inconsistency flag cleared)

# dmesg | grep -i qgroup
[   58.136236] BTRFS info (device sda1): qgroup scan completed (inconsistency flag cleared)
[   82.043208] BTRFS info (device sda1): qgroup scan completed (inconsistency flag cleared)
[   84.943045] BTRFS info (device sda1): qgroup scan completed (inconsistency flag cleared)

# dmesg | grep -i quota
[    0.534266] VFS: Disk quotas dquot_6.6.0

So... what the hell? Why did my limits disappear?

I could not find any systemd service related to qgroups (btrfs + quota) and I can't find any info on google about this problem.

Re-setting limit on /home and reboot gives same results.

--------

Now I removed all partitions, created separate /boot (sda1 ext4), swap (sda2), / (sda3 btrfs) from rescue system. Before reboot I enabled quota, created subvolume for /home, set limit and ... same thing after reboot - no quota.

Last edited by CapSel (2019-07-01 19:48:00)

Offline

#2 2019-12-10 16:57:15

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: btrfs quota information lost after reboot

Do you have Docker on that subvolume? Cause there's this issue: https://github.com/docker/for-linux/issues/78

Offline

#3 2019-12-10 17:04:11

CapSel
Member
Registered: 2011-08-26
Posts: 11

Re: btrfs quota information lost after reboot

Thank you very much for your answer. This is most probably docker problem. I ... already switched from btrfs.

Offline

#4 2019-12-10 17:26:13

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: btrfs quota information lost after reboot

The Docker btrfs backend is quite good though. Will see if it can be fixed, and will update in a separate thread if there's any success.

Offline

#5 2019-12-10 19:39:58

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: btrfs quota information lost after reboot

What fixes it, is running the Docker daemon with "--storage-opt btrfs.min_space=<SIZE>", or putting the following to /etc/docker/daemon.json:

{
  "storage-opts": [
    "btrfs.min_space=<SIZE>"
  ]
}

The relevant changes can be seen here: https://github.com/docker/docker-ce/com … a2dfe07f27

Sorry if the post is too old for bumping, just had the same problem, and had to share the solution. smile

Offline

Board footer

Powered by FluxBB