Extend partition size in Linux LVM (Citrix Xen) without downtime

_

When you create a VM Citrix Xen Cloud Platform (using a storage on Network or on local server) you assign a specific amount of space i.e. 20 GB or 30GB but after sometime client ask for more disk space you have to reboot the server to attach or add more disk space. In this post I will explain how you can add additional disk space to a Linux Xen VM without downtime.

Note: This method work if you have created Logical Volumes at the time of OS setup.

ADD ADDITIONAL DISK SPACE

1) Login to Xen Center and search the VM in which you want to extend the space.

2) Click on VM to open its section and go to Storage tab. You will see something like below image

Here you will see the position, name, description, size etc. of existing Disk (Virtual Disk).

3) Now click on “Add” which will show following window (Popup)

Here, Enter the Name, description and size of Disk you want to attach. Then select the location (list all the storage volumes added in the cloud or server) on which you want to create the disk. Press Add.

4) On VM properties (under storage tab) you will able to see the newly added disk.

CONFIGURE AND EXTEND DISK SPACE

1) Login to the server through SSH (Root User) and check Current disk space using command “df -h

2) Execute command “fdisk -l” which will show all the current partitions on all the disks.

It will show “Disk /dev/xvdb doesn’t contain a valid partition table” which mean the server has detected the additional disk.

3) Now initialize the PhysicalVolume using command “pvcreate

[root@centos ~]# pvcreate /dev/xvdb

 

4) Add the above initialized PhysicalVolume to existing group with “vgextend

[root@centos ~]# vgextend VolGroup00 /dev/xvdb

 

5) Increase the size of existing Logical Volume using command “lvextend“.

[root@centos ~]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00

 

6) Final step, without this step Linux will not detect the extended partition or space. Use command ” resize2fs which will resize the file system and update kernel with extended space of logical volume.

[root@centos ~]# resize2fs /dev/mapper/VolGroup00-LogVol00

 

Now check the disk space using “df -h” and you will able to see the increased disk space

_

About: Mike

Milind Koyande loves to work on new technologies specially virtualization and troubleshoot server problems. I’m an avid photographer and love to spend my free time close to nature, trying to capture its glory on my camera.


One thought on “Extend partition size in Linux LVM (Citrix Xen) without downtime”

This site uses Akismet to reduce spam. Learn how your comment data is processed.