Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
ptmax - maximize a partition in partition table to include its trailing unallocated space Anyone who has tried to resize a partition with LVM's PV on it does know that feeling: what the hell, we are dealing with a 64-bytes 35-years old fixed size structure with bunch of INTs and still CAN NOT JUST RESIZE partition. All existing utilities look grim. Fdisk allows us to do this but with 'DELETE and CREATE' (if you miss numbers, you are fckd up), parted says it doesn't know how to do that with LVM partition and so on. If we have an 'old plain spinning drive' with misarranged partitions, we can say: 'think before creating'. Because bare metal hard drives don't scale. But now we live in the world of virtual machines, iscsi, LVM, MD which offer ways to 'change disk size in 2 clicks'. And what the hell are you supposed to do after the drive (block device) size was changed but the partition table is still the same? Yep. This utility partially solves the problem. It takes a partition name (/dev/sda1, /dev/xvda2 and so on) and attempts to maximize the partition. Only 4 bytes in partition table (size filed), nothing more. After that you can run pvreze, or resize2fs, or whatever, to reflect the change on a higher level. Usage is pretty simple: ptmax /dev/sda3 That's all. It's cautious to avoid doing bad things, so it will max partition size only if PT is sane and there is free space after the targeted partition. It will not move partitions, attempt to use leading unpartitioned space, change the partition number, or alter in any other way the original partitioning schema or data inside partition. Currently there is no support for CHS, LBA only (?), so don't try it on <32Mb partitions.