Rotten mud: Learning LVM logical Volume LV and volume group resizing VG

Source: Internet
Author: User

This article was sponsored by Xiuyi linfeng and first launched in the dark world.

The previous article introduces the basic LVM knowledge. This article describes how to expand the logical Volume LV and volume group VG of LVM.

We know that the logical volume of LVM is equivalent to a partition. Since it is a partition, it has a distinction between the size and space. What should I do if the current logical volume space is insufficient?

Don't worry. LVM provides a logical volume expansion method. We can use the lvextend command to implement it.

Before resizing a logical volume, let's take a look at the current logical volume/dev/vg1/data size, as shown below:

We can set the logical volume/dev/vg1/data to 500 mb and resize it now. Scale to 800 mb and run the lvextend command as follows:

Lvextend-l 800 m/dev/vg1/Data

Note that the size of the logical volume after expansion must be smaller than that of the volume group.

After resizing, run the DF command to view the/testlvm directory size, as shown below:

We found that although the logical volume has been expanded. However, logical volumes indicate that the mounted partitions are not resized.

In fact, we only need to execute the Code with resize2fs, as shown below:

Resize2fs/dev/vg1/Data

The above is logical volume expansion. Next we will resize the volume group.

You can use the vgextend command to resize a volume group.

Before resizing the volume group, let's first check the size of the volume group space, as shown below:

We can see that the current size of the volume group vg1 is 1000 MB, and now we resize it by 1000 MB.

It is relatively simple to expand a volume group. We only need to add the new PV physical volume to the volume group.

View the physical volume space as follows:

DF-H/dev/sda6

View the volume group space

Use the vgextend command for volume group expansion, as shown below:

Vgextend vg1/dev/sda6

View the expanded volume group space as follows:

With the above operations, we can easily resize logical volumes and volume groups.

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.