Resizing partitions is when the potential for data loss becomes worrysome, and I’d definitely want to do a defrag kind of thing first, just to make sure all the data is packed right at the front end of the partition before shrinking it any, and a full backup just to be sure. |
Each filesystem should provide utilities that perform the resize operation, i.e. shuffle the data blocks as required and update the filesystem metadata. Yes, you have to tell the filesystem first to stop using the last sectors in range before you update the partition table about the "last sector" for that partition.
Backups are always a sane thing. IMHO, if you don't maintain backups, then you consider your data worthless.
XFS, the default filesystem in RHEL, has no "shrink" option, only "grow". If one needs smaller volume, then one dumps data to other media, creates smaller volume, and restores data from the dump. (I don't use that default, even though haven't needed a shrink for a while ...)
GParted, a "live distro" (booted from USB) that runs exactly one application, the GUI "parted", calls those filesystem utilities, partition tools, and dd to "resize and move" partitions. The last time I did check, it did not support LVM.
The LVM (Logical Volume Manager) is an abstraction layer. One or more partition can have physical volume (PV), rather than filesystem. Volume group (VG) has one or more PVs. Groups of sectors, extents, are allocated to logical volumes (LV). LV has a filesystem.
It is possible to add or remove extents to LV, like you resize partition. The tool can even call the filesystem's resize utility. The extents do not have to be consecutive, unlike sectors in physical partition. They don't even have to be all within same PV, i.e. an LV can span multiple drives (but like rAID-0 that has its risks). It is also possible to move (copy+delete) extents of LV between PVs, "live" -- on running system. I have replaced drives with that.
The RHEL default is to create 2-3 partitions on the drive:
* /boot/efi, if EFI is in use
* /boot
* a PV
The PV has three LVs by default:
* /
* swap
* /home
Alas, as said, the /, /boot, and /home have XFS and all disk is allocated, so the LVM's additional flexibility is rather unusable.
The /boot/efi cannot be a LV, because UEFI has to load bootloader from it and does not support LVM. The bootloader usually loads kernel from /boot, and again LVM-support could be an issue.