I recently expanded my HD by +200GB instead of +100GB by accident. I booted up my machine, and went to use parted to expand by 100GB with resize, but it failed: (parted) resize 2 100GB Error: The resize command has been removed in parted 3.0
I see there is growpart, but I don’t want to use the full 200GB, only an extra 100GB. How can I do this?
fdisk -l:
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 419430399 417331200 199G 8e Linux LVM
You have two partitions and the second is a LVM PV. There are more than one way to proceed.
One could add a third partition, initialize it as PV, add to the VG, and expand LV(s) as necessary
One could remove partition 2 and create it again (same start and type, correct size). Then pvresize and expand LV(s)
One could use that growpart. Then expand LV(s)
One could add a third partition, initialize filesystem to it, and mount it where needed
One could “shrink the HDD” by 100GB and then growpart?
What is growpart?
$ dnf provides *bin/growpart
cloud-utils-growpart-0.33-1.el9.x86_64 : Script for growing a partition
Repo : appstream
Matched from:
Other : *bin/growpart
$ dnf info cloud-utils-growpart | grep -A5 Description
Description : This package provides the growpart script for growing a partition. It is
: primarily used in cloud images in conjunction with the dracut-modules-growroot
: package to grow the root partition on first boot.
Apparently a script that calls sfdisk or sgdisk (and pvresize) to manipulate partition table (and PV).
if [ -n "${free_percent}" ]; then
free_percent_sectors=$((sector_num/100*free_percent))
...
If the disk is now 400GB, then free_percent should be 25 in order to leave 100GB free?