how to increase the space of root partition by taking space from a xen PV

9,214

The general strategy for increasing the size of a file system hosted in LVM:

lvextend -L12G /dev/myvg/myvol

increases the size to 12G. You can use -L+12G to increase the size by 12G instead.

Make sure you have e2fsprogs installed from your favourite package manager. Then:

resize2fs /dev/myvg/myvol

Note: You typically do not want to do this on a mounted file system! There are kernel patches to allow it, but I would recommend taking the server offline first.

In case you are trying to increase the size of a filesystem inside a VM:

As the VM has its own disk layout you will need to modify it. For this you can use parted. What you want to do is something like:

parted /dev/myvg/myvol

And then use parted to erase move/erase volumes untill you can grow your root partition to the size you want. You can find more documentation for parted at http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html

Share:
9,214

Related videos on Youtube

aligator007
Author by

aligator007

Updated on September 17, 2022

Comments

  • aligator007
    aligator007 over 1 year

    I am stuck in pretty weird situation. I hope somebody here will help me.

    I have one centOS server with XEN installed on it. XEN has 3-4 virtual machiens running on it. As required by XEN, this server has LVM implemented. The structure of Disk System is as following ( Kindly click on this image link) :

    http://yfrog.com/72sh01nov191726j

    This server has two disks of 750 GB each, and RAID implemented. MD2 partition is / (root) filesystem. It has only 10 GB of space. Now i have to increase the space of / filesystem. It is running short on space. Some more information about server is following:

    1. It has 1 volume group named xen in its LVM and its size is 682 GB.
    2. Their is a physical volume named md3 in volume group xen and its size is 682 GB.
    3. This physical volume has 5 logical volumes which are used for XEN virtual machines.

    This volume group has 400 GB of free disk space. So i want to extract some space (200 GB)from it and use this space for / (root) partition.

    This is a live server and i can not take risk of testing some test methods on it. I have searched for 4-5 hours for this issue but i was not able to get the proper and authentic answer. So i thought i should post my question here so that i can get a authentic answer.

    This is very urgent, my client is shouting on me. .

    one more thing i have no physical access this server as it is located in another country.

    Kindly help me to solve this.

    • pehrs
      pehrs over 13 years
      Your question is not very clear: Are you trying to increase the size of the root partition of a guest domain, or are you trying to increase the size of the root partition of Dom0? What is the output of pvdisplay, lvdisplay and mount?
    • aligator007
      aligator007 over 13 years
      Sorry, the text garbelled in the previous comment. i m uploading images on following links. kindly check : Output of pvdisplay is img29.imageshack.us/i/sh02nov192131.jpg ...... output (shortened, its big list)lvdisplay is: img831.imageshack.us/i/sh03nov192132.jpg ..... output of mount is : img269.imageshack.us/i/sh04nov192132.jpg
  • aligator007
    aligator007 over 13 years
    it will not solve my purpose.
  • aligator007
    aligator007 over 13 years
    i guess i can not use any of this, as my server is hosted at some remote data center. So i can not run any command whichh might render it to useless
  • pehrs
    pehrs over 13 years
    Well, if you want to change the size of the root partition you will have to take the server offline and boot up on a separate disk. It's hard to get around that in a safe manner. But if you use live cd I would consider the procedure reasonably safe. Most data centers have remote KVM or similar to allow you to do exactly this kind of stuff.
  • aligator007
    aligator007 over 13 years
    Thanks for this suggestion, meanwhile i have some more info to discuss. I have webmin installed n this server along with hyperVM. In webmin i can see LVM and partitions. There is one option in which we can add any logical volume to any Raid device partition. Doyou think that will an good idea and risk free. Kindly look at the attachd screenshot yfrog.com/jysh05nov201208j
  • pehrs
    pehrs almost 13 years
    That is better asked as a separate question.