Linux LVM learning Summary-delete a physical volume

Source: Internet
Author: User

Linux LVM learning Summary-delete a physical volume
This article describes the commands vgreduce and pvremove in LVM management. As a matter of fact, the previous articles have been mentioned and involved. Vgreduce: removes physical volumes from an LVM volume group to reduce the volume group capacity. Note: The last physical volume in the LVM volume group cannot be deleted. pvremove: Used to delete an existing physical volume. When you use the pvremove command to delete a physical volume, it deletes the physical volume information on the LVM partition so that it is no longer considered a physical volume. Before deleting a physical volume PV, you must have a clear understanding of the partition information, volume group information, physical volume information, and logical volume information of the server to avoid errors or misoperations.

[root@localhost ~]# fdisk -lDisk /dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track, 15665 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice BootStartEndBlocksId  System/dev/sda1*  1 1310439183  Linux/dev/sda2  14 10443 837789758e  Linux LVM/dev/sda3  10444 15665 4194571583  Linux[root@localhost ~]# vgscan  Reading all physical volumes.  This may take a while...  Found volume group "VolGroup00" using metadata type lvm2[root@localhost ~]# pvscan  PV /dev/sda2VG VolGroup00lvm2 [79.88 GB / 0 free]  PV /dev/sda3VG VolGroup00lvm2 [40.00 GB / 40.00 GB free]  Total: 2 [119.88 GB] / in use: 2 [119.88 GB] / in no VG: 0 [0][root@localhost ~]# pvdisplay  --- Physical volume ---  PV Name/dev/sda2  VG NameVolGroup00  PV Size79.90 GB / not usable 23.41 MB  Allocatable  yes (but full)  PE Size (KByte) 32768  Total PE  2556  Free PE0  Allocated PE 2556  PV UUIDYGtB2J-ZKJr-mV62-NluQ-2DGy-vuUT-cCc1lo  --- Physical volume ---  PV Name/dev/sda3  VG NameVolGroup00  PV Size40.00 GB / not usable 2.61 MB  Allocatable  yes   PE Size (KByte) 32768  Total PE  1280  Free PE1280  Allocated PE 0  PV UUIDwsnv13-7j1H-SH8q-hl6k-HpNc-x4WU-gM7LzW[root@localhost ~]# lvscan  ACTIVE'/dev/VolGroup00/LogVol00' [77.91 GB] inherit  ACTIVE'/dev/VolGroup00/LogVol01' [1.97 GB] inherit[root@localhost ~]# lvs  LV VGAttrLSize  Origin Snap%  Move Log Copy%  Convert  LogVol00 VolGroup00 -wi-ao 77.91G    LogVol01 VolGroup00 -wi-ao  1.97G 

 

Vgreduce parameter:-a: If no physical volume is specified in the command line, delete all empty physical volumes; -- removemissing: Delete the physical volume lost in the volume group, restore the volume group to normal.
[root@localhost ~]# vgreduce VolGroup00 /dev/sda3Removed "/dev/sda3" from volume group "VolGroup00"[root@localhost ~]# clip_image001

 
[root@localhost ~]# pvscan  PV /dev/sda2VG VolGroup00lvm2 [79.88 GB / 0 free]  PV /dev/sda3 lvm2 [40.00 GB]  Total: 2 [119.88 GB] / in use: 1 [79.88 GB] / in no VG: 1 [40.00 GB][root@localhost ~]# pvs  PVVGFmt  Attr PSize  PFree   /dev/sda2  VolGroup00 lvm2 a-79.88G  0   /dev/sda3 lvm2 a-40.00G 40.00G[root@localhost ~]# pvremove /dev/sda3  Labels on physical volume "/dev/sda3" successfully wiped[root@localhost ~]# pvscan  PV /dev/sda2VG VolGroup00lvm2 [79.88 GB / 0 free]  Total: 1 [79.88 GB] / in use: 1 [79.88 GB] / in no VG: 0 [0]

 


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.