Industry-leading Cloud Services for the Channel

Search
Close this search box.

Extend CentOS partition with no reboot

(Additional 5GB disk in this example)

First create a new disk in VMware and attach it to the server, then on the server run the following commands:

df – find the partition you want to increase in size.

CentOS

lvdisplay – locate the partition, underneath should be the volume group, make a note of it.

CentOS

run fdisk -l and find the disk you just added, it should be the one with no partitions (If it is not showing run the following)

ls /sys/class/scsi_host

which should return hostX (usually host0) followed by

echo “- – -” > /sys/class/scsi_host/hostX/scan

where hostX is the host from the previous command, usually host0

CentOS

(You might see multiple entries even if you just have one controller, but you’re safe to scan all of them, it will usually just be host0 that picks it up.)

CentOS

You should now see the additional disk when running the command: fdisk –l

CentOS

These commands should be run after adding the new disk but before the rest of the commands.
run fdisk /dev/sdX, (it may be hdX or vdX depending on your system) where X is the new disk.

CentOS

Create a new partition on it pressing the following:

n <enter>
p <enter>
1 <enter>
<enter>
<enter>

CentOS

This should have created the partition, now do the following:

t <enter>
8e <enter>

This should have set the partition type to Linux LVM, now the following:
w <enter>

This should have written it out

CentOS

Now to make it ready for LVM

pvcreate /dev/sdX1, (it may be hdX1 or vdX1 again depending on your system)

CentOS

To add it to the volume group (which you should know from earlier)

vgextend yourvolumegroupname /dev/sdX1

Once this is done, you’ll then see the additional space when using df

CentOS
CentOS
CentOS

Share the news to:

Facebook
X
LinkedIn
Email
WhatsApp