Extending a logical volume in a virtual machine running Red Hat or Cent OS

Source: Internet
Author: User



To extend a logical volume:

Note : These steps apply only to the EXT3 file system.



warning : VMware recommends a full backup of the virtual machine before these changes are performed.


    1. Shut down the virtual machine.
    2. Edit the virtual machine settings and expand the virtual disk size. For more information, see increasing Virtual disk size (1004047) (increasing the size of a virtual disk (1004047)).
    3. Start the virtual machine.
    4. Identify the device name, default to/DEV/SDA, and run the following command to confirm the new size:
    5. # fdisk-l

    6. To create a new primary partition:
      1. Run the following command:

        # FDISK/DEV/SDA (depending on the result of step 4)

      2. Press p to print the partition table to determine the number of partitions. By default there are two: Sda1 and Sda2.
      3. Press N to create a new primary partition.
      4. Press p to get the primary partition information.
      5. Press 3 to get the partition number, depending on the partition table printout.
      6. Press two times to Enter.
      7. Press W to write the changes to the partition table.


    7. Restart the virtual machine.
    8. Run the command to verify that the changes have been saved to the partition table, and that the new partition type is 83:

      # fdisk-l


    9. Run the command to convert the new partition to a physical volume:

      # Pvcreate/dev/sda3


    10. Run the command to extend the physical volume:

      # Vgextend Volgroup00/dev/sda3

      Note : To determine which volume group to extend, use the command vgdisplay.


    11. Run the command to confirm the number of physical data areas available for the volume group:

      # Vgdisplay VolGroup00 | grep "Free"


    12. Run the following command to extend the logical volume:

      # lvextend-l+ #G/dev/volgroup00/logvol00

      Where # is the amount of free space (in gigabytes) that can be provided based on the preceding command.

      Note : To determine which logical volume to extend, use the command lvdisplay.

    13. Run the following command to extend the Ext3 file system online within the logical volume:

    14. # ext2online/dev/volgroup00/logvol00

      Note : If you are not a Red Hat virtual machine, use RESIZE2FS instead of ext2online.

    15. Run the following command to verify/filesystem if there is new free space:
    16. # Df-h/


Extending a logical volume in a virtual machine running Red Hat or Cent OS


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.