Target system is CentOS 6.x but resizing operations will be done in %pre section of CentOS 7.6 kickstart.
I have already run resize2fs -M /dev/mapper/centos-home
successfully.
If I mount the volume, df says it's 100% full. This is good.
Now I need to reduce the size of the logical volume to match the size of the ext4 filesystem. I don't want to use rough estimates. I also don't need to conserve every possible extent. Within a >= 1GB range is fine. i.e. volume can be reduced to 1GB >= filesystem size.
The target volume does contain data I can't lose. I don't have shell (or any other) access to the system. The system has no CentOS repos available so I cannot upgrade it. I don't even have remote hands I can talk to. I'm using a different computer to build and test my install ISO on.
My %pre syntax/script needs to safely reduce /dev/mapper/centos-home so I can create a new root volume for CentOS 7.6 install. Yes, this entire proposition is nuts.
Do it in one step.
Where 8g is the size of the root volume you want to install.
Constant size may be acceptable because the size of your new install is predictable.
It's not really a script per se.