Resize root LVM partition on CentOS

Loading

I installed my server using the default partition sizes recommended during installation. Over time, I realized that I used more space of other partitions than /home. After much searching around, this is what I did to get my server’s partition resized.

WARNING! THE FOLLOWING STEPS MAY CAUSE DAMAGED TO YOUR PARTITION AND IRRECOVERABLE DATA LOSS. BACKUP YOUR FILES BEFORE CONTINUE. USE AT YOUR OWN RISK!

  1. Boot CentOS into Rescue Mode using CentOS installation DVD.
  2. Unmount the partition you wish to reduce the size.
    umount /dev/mapper/VolGroup-lv_home
  3. Sanity check on the drive
    e2fsck -f /dev/mapper/VolGroup-lv_home
  4. Resize the partition
    resize2fs /dev/mapper/VolGroup-lv_home 20G
  5. Reduce the VolGroup partition
    lvreduce -L-400G /dev/mapper/VolGroup-lv_home
  6. Increase the root VolGroup partition
    lvextend -L+400G /dev/mapper/VolGroup-lv_root
  7. Increase the partitions to occupy full remaining space
    resize2fs /dev/mapper/VolGroup-lv_root
    resize2fs /dev/mapper/VolGroup-lv_home
  8. reboot

Leave a Comment