You are not logged in.
Hello,
I am a newbei in archlinux. However I have been using manjaro for probably last 5 years, I finally decided to try pure arch and installed archlinux. I am using luks, btrfs, systemd-boot in my new arch setup. However, I have a big problem. btrfs is trashing my new nvme drive with btrfs-cleaner process.
My setup consist as follows
nvme0n1 259:0 0 953.9G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
└─nvme0n1p2 259:2 0 952.9G 0 part
└─cryptroot 254:0 0 952.9G 0 crypt /var/log
/var/lib/portables
/var/lib/machines
/var/cache
/home/user
/var
/tmp
/swap
/home
/.snapshots
/my fstab is as follows
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 / btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=256,subvol=/@ 0 0
# /dev/nvme0n1p1
UUID=936E-C8A5 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /home btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=257,subvol=/@home 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /home/user btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=259,subvol=/@home/user 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /var btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=261,subvol=/@var 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /var/lib/machines btrfs rw,noatime,nodatacow,ssd,space_cache=v2,commit=120,subvolid=268,subvol=/@var/lib/machines 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /var/lib/portables btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=267,subvol=/@var/lib/portables 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /var/log btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=262,subvol=/@var/log 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /var/cache btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=263,subvol=/@var/cache 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /tmp btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=266,subvol=/@tmp 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /.snapshots btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=264,subvol=/@.snapshots 0 0
# /dev/mapper/cryptroot LABEL=btrfsroot
UUID=9899f9ce-5738-4f69-9410-9e76b76817f1 /swap btrfs rw,noatime,nodatacow,ssd,space_cache=v2,commit=120,subvolid=260,subvol=/@swap 0 0
/swap/swapfile none swap defaults 0 0the output of findmnt is as follows
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/cryptroot[/@] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=256,subvol=/@
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=31,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1730
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime
│ ├─/sys/firmware/efi/efivars efivarfs efivarfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/fuse/connections fusectl fusectl rw,nosuid,nodev,noexec,relatime
│ └─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
├─/dev devtmpfs devtmpfs rw,nosuid,size=4096k,nr_inodes=1048576,mode=755,inode64
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,inode64
│ ├─/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,relatime,pagesize=2M
│ └─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime
├─/run tmpfs tmpfs rw,nosuid,nodev,size=6547432k,nr_inodes=819200,mode=755,inode64
│ └─/run/user/3000 tmpfs tmpfs rw,nosuid,nodev,relatime,size=3273712k,nr_inodes=818428,mode=700,uid=3000,gid=3000,inode64
├─/.snapshots /dev/mapper/cryptroot[/@.snapshots] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=264,subvol=/@.snapshots
├─/home /dev/mapper/cryptroot[/@home] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=257,subvol=/@home
│ └─/home/user /dev/mapper/cryptroot[/@home/user] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=259,subvol=/@home/user
├─/swap /dev/mapper/cryptroot[/@swap] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=260,subvol=/@swap
├─/tmp /dev/mapper/cryptroot[/@tmp] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=266,subvol=/@tmp
├─/var /dev/mapper/cryptroot[/@var] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=261,subvol=/@var
│ ├─/var/cache /dev/mapper/cryptroot[/@var/cache] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=263,subvol=/@var/cache
│ ├─/var/lib/machines /dev/mapper/cryptroot[/@var/lib/machines] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=268,subvol=/@var/lib/machines
│ ├─/var/lib/portables /dev/mapper/cryptroot[/@var/lib/portables] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=267,subvol=/@var/lib/portables
│ └─/var/log /dev/mapper/cryptroot[/@var/log] btrfs rw,noatime,compress=zstd:3,ssd,space_cache=v2,autodefrag,commit=120,subvolid=262,subvol=/@var/log
└─/boot /dev/nvme0n1p1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-roI have also noticed that btrfs does not respect mount options. Even though fstab stated nocompression or nodatacow, the mount options looks different on findmnt.
Quotas are not activated.
Any help much appreciated.
I
Last edited by benibilme (2022-02-21 21:32:34)
Offline
Please edit your post and put [code] [/code] tags around all commands and their outputs. Thanks.
https://bbs.archlinux.org/help.php#bbcode
I have also noticed that btrfs does not respect mount options. Even though fstab stated nocompression or nodatacow, the mount options looks different on findmnt.
BTRFS has never supported different mount options for subvolumes. They will always inherit the options of the root volume.
Offline
Remove the autodefrag mount option for now. There are some uostream patches to fix this issue but to my knowledge they aren't merged yet. I still had this problem with kernel 5.16.9.
Offline
Hello,
I have found the problem. Based on the information at arch wiki https://wiki.archlinux.org/title/Btrfs, the subsection defragmentation gives a warning as follows.
Warning: A major regression in the Linux kernel version 5.16.x < 5.16.5 causes Btrfs defragmentation to infinitely loop on some systems, affecting both manual and automatic defragmentation. This causes extreme I/O loads on the affected drives, which can heavily shorten their life time and affect their performance. As such, it is not recommended to use autodefrag on these versions, one should even use noautodefrag to make sure online defragmentation is disabled. See [9] and [10].
I have replaced autodefrag statements in /etc/fstab and the problem has been solved. Now I have handle trimming without autodefragmentation.
Offline
Remove the autodefrag mount option for now. There are some uostream patches to fix this issue but to my knowledge they aren't merged yet. I still had this problem with kernel 5.16.9.
Thank you for the response. I really appreciate. I just show your comment after posting mine. Yes, I did your suggestion and it solved. However how to handle defragmentation now?
Offline
Remove the autodefrag mount option for now. There are some uostream patches to fix this issue but to my knowledge they aren't merged yet. I still had this problem with kernel 5.16.9.
I remember reading this warning by chance while installing arch linux, and deliberately installed lts kernel 5.15.24 which is below the version of 5.16. I thought that I was going to be immune to this btrfs bug. Now it does not seem only kernel version problem. It seems more like a btrfs version problem. Maybe the warning in the arch linux wiki about kernel version numbers should be updated. LTS kernel is definetely also susceptible to this issue.
Warning: A major regression in the Linux kernel version 5.16.x < 5.16.5 causes Btrfs defragmentation to infinitely loop on some systems, affecting both manual and automatic defragmentation. This causes extreme I/O loads on the affected drives, which can heavily shorten their life time and affect their performance. As such, it is not recommended to use autodefrag on these versions, one should even use noautodefrag to make sure online defragmentation is disabled. See [9] and [10].
Offline
Currently this problem still exists with 5.16.11.
But since they merged their patches the problem moved from my HDD, to my SSD.
So they probably broke something by fixing.
Offline
Hello,
Is this problem solved? Do you have any idea?
Offline