How add more space in a Btrfs Filesystem, How add a new partition, How add a new disk, Linux

The words that guides you towards the solution are.

Steps:

  • Check the current space in your disk.
  • Space in /dev/sdc2 partition , size: 136G, avail: 37G
[root@f34 chris]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  7.7G     0  7.7G   0% /dev
tmpfs          tmpfs     7.8G     0  7.8G   0% /dev/shm
tmpfs          tmpfs     3.1G  1.8M  3.1G   1% /run
/dev/sdc2      btrfs     136G   99G   37G  74% /
tmpfs          tmpfs     7.8G   44K  7.8G   1% /tmp
/dev/sdb1      vfat       96M   49M   48M  51% /boot/efi
tmpfs          tmpfs     1.6G  996K  1.6G   1% /run/user/1000

You can insert a new disk, create one or more partitions there. You can use an available space in your currents disks (SSD or HDD).

 btrfs device add /dev/sdb5 /
  • check
    btrfs device usage /
[root@f34 chris]# btrfs device usage /
/dev/sdc2, ID: 1
   Device size:           135.03GiB
   Device slack:              0.00B
   Data,single:            99.01GiB
   Metadata,single:         1.01GiB
   System,single:           4.00MiB
   Unallocated:            35.01GiB

/dev/sdb5, ID: 2
   Device size:           100.00GiB
   Device slack:              0.00B
   Unallocated:           100.00GiB
  • check the new space is reflected in the disk.
    df -h /
[chris@f34 ~]$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc2       236G  105G  131G  45% /
[chris@f34 ~]$ 

Now /dev/sdc2 has 236G in size, 136G(before) + 100G(/dev/sdb5).

Very good. That’s all.


Something Additional, it’s not necessary

You can balance the space in your disk

  • Distribute the metadata across the devices. This take me 15 minutes, you can use balance filters to narrow down the balanced data.
btrfs filesystem balance /
[root@f34 chris]# btrfs filesystem balance /

Done, had to relocate 103 out of 103 chunks
[root@f34 chris]# 

After that, there is more space in /dev/sdc2, avail: 137G

[root@f34 chris]# df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc2       236G   99G  137G  43% /
[root@f34 chris]#
5 Likes