Rotten mud: delete logical volume, volume group, and physical volume of LVM Learning

Source: Internet
Author: User

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

In the previous article, we introduced the logical volume of LVM and the reduction of the volume group space. This time we will introduce how to delete a logical volume and a volume group.

To delete a logical volume, follow these steps:

1. Detach a mounted logical volume

2. Delete the logical volume and run the lvremove command.

First, you can view the mount information of the logical volume as follows:

DF-H

Detach a mounted logical volume as follows:

Umount/testlvm/

Now let's view the information about the logical volume. Use the LVS or lvdisplay Command, as shown below:

We can see that there is only one logical volume/dev/vg1/data in the LVM, And the size is 300 MB.

Now the lvremove command is available to delete the logical volume/dev/vg1/data. As follows:

Lvremove/dev/vg1/Data

For how to use the lvremove command, see the help below:

Lvremove -- Help

The preceding operations are related to deleting logical volumes. Next we will delete the volume group. Deleting a volume group is simple. You only need to use the vgremove command.

Before deleting a logical volume, we can view its related information. As follows:

We can see two physical volumes/dev/sda5/AND/dev/sda6 in the system, in addition, the physical volume/dev/sda5/has been added to the volume group vg1.

Now we can use the vgremove command to delete the volume group vg1. As follows:

Vgremove vg1

After the volume group is deleted, let's check the information about the physical volume. As follows:

We can see that the two physical volumes in the system do not belong to any volume group.

For more information about how to use the vgremove command, see the help documentation. As follows:

So far, the deletion of our volume group has been completed.

Next we will delete the physical volume, which can be achieved through the pvremove command.

Pvremove/dev/sda5

We can see that the physical volume/dev/sda5 has been deleted. If/dev/sda5 is a hard disk, we can easily remove it now.

For the usage of the pvremove command, you can view the help documentation. As follows:

This section describes how to delete logical volumes, Volume groups, and physical volumes.

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.