SUSE Support

Here When You Need Us

How to resize the BTRFS root volume of a SLE Micro installation

This document (000021534) is provided subject to the disclaimer at the end of this document.

Environment

SLE Micro 5.5
SL Micro 6

Situation

The BTRFS root volume of a SLE Micro installation runs out of disk space and needs to be resized. 

Resolution

The following example will concentrate on a single root device to explain the steps of the resize operation.
Keep in mind, changes to the partition table can have a catastrophic impact on the system.

Always make sure to have a backup before making changes to the partition table!

In this demo case the partitioning layout is as follows:

test:~ # parted -l /dev/sda
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name      Flags
 1      1049kB  3146kB  2097kB               p.legacy  bios_grub
 2      3146kB  24.1MB  21.0MB  fat16        p.UEFI    boot, esp
 3      24.1MB  64.4GB  64.4GB  btrfs

The goal is to add more disk space to sda3 to expand the BTRFS root filesystem, the root disk will be resized from 50GB to 60GB:

test:~ # btrfs fi show /
Label: 'ROOT'  uuid: d1cdc219-d60c-4c45-a2a3-a174fd59230a
    Total devices 1 FS bytes used 4.73GiB
    devid    1 size 49.98GiB used 5.52GiB path /dev/sda3

1.) Resize the existing disk to the new size using the appropriate tools to accomplish this task. 
2.) Rescan the device to be resized:

test:~ # echo 1 > /sys/block/<devicename>/device/rescan

for example:

test:~ # echo 1 > /sys/block/sda/device/rescan

3.) Resize the root partition using growpart:

test:~ # growpart /dev/sda 3
CHANGED: partition=3 start=47104 old: size=104810463 end=104857567 new: size=125781983 end=125829087

4.) Resize the BTRFS filesystem:

test:~ # btrfs fi resize max /.snapshots
Resize device id 1 (/dev/sda3) from 49.98GiB to max

5.) Check the new size of the filesystem:

test:~ # btrfs fi show /
Label: 'ROOT'  uuid: d1cdc219-d60c-4c45-a2a3-a174fd59230a
    Total devices 1 FS bytes used 4.74GiB
    devid    1 size 59.98GiB used 5.52GiB path /dev/sda3

Cause

Running the "btrfs fi resize max" command on the regular root volume mount point would result in the following error on a SLE Micro installation:
test:~ # btrfs fi resize max /
Resize device id 1 (/dev/sda3) from 19.98GiB to max
ERROR: unable to resize '/': Read-only file system
as the root volume is mounted read-only. "/.snapshots" is mounted read-write and using this volume the operation can be finished online successfully.

Additional Information

This example only illustrates how to resize a single disk with the root partition being the last. In case further partitions exist, the operation may become more complex. If in doubt, open a support case with SUSE Customer Support to discuss details before applying any changes to the partition table.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021534
  • Creation Date: 21-Aug-2024
  • Modified Date:21-Aug-2024
    • SUSE Linux Enterprise Micro

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.