Help Center/ Elastic Volume Service/ FAQs/ Capacity/ How Do I Clear Residual Files Generated in LVM After the Partition of a Logical Volume Is Deleted?
Updated on 2026-05-26 GMT+08:00

How Do I Clear Residual Files Generated in LVM After the Partition of a Logical Volume Is Deleted?

Scenarios

By adding a logical layer between EVS disks and file systems, Logical Volume Manager (LVM) abstracts EVS disk partitions into logical volumes that can then be flexibly partitioned as needed for upper layer file systems.

If a logical volume is created on a partition, residual files may be generated in LVM when that partition is accidentally deleted. If file system auto-mount is not configured, you can clear the residual files as follows:

Procedure

  1. Log in to the server as user root.

    For how to log in to an ECS, see How Do I Log In to My ECS?

    For how to log in to a BMS, see Linux BMS Login Methods.

  2. Create a new partition with the same size as the deleted one. For how to create partitions, see Initializing a Linux Data Disk.
  3. After the partition is created, clear the residual data from the logical volume, volume group, and physical volume respectively.

    1. Clear the residual data from the logical volume.

      lvremove <logical-volume-name>

      Example command:

      lvremove /dev/vgdata/lvdata1

      [root@ecs-lvmtest ~]#  lvremove /dev/vgdata/lvdata1
       Logical volume "lvdata1" successfully removed

      Check whether the residual data is cleared.

      lvdisplay

      If no lvdata1 is returned, the cleanup is complete.

    2. Clear the residual data from the volume group.

      vgremove <volume-group-name>

      Example command:

      vgremove vgdata

      [root@ecs-lvmtest ~]#   vgremove vgdata
       Volume group "vgdata" successfully removed

      Check whether the residual data is cleared.

      vgdisplay

      If no vgdata is returned, the cleanup is complete.

    3. Clear the residual data from the physical volume.

      pvremove <disk-device-name>

      Example command:

      pvremove /dev/vdb1

      [root@ecs-lvmtest ~]#   pvremove /dev/vdb1
       Labels on physical volume "/dev/vdb1" successfully wiped.

      Check whether the residual data is cleared.

      pvdisplay

      If no /dev/vdb1 is returned, the cleanup is complete.