Francis Spedafino

How to extend existing partitions (manually) (CentOS)

Discussion created by Francis Spedafino Expert on Mar 31, 2017

These instructions are for when you are extending the existing hard disk and NOT adding a new hard disk.

  1. Extend hard drive space in your hypervisor (vCenter shown below)
     
  2. To avoid restarting the VM run the following command on your Turbonomic instance

    echo "- - -" > /sys/class/scsi_disk//0\:0\:0\:0/device/rescan
  3. Look at your current disk partition table

    fdisk -l

  4. Next create the physical volume and set it to the Linux LVM type

    fdisk /dev/sda
    1. n

    2. p
    3. 3 (in the last screenshot we saw that sda1 and sda2 exist so we will be creating 3)
    4. <enter>
    5. <enter>
    6. t
    7. 3
    8. 8e
    9. w


  5. Now we will update the partition table to include sda3

    partprobe
  6. Next we run the command to initialize the partition so it can be used

    pvcreate /dev/sda3

  7. This command will add the physical volume to the volume group of /dev/turbo

    vgextend /dev/turbo /dev/sda3

  8. We can check that the physical volume /dev/sda3 is now a part of /dev/turbo and the total amount of free 

    vgdisplay -v

  9. Now we will extend the size of the logical volume by the amount of Free PE we found in the last step (replace the number with what you find and the volume with the one you want to extend, ex: /dev/turbo/var_log/dev/turbo/var_lib_mysql)

    lvextend -l+2559 /dev/turbo/root

  10. The last step for expanding the partition is to expand the XFS filesystem (replace with the volume you extended, ex: /dev/turbo/var_log | /dev/turbo/var_lib_mysql)

    xfs_growfs /dev/turbo/root

  11. Lastly, we are just confirming the partition has been extended

    df -h

Outcomes