0

While installing Fedora 33, I chose btrfs, with 32gb for / and the rest for /home

I see these are used as 'subvolumes':

# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Mon Oct 19 13:43:25 2020
#
UUID=f1483466-114c-4ef4-b268-85095d4c4aa8 /                       btrfs   subvol=root,x-systemd.device-timeout=0 0 0
UUID=ef7bc629-cb70-458a-9463-2666c2c233a7 /boot                   ext4    defaults        1 2
UUID=F206-0546          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=f1483466-114c-4ef4-b268-85095d4c4aa8 /home                   btrfs   subvol=home,x-systemd.device-timeout=0 0 0

I'd like to see how much space is used & free for each partition, but df shows only the total:

Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       924G   27G  895G   3% /
tmpfs           3.9G   12K  3.9G   1% /tmp
/dev/dm-0       924G   27G  895G   3% /home

Tried these:

# btrfs device usage /
/dev/mapper/luks-662fb4fb-75b3-4888-a617-0c039f575d3a, ID: 1
   Device size:           923.00GiB
   Device slack:              0.00B
   Data,single:            27.01GiB
   Metadata,DUP:            2.00GiB
   System,DUP:             16.00MiB
   Unallocated:           893.98GiB

# btrfs subvolume list /
ID 256 gen 7177 top level 5 path home
ID 258 gen 7176 top level 5 path root
ID 265 gen 30 top level 258 path var/lib/machines

# btrfs filesystem df /root
Data, single: total=27.01GiB, used=26.17GiB
System, DUP: total=8.00MiB, used=16.00KiB
Metadata, DUP: total=1.00GiB, used=386.67MiB
GlobalReserve, single: total=45.22MiB, used=0.00B

# btrfs filesystem df /home
Data, single: total=27.01GiB, used=26.17GiB
System, DUP: total=8.00MiB, used=16.00KiB
Metadata, DUP: total=1.00GiB, used=386.67MiB
GlobalReserve, single: total=45.22MiB, used=0.00B

How can I see / total size of 32gb and how much is used, and same for /home?

1

It looks like there is a single partition, split into multiple subvolumes. Subvolumes share the underlying filesystem so the filesystem size and usage for both is indeed the same.

I don't use Fedora but if the installer honored the 32GB restriction on /, it is likely through a qgroup that limits the maximum usage of a given subvolume.

Try btrfs qgroup show / and btrfs qgroup show /home.

4
  • Thanks for clarification! It says ERROR: can't list qgroups: quotas not enabled > Subvolumes share the underlying filesystem so the filesystem size and usage for both is indeed the same. Unrelated, do you know if I can still format / on next install, while keeping /home intact? – Marius Oct 20 '20 at 11:14
  • Since quotas aren't enabled, I'd say they both share the filesystem with no restriction so / isn't limited to the expected 32Gb. You can enable quotas dynamically to restrict / if you'd like. Reformatting would require shrinking the filesystem, the partition and then adding a new one for little to no gain. What's the end goal? – Ginnungagap Oct 20 '20 at 11:41
  • To reformat / when installing a new Linux version every 6 months, while keeping data in /home Should I have been more careful to select 2 different volumes during install? – Marius Oct 20 '20 at 18:22
  • 1
    Again, I'm no expert on Fedora so I strongly suggest you test this is a VM but when I'm forced to use Ubuntu I know reinstalling with / and /home pointing to a single btrfs filesystem without formatting will clear / while preserving /home. However again, I'm not clear on why you're reinstalling every 6 month but this will turn into a thread if this keeps going. Ultimately I'd say it should work but you need to test it out, and if you're planning on doing it regularly, splitting the partitions might be easier. – Ginnungagap Oct 20 '20 at 18:44
0

A subvolume for each release:

The LVM Way would have been to create a new LV for each release (I name them f26, f28, f30, f32, ...) - it is too late for that without some reshuffling. Article on the LVM way: https://fedoramagazine.org/use-lvm-upgrade-fedora/

The Btrfs Way is to create a new writable snapshot subvolume, create new grub entry to mount it on /, reboot to test, and then dnf system-upgrade. Now you can boot into the old or the new subsystem. Hopefully, I'll have another article ready by f34.

Rather than waiting for f34 to actually try this, I converted an f31 root to btrfs, and will be doing the system-upgrade in a btrfs snapshot to test. (With an LVM copy just to make sure!)

I do plan to keep using LVM with standard LVs (no thin-pool) "underneath" btrfs. Standard LVS are as robust as partitions, and much more flexible. (Grub2 can even boot with /boot in a standard LV.) It is possible to skip the partition table altogether, but it is better to keep it - even with only a single big partition - just so that other software knows the disk is in use. Also, you need a GPT for EFI boot.

1
  • thanks for the advice! – Marius Oct 29 '20 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.