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
SL Micro 6
Situation
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
test:~ # btrfs fi resize max / Resize device id 1 (/dev/sda3) from 19.98GiB to max ERROR: unable to resize '/': Read-only file systemas 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
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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com