You are not logged in.
Pages: 1
I'm still somewhat new dealing with btrfs and after reading the wiki I still have questions about the best solution to my issue:
My current ssd (4TB) is running out of space (see the full btrfs filesystem usage / at the end of this message).
Current stats:
Device size: 3.73TiB
Device allocated: 969.02GiB
Device unallocated: 2.78TiB
If I am reading that correctly I have 2.78TiB unused. So, can I execute this command:
btrfs filesystem resize max / to allocate the rest of the space?
If so:
-Can I do this while the system is running?
-Do I need to do anything else after executing this command (Balance?)
If not:
-What would you recommend?
Thank you for your time in reading this!
** btrfs filesystem usage / **
Overall:
Device size: 3.73TiB
Device allocated: 969.02GiB
Device unallocated: 2.78TiB
Device missing: 0.00B
Device slack: 0.00B
Used: 825.92GiB
Free (estimated): 2.89TiB (min: 1.50TiB)
Free (statfs, df): 2.89TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 0.00B)
Multiple profiles: no
Data,single: Size:933.01GiB, Used:817.35GiB (87.60%)
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 933.01GiB
Metadata,DUP: Size:18.00GiB, Used:4.29GiB (23.81%)
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 36.00GiB
System,DUP: Size:8.00MiB, Used:128.00KiB (1.56%)
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 16.00MiB
Unallocated:
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 2.78TiB
Offline
Just tested this out in a VM with a LUKS encrypted root btrfs partition by booting the latest arch.iso.
Disclaimer: Proper backups are crucial before carrying out any disk operations as there is always a chance for data loss.
1. determine which partition to work on
root@archiso ~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 841.4M 1 loop /run/archiso/airootfs
sr0 11:0 1 1.2G 0 rom /run/archiso/bootmnt
vda 254:0 0 60G 0 disk
├─vda1 254:1 0 2G 0 part
└─vda2 254:2 0 28G 0 part
root@archiso ~ # blkid --match-token TYPE="crypto_LUKS" --output device
/dev/vda22. perform a resize on that partition (ensure you work on the whole disk)
root@archiso ~ # parted /dev/vda resizepart 2 100%
Information: You may need to update /etc/fstab.3. unlock the partition
root@archiso ~ # cryptsetup open /dev/vda2 root
Enter passphrase for /dev/vda2:
cryptsetup open /dev/vda2 root 7.26s user 0.14s system 224% cpu 3.300 total4. mount the luks volume to resize
root@archiso ~ # mount -o compress=zstd /dev/mapper/root /mnt
<...NO_OUTPUT...>5. resize the btrfs filesystem
root@archiso ~ # btrfs filesystem resize max /mnt
Resize device id 1 (/dev/mapper/root) from 27.98GiB to max
WARNING: the new size 0 (0.00B) is < 256MiB, this may be rejected by kernel6. verify the size change
root@archiso ~ # btrfs filesystem usage /mnt
Overall:
Device size: 57.98GiB
Device allocated: 3.52GiB
Device unallocated: 54.46GiB
Device missing: 0.00B
Device slack: 3.50KiB
Used: 2.39GiB
Free (estimated): 55.22GiB (min: 27.99GiB)
Free (statfs, df): 55.22GiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 5.94MiB (used: 0.00B)
Multiple profiles: no
Data,single: Size:3.01GiB, Used:2.25GiB (74.79%)
/dev/mapper/root 3.01GiB
Metadata,DUP: Size:256.00MiB, Used:71.88MiB (28.08%)
/dev/mapper/root 512.00MiB
System,DUP: Size:8.00MiB, Used:16.00KiB (0.20%)
/dev/mapper/root 16.00MiB
Unallocated:
/dev/mapper/root 54.46GiBAnd to answer your questions:
Q: Can I do this while the system is running?
A: Unknown, but I can attest that the above method worked for me.
Q: Do I need to do anything else after executing this command (Balance?)
A: Someone else can chime in here, but I don't see a reason to balance if you are just extending a single drive.
Offline
Thank you tcloud for the amazing post!! I followed it to the letter and I believe btrfs has the entire drive space now, but my home directory is still nearly full.
Besides information from the terminal I have also included four screenshots so you can see what I am seeing (they are at the bottom of post):
-- Gpated: Space allocated to btrfs partition
-- btrfs assistant: Also reports the additional space
-- drive properties: Also reports space
-- qdirstat: Show my home directory near full
Do I have to resize the @home subvolume now that the partition has additional space? Thank you again for the help!
lsblk below shows the drive as 3.7TB and the nvme1n1p2 is also 3.7TB which I think means the space is allocated to btrfs
** lsblk **
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 252:0 0 62.5G 0 disk [SWAP]
nvme1n1 259:0 0 3.7T 0 disk
├─nvme1n1p1 259:1 0 300M 0 part /boot/efi
└─nvme1n1p2 259:2 0 3.7T 0 part
└─luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587
253:0 0 3.7T 0 crypt /home
/var/cache
/var/log
/root
/srv
/var/tmp
/
nvme0n1 259:3 0 476.9G 0 disk
└─nvme0n1p1
Here sudo btrfs filesystem usage / shows that 2.89TB is unallocated though:
** sudo btrfs filesystem usage / **
Overall:
Device size: 3.73TiB
Device allocated: 851.02GiB
Device unallocated: 2.89TiB
Device missing: 0.00B
Device slack: 0.00B
Used: 704.30GiB
Free (estimated): 3.01TiB (min: 1.56TiB)
Free (statfs, df): 3.01TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 0.00B)
Multiple profiles: no
Data,single: Size:815.01GiB, Used:695.97GiB (85.39%)
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 815.01GiB
Metadata,DUP: Size:18.00GiB, Used:4.16GiB (23.12%)
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 36.00GiB
System,DUP: Size:8.00MiB, Used:112.00KiB (1.37%)
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 16.00MiB
Unallocated:
/dev/mapper/luks-2f3ddd75-cead-49b3-a4b4-3a73529c2587 2.89TiB
Screenshots:



Offline
> ...my home directory is still nearly full.
If you are referring to the QDirStat output, I believe that is a representation of total space. You could check upstream to see why the tool doesn't report a percentage out of your available drive space.
> Do I have to resize the @home subvolume now that the partition has additional space?
Negative. You would only need to adjust quotas on the subvolumes if you had them. You do not appear to have enabled quotas.
> Here sudo btrfs filesystem usage / shows that 2.89TB is unallocated though:
This is unused space, not unassigned.
Offline
Pages: 1