Bug 2017895 - btrfs: 74% used, dnf reports no space left on device
Summary: btrfs: 74% used, dnf reports no space left on device
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: fedora-kernel-btrfs
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-10-27 16:30 UTC by Chris Murphy
Modified: 2022-06-07 21:08 UTC (History)
19 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-06-07 21:08:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Chris Murphy 2021-10-27 16:30:13 UTC
kernel-5.14.13-200.fc34.x86_64
btrfs-progs v5.14.2 

dnf update results in the following:

Total download size: 47 M
Is this ok [y/N]: y
Downloading Packages:
[Errno 28] No space left on device: '/var/cache/dnf/download_lock.pid'
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.

There are no btrfs complaints in dmesg.

# sudo btrfs filesystem usage /
Overall:
    Device size:		 215.27GiB
    Device allocated:		 215.27GiB
    Device unallocated:		   1.00MiB
    Device missing:		     0.00B
    Used:			 158.25GiB
    Free (estimated):		  56.26GiB	(min: 56.26GiB)
    Free (statfs, df):		  56.26GiB
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		 374.73MiB	(used: 752.00KiB)
    Multiple profiles:		        no

Data,single: Size:209.24GiB, Used:152.98GiB (73.11%)
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	 209.24GiB

Metadata,DUP: Size:3.00GiB, Used:2.64GiB (87.75%)
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	   6.01GiB

System,DUP: Size:8.00MiB, Used:48.00KiB (0.59%)
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	  16.00MiB

Unallocated:
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	   1.00MiB

# grep -R . allocation/
allocation/metadata/disk_used:5660606464
allocation/metadata/bytes_pinned:0
allocation/metadata/bytes_used:2830303232
allocation/metadata/dup/used_bytes:2830303232
allocation/metadata/dup/total_bytes:3225419776
allocation/metadata/disk_total:6450839552
allocation/metadata/total_bytes:3225419776
allocation/metadata/bytes_reserved:81920
allocation/metadata/bytes_readonly:65536
allocation/metadata/bytes_zone_unusable:0
allocation/metadata/bytes_may_use:394821632
allocation/metadata/flags:4
allocation/system/disk_used:98304
allocation/system/bytes_pinned:0
allocation/system/bytes_used:49152
allocation/system/dup/used_bytes:49152
allocation/system/dup/total_bytes:8388608
allocation/system/disk_total:16777216
allocation/system/total_bytes:8388608
allocation/system/bytes_reserved:0
allocation/system/bytes_readonly:0
allocation/system/bytes_zone_unusable:0
allocation/system/bytes_may_use:0
allocation/system/flags:2
allocation/global_rsv_reserved:392937472
allocation/data/disk_used:164259119104
allocation/data/bytes_pinned:0
allocation/data/bytes_used:164259119104
allocation/data/single/used_bytes:164259119104
allocation/data/single/total_bytes:224672088064
allocation/data/disk_total:224672088064
allocation/data/total_bytes:224672088064
allocation/data/bytes_reserved:0
allocation/data/bytes_readonly:0
allocation/data/bytes_zone_unusable:0
allocation/data/bytes_may_use:0
allocation/data/flags:1
allocation/global_rsv_size:392937472

# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G  2.9M  7.8G   1% /dev/shm
tmpfs           3.2G  1.9M  3.2G   1% /run
/dev/dm-1       216G  159G   57G  74% /
tmpfs           7.8G  544K  7.8G   1% /tmp
/dev/dm-1       216G  159G   57G  74% /home

# btrfs balance start -dlimit=5 /
ERROR: error during balancing '/': No space left on device
There may be more info in syslog - try dmesg | tail
# dmesg | grep -i btrfs
[26990.960096] BTRFS info (device dm-1): balance: start -dlimit=5
[26990.960283] BTRFS info (device dm-1): relocating block group 232308867072 flags data
[26991.395723] BTRFS info (device dm-1): 5 enospc errors during balance
[26991.395736] BTRFS info (device dm-1): balance: ended with status: -28


User manages to unwind this with a combination of file deletion, `btrfs balance` and `btrfs fi defrag` but the only dmesg messages:

[ 2150.255309] BTRFS info (device dm-1): balance: start -musage=0 -susage=0
[ 2150.255601] BTRFS info (device dm-1): 1 enospc errors during balance
[ 2150.255603] BTRFS info (device dm-1): balance: ended with status: -28
[ 2176.063300] BTRFS info (device dm-1): balance: start -dusage=0
[ 2176.063665] BTRFS info (device dm-1): balance: ended with status: 0
[ 2694.513497] BTRFS info (device dm-1): balance: start -musage=0 -susage=0
[ 2694.513693] BTRFS info (device dm-1): relocating block group 232308867072 flags metadata|dup
[ 2694.614748] BTRFS info (device dm-1): balance: ended with status: 0
[ 2700.244667] BTRFS info (device dm-1): balance: start -dusage=0
[ 2700.245019] BTRFS info (device dm-1): balance: ended with status: 0
[ 2706.597774] BTRFS info (device dm-1): balance: start -dusage=1
[ 2706.598094] BTRFS info (device dm-1): balance: ended with status: 0
[ 2712.430864] BTRFS info (device dm-1): balance: start -musage=1 -susage=1
[ 2712.431178] BTRFS info (device dm-1): relocating block group 232294711296 flags system|dup
[ 2712.537731] BTRFS info (device dm-1): balance: ended with status: 0
[ 2717.244173] BTRFS info (device dm-1): balance: start -musage=2 -susage=2
[ 2717.244466] BTRFS info (device dm-1): balance: ended with status: 0
[ 2722.061152] BTRFS info (device dm-1): balance: start -dusage=2
[ 2722.061519] BTRFS info (device dm-1): balance: ended with status: 0


Resulting in the following allocations:

# btrfs filesystem usage /
Overall:
    Device size:		 215.27GiB
    Device allocated:		 211.27GiB
    Device unallocated:		   4.00GiB
    Device missing:		     0.00B
    Used:			 151.07GiB
    Free (estimated):		  62.42GiB	(min: 60.42GiB)
    Free (statfs, df):		  62.42GiB
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		 372.73MiB	(used: 0.00B)
    Multiple profiles:		        no

Data,single: Size:204.24GiB, Used:145.82GiB (71.40%)
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	 204.24GiB

Metadata,DUP: Size:3.50GiB, Used:2.62GiB (74.90%)
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	   7.01GiB

System,DUP: Size:8.00MiB, Used:48.00KiB (0.59%)
   /dev/mapper/luks-e5fbe4ab-0ae9-4428-87c0-5c98b5acadd1	  16.00MiB


So I think what happened is some file deletion and/or defragment made it possible for `btrfs balance --dusage=0` to create just enough unallocated space for one more 512MiB metadata bg to be created, relieving the problem.

Comment 3 Jan Vlug 2021-11-22 22:01:35 UTC
I am not sure, but I think that this crash might be related to this issue: Bug 2018679.

Comment 4 Ben Cotton 2022-05-12 15:11:23 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Ben Cotton 2022-06-07 21:08:19 UTC
Fedora Linux 34 entered end-of-life (EOL) status on 2022-06-07.

Fedora Linux 34 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.