I decided to simplify my storage configuration where LVM had ended up being used for 1 or 2 contiguous partitions, with 1 VG per PV, so it served no purpose over basic partitions.
Several answer sites claim this cannot be done and requires a full backup and restore, but where is the fun in that?
- Ensure the LVM LVs are contiguous using e.g.
pvs -v --segments. If they aren't, eitherpvmovethem so they are, or use the traditional backup+restore technique. - Write down the contents of
dmsetup tableandfdisk -l /dev/sd-whateverfor all the relevant disks. - Grab the last number from
dmsetup table(representing start offset) for the relevant partition and add it to the 'start' column of the PV partition fromfdisk -l. This is the true physical start sector of the partition, ignoring LVM. - Also grab the second number from
dmsetup table- this is the size of the partition in sectors. - Using
fdisk, delete the partition holding the LVM PV, and add a new partition. The start sector is the sector calculated in step 3. The end should be specified as an offset (prefix+) of the sectors gathered in step 4. - Optional: fire up gparted and move partitions to fill the gaps
Comments
found you through a google search. you’re awesome. thank you for sharing 🙂