View volume group related information
- [root@localhost /]# vgscan
- Reading all physical volumes. This may take a while...
- Found volume group "VolGroup00" using metadata type lvm2
View the PV and LV information contained in volume group VolGroup00.
- [root@localhost /]# vgdisplay -v VolGroup00
- Using volume group(s) on command line
- Finding volume group "VolGroup00"
- --- Volume group ---
- VG Name VolGroup00
- System ID
- Format lvm2
- Metadata Areas 1
- Metadata Sequence No 2
- VG Access read/write
- VG Status resizable
- MAX LV 0
- Cur LV 1
- Open LV 0
- Max PV 0
- Cur PV 1
- Act PV 1
- VG Size 1.01 GiB
- PE Size 8.00 MiB
- Total PE 129
- Alloc PE / Size 100 / 800.00 MiB
- Free PE / Size 29 / 232.00 MiB
- VG UUID Cug510-pQb6-RELO-lb1K-zjbt-3f62-jQLoQp
- --- Logical volume ---
- LV Path /dev/VolGroup00/iscsi00
- LV Name iscsi00
- VG Name VolGroup00
- LV UUID tE78D6-5kJf-0HOh-4jRX-oLhI-ehyR-XhMmMQ
- LV Write Access read/write
- LV Creation host, time localhost.iscsi, 2017-01-19 14:25:40 +0800
- LV Status available
- # open 0
- LV Size 800.00 MiB
- Current LE 100
- Segments 1
- Allocation inherit
- Read ahead sectors auto
- - currently set to 256
- Block device 253:0
- --- Physical volumes ---
- PV Name /dev/sda7
- PV UUID OWz0uw-gTR1-WylF-z6HW-cgpe-LLd9-2W8Q9g
- PV Status allocatable
- To edit/etc/fstab,Delete the corresponding mount information tal PE / Free PE 129 / 29
Unmount logical volume LV on volume group
To unmount all logical volumes LV for the corresponding volume group VG. From the above information, we can see that the corresponding volume group VolGroup00 only has the logical volume Lv of / dev/VolGroup00/iscsi00
- [root@localhost /]# umount /dev/VolGroup00/iscsi00
If the process is also using the file of the corresponding logical volume, you must force the mount point to be unloaded (ාdf -Th view).
Delete logical volume LV
- [root@localhost /]# lvremove /dev/VolGroup00/iscsi00
- Do you really want to remove active logical volume iscsi00? [y/n]: y
- Logical volume "iscsi00" successfully removed
- [root@localhost /]#
If there is an error in the deletion prompt, check the process currently using the logical volume, and then end the process or service.
Verify LV is removed
- [root@localhost /]# lvdisplay | grep "dev/VolGroup00/iscsi00"
Delete volume group VG
- [root@localhost /]# vgremove VolGroup00
- Volume group "VolGroup00" successfully removed
- [root@localhost /]#
If you delete a volume group VG in a secure way, you must shut it down using vgchange -a n VolGroup00, and then delete it.
- [root@localhost /]# vgchange -a n VolGroup00
- 0 logical volume(s) in volume group "VolGroup00" now active
- [root@localhost /]# vgremove VolGroup00
- Volume group "VolGroup00" successfully removed
- [root@localhost /]#
Verify that the volume group (VG) is deleted
- [root@localhost /]# vgscan
- Reading all physical volumes. This may take a while...
- No volume groups found
- [root@localhost /]#
Delete physical volume PV
- [root@localhost /]# pvremove /dev/sda7
- Labels on physical volume "/dev/sda7" successfully wiped
- [root@localhost /]# pvscan
- No matching physical volumes found
- [root@localhost /]#
Edit / etc/fstab to delete the corresponding mount point information
If the mount point is not set, this step can be ignored, otherwise there will be problems in restarting the system. Remember!
Reproduced from: http://blog.csdn.net/jazzsoldier/article/details/54631183