Grow Btrfs root partition on openSUSE server after disk resize (preserve /home XFS)

Hi Everyone,

I could really use some help figuring out how to safely expand the root partition on my Linux server VM. I’ve added 50GB of extra space to the VM’s virtual disk, and I can see it using fdisk, but I’m unsure how to allocate it without breaking the system.

Here’s my current partition layout:

home-srv-01:~ #  lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0  100G  0 disk 
├─sda1   8:1    0    8M  0 part 
├─sda2   8:2    0 30.8G  0 part /var
│                               /usr/local
│                               /tmp
│                               /boot/grub2/i386-pc
│                               /boot/grub2/x86_64-efi
│                               /opt
│                               /srv
│                               /.snapshots
│                               /root
│                               /
├─sda3   8:3    0 17.2G  0 part /home
└─sda4   8:4    0    2G  0 part [SWAP]
sr0     11:0    1 15.3G  0 rom  
home-srv-01:~ #

home-srv-01:~ # fdisk -l
GPT PMBR size mismatch (104857599 != 209715199) will be corrected by write.
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A1C8759F-D45C-4FB4-A365-1402AD4516B3

Device         Start       End  Sectors  Size Type
/dev/sda1       2048     18431    16384    8M BIOS boot
/dev/sda2      18432  64600063 64581632 30.8G Linux filesystem
/dev/sda3   64600064 100661247 36061184 17.2G Linux filesystem
/dev/sda4  100661248 104857566  4196319    2G Linux swap
home-srv-01:~ # 

The goal is to expand the Btrfs root partition (sda2) into the new free space without losing the data on /home (sda3 XFS) or causing the system to become unbootable. Unfortunately, my earlier attempts resulted in boot issues, so I’m being extra cautious now.

Recap of Steps:

  1. Backed up all data from /home (/dev/sda3).
  2. Booted into a live CD/USB environment.
  3. Moved data from /home to an external disk.
  4. Ran swapoff /dev/sda4 and deleted /dev/sda4.
  5. Deleted /dev/sda3 (this creates free space next to /dev/sda2).
  6. Resized the Btrfs filesystem on /dev/sda2 using btrfs filesystem resize max /.
  7. Recreated /dev/sda3 and restored the /home data from the backup.
  8. Recreated /dev/sda4 and ran swapon /dev/sda4.
  9. Once completed, the system does not boot anymore.

Thanks a lot in advance for any advice or step-by-step suggestions. I’d really appreciate your guidance.

LinuXplorer

Without the description of actual errors it will be guesswork only. Educated guess - you need to update references to the /home and swap with the new UUIDs. Check /etc/fstab and /etc/default/grub and recreate initrd.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.