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

Filed Under (Cloud Hosting, Linux Tips, Xen) by Milind on 28-12-2011

_

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

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

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)

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

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.

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

CONFIGURE AND EXTEND DISK SPACE

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

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

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

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

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

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

 

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

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

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

 

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

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

 

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

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

_

Citrix XEN VM Boot Error code: INVALID_SOURCE Unable to Boot from CD/DVD

Filed Under (Linux Tips, Xen) by Milind on 30-11-2011

_

You have installed Citrix Xen Cloud Platform (XCP) and configured it (including network, templates, OS ISO’s etc.; even you have created your first VM with the help of documentation provided by Citrix but when you try to boot your VM for first time it throws following error as Citrix is not able to boot the VM from CD/DVD drives which are attached to it.

[root@xcp1-slave2 iso]# xe vm-start uuid=5ce47d4e-227c-9d1e-4710-21b7c998318e
Error code: INVALID_SOURCE
Error parameters: Unable to access a required file in the specified repository: file:///tmp/cdrom-repo-vIHKIE/install.amd/xen/vmlinuz., ,

The problem here is the boot order for the VM is not properly set (through Template) at the time of VM creation and VM remains Halted

[root@xcp1-slave2 ~]# xe vm-list uuid=5ce47d4e-227c-9d1e-4710-21b7c998318e
uuid ( RO) : 5ce47d4e-227c-9d1e-4710-21b7c998318e
name-label ( RW): test
power-state ( RO): halted

To fix this error first we need to check the boot sequence for the VM. Use following command to check it

[root@xcp1-slave2 iso]# xe vm-param-list uuid=5ce47d4e-227c-9d1e-4710-21b7c998318e | grep HVM-boot
HVM-boot-policy ( RW):
HVM-boot-params (MRW):

The above output shows that boot order is not set (“HVM-boot-params (MRW)” is blank) for the VM. Now, execute following command to set boot sequence of the VM

[root@xcp1-slave2 iso]# xe vm-param-set uuid=5ce47d4e-227c-9d1e-4710-21b7c998318e HVM-boot-policy=BIOS\ order HVM-boot-params:order=”dc”

Verify the boot order now.

[root@xcp1-slave2 iso]# xe vm-param-list uuid=5ce47d4e-227c-9d1e-4710-21b7c998318e | grep HVM-boot
HVM-boot-policy ( RW): BIOS order
HVM-boot-params (MRW): order: dc

We can see that boot order (HVM-boot-params (MRW)) is set to “dc” i.e. CD/DVD

Thats it!!! You should able to start the VM and boot it from ISO you have mounted.

[root@xcp1-slave2 iso]# xe vm-list uuid=5ce47d4e-227c-9d1e-4710-21b7c998318e
uuid ( RO) : 5ce47d4e-227c-9d1e-4710-21b7c998318e
name-label ( RW): test
power-state ( RO): running

xen 300x184 Citrix XEN VM Boot Error code: INVALID SOURCE Unable to Boot from CD/DVD

NOTE: In this post “5ce47d4e-227c-9d1e-4710-21b7c998318e” is the UID of the VM and it will different in your case. So, make sure to change the UID before executing the commands.

Follow US

Enter your email address:


I'm listed in Technology

Sponsors

Advertisement

Become Fan

tag cloud