How to Extend the Disk Partition on CentOS

Document created by fadi.josef Expert on Jan 24, 2017Last modified by Anson McCook on Feb 16, 2017
Version 3Show Document
  • View in full screen mode

**This document outlines how to resize a partition on a Turbonomic/CentOS VM using a new disk added.**

 

By default, Turbonomic ships with three separate partitions. 

 

Step 1: Add a new Disk from within your Hypervisor.

 

Step 2: SSH into Turbonomic using Putty or any other SSH client.

 

df -h.png

Step 3: In this step, we need to list all the detected partitions so we can then create a primary volume.

 

Command:

fdisk -l

fdisk -l.png

  In the above screenshot, you'll see the highlighted partition detected. On your system, if you have multiple disks added without a physical volume then you will see different names. 

 

The screenshot below is an example of the VM with two disks added without a physical volume.

 

fdisk -l 2.png

Once the new disk is visible run the below commands to create the new physical volume and add it to the volume group as shown below.

 

Step 4: Creating Physical Volume

 

Commands:

 

Don't forget to use the name of the partition you would like to use. In this example, sdb is in use.

pvcreate /dev/sdb

pvcreate.png

 

vgextend turbo /dev/sdb

vgextend.png

 

vgdisplay

vgdisplay.png

Step 5: Extending  Logical Volume

 

Partitions

  • turbo-root
  • turbo-var_lib_mysql
  • turbo-var_log

 

Command:

lvextend -L +10G /dev/mapper/turbo-root

lvextend.png

The disk added was 10GB but if you add more than 10GB then you need to change the command to include the space you would like to allocate to the Root partition.

Command:

xfs_growfs /dev/mapper/turbo-root

 

The command above will extend the root volume.

 

xfs_growfs.png

Command

df -h

 

Now we have extended the root volume We can look at the new size by using the command above, df -h

 

df-h.png

 

Useful Commands

 

Command
Summary
df -hShows disk space available for each volume
fdisk -lfdisk command can display the partitions and details like file system type
6 people found this helpful

Attachments

    Outcomes