Description of problem: When trying to defrag my home and root volumes for transparent compression the `btrfs` command does not defrag /home or /home/, but does defrag /home/$USER Version-Release number of selected component (if applicable): btrfs-progs-5.11-1.fc34.x86_64 How reproducible: Always Steps to Reproduce: 1. Run `sudo btrfs filesystem defrag -czstd -rv /home/` Actual results: No compression or output Expected results: Home directory is compressed, as this command does work with `/` Additional info: This can me worked around by running with /home/$USER/ but could be an annoyance on any multi-user system. For example: `sudo btrfs filesystem defrag -czstd -r / /home/andythurman/` works. [andythurman@rockhopper ~]$ cat /etc/fstab # # /etc/fstab # Created by anaconda on Sat Nov 28 22:39:37 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk/'. # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # UUID=5a74d1ad-e74b-4e95-b270-35e0f11264f4 / btrfs subvol=root,compress=zstd:1 0 0 UUID=8b5ebc80-af92-4537-89a0-fc1d9df5b790 /boot ext4 defaults 1 2 UUID=0CE3-C7A8 /boot/efi vfat umask=0077,shortname=winnt 0 2 UUID=5a74d1ad-e74b-4e95-b270-35e0f11264f4 /home btrfs subvol=home,compress=zstd:1 0 0
Could you run: sudo strace -o stracebtrfsfidefrag.txt btrfs filesystem defrag -czstd -rv /home/ And attach the file to the bug? With the identical command: [chris@fmac ~]$ sudo btrfs filesystem defrag -czstd -rv /home/ /home/chris/.mozilla/firefox/Crash Reports/InstallTime20200709151057 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20200923162236 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20200930210336 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20201006210942 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20201020152157 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20201223104019 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20210106153251 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20210130185517 /home/chris/.mozilla/firefox/Crash Reports/InstallTime20210208183217 /home/chris/.mozilla/firefox/kgw13vhm.default-release/.parentlock ^C
Created attachment 1767139 [details] sudo strace -o stracebtrfsfidefrag.txt btrfs filesystem defrag -czstd -rv /home/ output
> newfstatat(AT_FDCWD, "/home", {st_mode=S_IFLNK|0777, st_size=8, ...}, AT_SYMLINK_NOFOLLOW) = 0 Is this Silverblue? I'm pretty sure /home is a symlink pointing to /var/home. What happens if you point defrag to /var/home?
That was it! Weird that it is mounted as `/home` but still needs the funky /var/home thing. Thanks!
Might still be a bug or missing feature that it doesn't follow symlinks. You could open an upstream bug at https://github.com/kdave//btrfs-progs and cross-reference them, reopening this one for tracking. Include the strace in the upstream bug and ask whether it's intentional to not follow symlinks. The use case is all rpm-ostree installations will do this, maybe there are other examples. Also can you paste /etc/fstab here? I'm assuming the "home" subvolume is mounted at /var/home, not at /home because / is read-only and I'm pretty sure it's not possible to mount anything on read-only directories, hence the symlink.
I included my fstab earlier. That was from an installation of 33. The only thing I changed was the compression argument. I need to go now, but tomorrow I will look more into the Silverblue file system and possibly report that upstream. Thank you again!
:facepalm: > UUID=5a74d1ad-e74b-4e95-b270-35e0f11264f4 /home btrfs subvol=home,compress=zstd:1 0 0 I guess then that systemd is resolving the /home symlink to /var/home and actually mounts it there; and /proc/mounts shows this.
Also does the problem happen if you try to defrag /home instead of /home/ ?
(In reply to Chris Murphy from comment #8) > Also does the problem happen if you try to defrag /home instead of /home/ ? Yes > newfstatat(AT_FDCWD, "/home", {st_mode=S_IFLNK|0777, st_size=9, ...}, AT_SYMLINK_NOFOLLOW) = 0
Possibly related: https://github.com/kdave/btrfs-progs/issues/260
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle. Changing version to 35.
This message is a reminder that Fedora Linux 35 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13. 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 '35'. 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 35 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.
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13. Fedora Linux 35 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 Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed.