How to resize file system on virtual machine

How to resize disk space on Virtual Machine

In order to resize disk space follow the following steps:
Please restart VM in recovery mode in citrix xencenter before following steps below.
For example you have two partitions. one is root and another is home (this example is taken from VM where CPanel is installed).
First of we have to reduce partition root:

#lvm pvscan #lvm vgscan
#lvm vgchange -ay
#lvm lvscan
#lvm lvdisplay /dev/VolGroup/lv_root
#fsck.ext4 /dev/VolGroup/lv_root
#e2fsck -f /dev/VolGroup/lv_root

Use desire disk size you would like to reduce -- in the example below size to reduce is 20G

#resize 2fs -p /dev/VolGroup/lv_root 20G
#lvm lvreduce -L 20G /dev/VolGroup/lv_root
Verify the change
#lvm lvdisplay /dev/VolGroup/lv_root

Now you need to extend the other disk partion and add the space you just reduced above.

#lvm lvextend -L +30G /dev/VolGroup/lv_home
#e2fsck -f /dev/VolGroup/lv_home
#resize2fs /dev/VolGroup/lv_home
Verify the the change
#lvm lvdisplay /dev/VolGroup/lv_home

Reboot the VM and you are done.
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

Do I Need a VPS?

VPS stands for Virtual Private Server. When your website has outgrown your shared hosting plan...

Who Manages My VPS?

All our VPS plans come completely unmanaged unless you buy a managed service addon. What it means...

Do you help to setup Control Panels and Operating Systems?

All VPS packages come with the operating system of customer choice preinstalled. The customer can...

How do I Reboot my VPS?

Step 1:   To reboot your virtual machine, go to the client area, and click the "My Services"...

How Do I Monitor Traffic on my Virtual Machine?

      To monitor your traffic on your virtual machine, go to the client area, and click the...