Quick and dirty steps, this  work on all hypervisor.

1a. Add more space to the existing disk. On VMware, if the drive is thin provisioned, grow it to the new additional space.
1b. If the drive is thick, or you don’t know how to grow the disk. Add an additional disk drive.
2a. I like to move to runlevel one where nothing should be running. Use lsblk to find where the disk is mounted, dismount the directory(ies) and run fdisk against the physical disk drive (fdisk /dev/sdb for instance)
2b. If I had to add a drive we’ll need to scan for the drive, use:
/usr/bin/rescan-scsi-bus.sh or echo “- – -” > /sys/class/scsi_host/hostX/scan
Once you have that, you’ll be able to view the disk with fdisk. Use lsblk to ID the new device and use fdisk /dev/sdX to create a new partition on it.
3a. I know this sounds crazy, but delete the partition on the disk containing the mount point you want to extend. Now recreate the partition using the default values to use up all the new space. Set the partition type to 8e for LVM. Write the changes.
3b. With our new drive we need to give it a partition, select creating a new partition in fdisk. Set the format type to LVM with 8e. Write the changes
4a. Use pvextend to grow the disk. Use pvextend /dev/sdX# to grow the partition
4b. Add this new disk to the volume group with vgextend vgname /dev/sdX#
5. Finally, grow the logical volume with lvextend -r -l +100%FREE /dev/mapper/vgname

In the final command, -r will execute resize2fs for you automatically. Don’t forget the plus sign in front of the 100% otherwise it will not grow the partition even if the command executes successfully.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s