Resizing BTRFS
1. Resizing a BTRFS LVM partition on SUSE Linux Enterprise Server
When managing a SUSE Linux Enterprise Server installation, the BTRFS root file system can become full due to files, caches, or snapshots. Because removing snapshots manually is not recommended, the best approach is to resize the partition.
|
To resize a BTRFS partition, the partition must remain mounted during this procedure. |
The following steps illustrate how to resize a BTRFS LVM partition by adding a new disk (for example, /dev/sdb) to the volume group.
Check the disk information to identify the root file system device and the new disk using the
lsblkcommand:lsblkCreate a physical volume on the newly added disk:
pvcreate /dev/sdbScan for the current volume group that the root file system is using:
vgscanExtend the volume group with the newly created physical volume:
vgextend system /dev/sdbExtend the logical volume using the extended volume group:
lvextend -l +100%FREE /dev/system/rootResize the BTRFS root file system:
btrfs filesystem resize max /Check the result to verify that the system’s root file system has been successfully resized to the new capacity:
lsblk
2. Resizing a BTRFS root volume on SL Micro
When managing a SLE Micro 5.5 or SL Micro 6 installation, the BTRFS root volume may run out of disk space and require resizing.
Attempting to resize the root volume using the standard command btrfs fi resize max / will result in the following error:
ERROR: unable to resize '/': Read-only file system
This occurs because the root volume is mounted read-only on SLE Micro systems.
To successfully complete the operation online, you must target the /.snapshots mount point instead, which is mounted read-write.
|
Changes to the partition table can cause damage to the system. Always make sure to have a complete backup before making changes to the partition table. |
The following procedure illustrates how to resize a single disk where the root partition is the last partition on the device (for example, /dev/sda3).
If your layout contains further partitions, the operation may become more complex and you may need to reach out to SUSE Customer Center for support.
Resize the existing disk to the new size using the appropriate hypervisor or storage tools for your environment.
Rescan the device to be resized. For example, to rescan
/dev/sda, run the following command as root:echo 1 > /sys/block/sda/device/rescanResize the root partition using the comamnd
growpart. In this example, we resize partition 3 on/dev/sda:growpart /dev/sda 3Resize the BTRFS filesystem. Be sure to use
/.snapshotsinstead of/to avoid the read-only error:btrfs fi resize max /.snapshotsCheck the filesystem to verify that the new size has been applied successfully:
btrfs fi show /