I had to expand the size of an EC2 EBS root volume that uses btrfs (Fedora 38 Server), so I did the following:
- Stopped the EC2 instance
- Expanded the EBS volume via the EC2 console
- Started the EC2 instance again
Then I was ready to play around with partition resizing and filesystem resizing inside the EC2 instance, but, to my surprise, the system now claims to have done everything automatically. The btrfs partition (nvme0n1p5) seems to be automatically expanded, and the filesystem seems to have the expanded size as well.
If it works I'm not complaining, but what happened here? How did the partition get resized and how come btrfs claims to be able to use all the newly added space, all automatically?
lsblk (post-expansion)
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 252:0 0 3.8G 0 disk [SWAP]
nvme0n1 259:0 0 50G 0 disk
├─nvme0n1p1 259:1 0 1M 0 part
├─nvme0n1p2 259:2 0 1000M 0 part /boot -- ext4
├─nvme0n1p3 259:3 0 100M 0 part /boot/efi ---vfat
├─nvme0n1p4 259:4 0 4M 0 part
└─nvme0n1p5 259:5 0 48.9G 0 part /home -- btrfs subvol
/ -- btrfs subvol
btrfs (post-expansion)
$ sudo btrfs filesystem usage /
Overall:
Device size: 48.92GiB
Device allocated: 5.74GiB
Device unallocated: 43.18GiB
Device missing: 0.00B
Device slack: 3.50KiB
Used: 2.63GiB
Free (estimated): 45.89GiB (min: 24.30GiB)
Free (statfs, df): 45.88GiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 11.00MiB (used: 0.00B)
Multiple profiles: no
Data,single: Size:5.23GiB, Used:2.52GiB (48.17%)
/dev/nvme0n1p5 5.23GiB
Metadata,DUP: Size:256.00MiB, Used:55.95MiB (21.86%)
/dev/nvme0n1p5 512.00MiB
System,DUP: Size:8.00MiB, Used:16.00KiB (0.20%)
/dev/nvme0n1p5 16.00MiB
Unallocated:
/dev/nvme0n1p5 43.18GiB