======================================================================================= DATE : 2021.06.11 TIME : 10:45 AUTHOR : nelliott@sdf.org MOOD : HAPPY TITLE : AN INTERESTING LVM SCENARIO ======================================================================================= An interesting LVM scenario, I had a VM built from a template with a default virtual disk size of 16G. Before I knew better,I would Increase the disk size in VMware, add a new partition to the disk, and grow the root volume group with the new partition. Later on I realized that, after I resize the disk, I can delete the partition and re-add the partition with the new size. All this without harming the root file system. So, again I needed to increase the size of the root volume group. But this time, I had 3 partitions, and two of those were part of the root volume group. How can I clean this up? This is what I did, and it worked nicely. 1) Delete the 3rd partition, and resize it to the new disk size 2) Use vgreduce to remove the 2nd LVM partition # vgreduce rootvg /dev/sda2 3) Use pvmove to move all the data from the 2nd partition to the 3rd one # pvmove /dev/sda2 /dev/sda3 4) Add a new temp disk to move the data from the 3rd partition 5) Use vgreduce, and pvmove again to move the data from the 3rd partition. # vgreduce rootvg /dev/sda3 # pvmove /dev/sda3 /dev/sdb1 6) Recreate the 2nd partition with the full disk size 7) Move data from the temp disk /dev/sdb1 to /dev/sda2 # vgreduce rootvg /dev/sdb1 # pvmove /dev/sdb1 /dev/sda2 The beauty of this, is that all this data moving and handling of disks, disk partitions, can be done on an operational system behind the scenes. Logical volume management, is still a very powerful disk management system. ======================================================================================