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
- 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.
- Create a new partition with the same size as the deleted one. For how to create partitions, see Initializing a Linux Data Disk.
- After the partition is created, clear the residual data from the logical volume, volume group, and physical volume respectively.
- 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.
- Clear the residual data from the volume group.
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.
- Clear the residual data from the physical volume.
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.
- Clear the residual data from the logical volume.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot