LVM: Logical Volume Manager allows easy to operate abstraction layer of volumes, including resizing the file system, reorganizing the file system among multiple physical devices, and increasing the scalability (data loss will be caused if the mount has to be cancelled)
The difference between logical partition and logical volume
Logical volume and logical partition are not the same concept, and the capacity of logical partition cannot be changed; the capacity of logical volume can be changed (based on logical volume above physical volume and volume group); logical volume manager (LVM) can manage disk space more easily (consolidated disk pool)
Here is the schematic diagram for better understanding
#Create physical volume pvcreate /dev/sda3 \#Assign physical volumes to volume groups vgcreate vg0 /dev/sda3 \#Create a logical volume from a volume group lvcreate -L 256M -n data vg0 \#mkfs.xfs /dev/vg0/data //Create file system \#mount mount /dev/vg0/data /mnt/data#
extend lvextend -L [+]#[mMgGtT] /dev/VG_NAME/LV_NAME \#Aiming at ext resize2fs /dev/VG_NAME/LV_NAME \#Aiming at xfs xfs_growfs MOUNTPOINT lvresize -r -l +100%FREE /dev/VG_NAME/LV_NAME
Reduction only supported ext4 umount /dev/VG_NAME/LV_NAME e2fsck -f /dev/VG_NAME/LV_NAME resize2fs /dev/VG_NAME/LV_NAME #[mMgGtT] lvreduce -L [-]#[mMgGtT] /dev/VG_NAME/LV_NAME mount
It can be a hard disk or a partition. It needs to be changed
Example: create logical partition and extended partition for ext4
[root@27 ~]#fdisk -l /dev/sdb Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x2d890684 Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 82 Linux swap / Solaris /dev/sdb2 4196352 8390655 2097152 83 Linux #modify file type [root@27 ~]#fdisk /dev/sdb2 Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x59eb2927. Command (m for help): t No partition is defined yet! Command (m for help): q [root@27 ~]#fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): t Partition number (1,2, default 2): 2 Hex code (type L to list all codes): L 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT f W95 Ext d (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor 12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT 1e Hidden W95 FAT1 80 Old Minix Hex code (type L to list all codes): 8e (Change to Linux LVM) Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x2d890684 Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 82 Linux swap / Solaris /dev/sdb2 4196352 8390655 2097152 8e Linux LVM #Found modified Command (m for help): w #Preservation The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. //Add a hard disk scan [root@27 ~]#for i in {0..32};do echo '- - -' >/sys/class/scsi_host/host$i/scan;done [root@27 ~]#lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 200G 0 disk ├─sda1 8:1 0 1G 0 part /boot ├─sda2 8:2 0 100G 0 part / ├─sda3 8:3 0 2G 0 part [SWAP] ├─sda4 8:4 0 1K 0 part └─sda5 8:5 0 50G 0 part /data sdb 8:16 0 20G 0 disk ├─sdb1 8:17 0 2G 0 part [SWAP] └─sdb2 8:18 0 2G 0 part sdc 8:32 0 5G 0 disk #This is this piece. sr0 11:0 1 1024M 0 rom [root@27 ~]#pvcreate /dev/sd{b2,c} creates a physical volume Physical volume "/dev/sdb2" successfully created. Physical volume "/dev/sdc" successfully created. [root@27 ~]#pvs viewing physical volumes PV VG Fmt Attr PSize PFree /dev/sdb2 lvm2 --- 2.00g 2.00g /dev/sdc lvm2 --- 5.00g 5.00g [root@27 ~]#pvdisplay view details "/dev/sdb2" is a new physical volume of "2.00 GiB" --- NEW Physical volume --- PV Name /dev/sdb2 VG Name PV Size 2.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID jmJ13J-XHgq-ou2J-QVvB-CXy1-FTYX-8mnC5r "/dev/sdc" is a new physical volume of "5.00 GiB" --- NEW Physical volume --- PV Name /dev/sdc VG Name Empty PV Size 5.00 GiB Allocatable NO PE Size 0 PE Size not specified by volume group Total PE 0 Free PE 0 Allocated PE 0 PV UUID IQ0xHD-btaL-XmmT-cE9Q-BQMU-kYA2-ZDUZxQ [root@27 ~]#vgcreate vg1 /dev/sd{b2,c} #######Vgcreate - s 16m Vg1 / dev / SD {B2, C} - s can specify PE size Volume group "vg1" successfully created [root@27 ~]#vgs VG #PV #LV #SN Attr VSize VFree vg1 2 0 0 wz--n- 6.99g 6.99g [root@27 ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb2 vg1 lvm2 a-- <2.00g <2.00g /dev/sdc vg1 lvm2 a-- <5.00g <5.00g [root@27 ~]#vgdisplay --- Volume group --- VG Name vg1 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size 6.99 GiB PE Size 4.00 MiB Total PE 1790 Alloc PE / Size 0 / 0 Free PE / Size 1790 / 6.99 GiB VG UUID OBZcYO-20eN-m2E6-bDn8-ZUCg-Pfro-7caBik [root@27 ~]#lvcreate -n shuju -l 100%free vg1 allocate all space selectively Logical volume "shuju" created. [root@27 ~]#lvdisplay --- Logical volume --- LV Path /dev/vg1/shuju #Name of the logical volume LV Name shuju VG Name vg1 LV UUID zKB4qu-XMnJ-U4Qx-2IlZ-XRT6-f7km-m6mB9q LV Write Access read/write LV Creation host, time 27, 2020-01-04 14:47:28 +0800 LV Status available # open 0 LV Size 6.99 GiB Current LE 1790 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:, [root@27 ~]#Mkfs.ext4/dev/vg1/shuju create file system mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 458752 inodes, 1832960 blocks 91648 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1876951040 56 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@27 ~]#blkid /dev/sda1: UUID="b09c53db-dbe8-4932-ad6e-2b0890ea8844" TYPE="xfs" /dev/sda2: UUID="703b7b55-0dc1-40fc-bfc5-e9a581c48a05" TYPE="xfs" /dev/sda3: UUID="16ba9174-387a-4725-8cdf-e67c7a52d3bc" TYPE="swap" /dev/sda5: UUID="b944d856-d1ac-4694-8c59-04399a8b4786" TYPE="xfs" /dev/sdb1: UUID="95565861-5268-4482-bf6d-349a97322559" TYPE="swap" /dev/sdb2: UUID="jmJ13J-XHgq-ou2J-QVvB-CXy1-FTYX-8mnC5r" TYPE="LVM2_member" /dev/sdc: UUID="IQ0xHD-btaL-XmmT-cE9Q-BQMU-kYA2-ZDUZxQ" TYPE="LVM2_member" /[root@27 ~]#mount /dev/vg1/shuju /mnt/shuju [root@27 ~]#mkdir /mnt/shuju [root@27 ~]#df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 1919944 0 1919944 0% /dev tmpfs 1930684 0 1930684 0% /dev/shm tmpfs 1930684 11908 1918776 1% /run tmpfs 1930684 0 1930684 0% /sys/fs/cgroup /dev/sda2 104806400 1500324 103306076 2% / /dev/sda5 52403200 32992 52370208 1% /data /dev/sda1 1038336 144220 894116 14% /boot tmpfs 386140 0 386140 0% /run/user/0 /dev/mapper/vg1-shuju 7085560 32208 6670376 1% /mnt/shuju /mapper/vg1-shuju: UUID="4e49d747-9616-418f-b66a-c07f41a0de98" TYPE="ext4" #Write to / etc/fstab to mount permanently [root@27 ~]#vgextend vg1 /dev/sdb3 extended logical volume Physical volume "/dev/sdb3" successfully created. Volume group "vg1" successfully extended [root@27 ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb2 vg1 lvm2 a-- <2.00g 0 /dev/sdb3 vg1 lvm2 a-- 1020.00m 1020.00m /dev/sdc vg1 lvm2 a-- <5.00g 0 [root@27 ~]#df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 12M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda2 100G 1.5G 99G 2% / /dev/sda5 50G 33M 50G 1% /data /dev/sda1 1014M 141M 874M 14% /boot tmpfs 378M 0 378M 0% /run/user/0 /dev/mapper/vg1-shuju 6.8G 32M 6.4G 1% /mnt/shuju See [root@27 ~]#lvextend -r -L +500M /dev/vg1/shuju plus 500M Size of logical volume vg1/shuju changed from 6.99 GiB (1790 extents) to 7.48 GiB (1915 extents). Logical volume vg1/shuju successfully resized. resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/mapper/vg1-shuju is mounted on /mnt/shuju; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mapper/vg1-shuju is now 1960960 blocks long. [root@27 ~]#df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 12M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda2 100G 1.5G 99G 2% / /dev/sda5 50G 33M 50G 1% /data /dev/sda1 1014M 141M 874M 14% /boot tmpfs 378M 0 378M 0% /run/user/0 /dev/mapper/vg1-shuju 7.3G 32M 6.9G 1% /mnt/shuju Compared with the above, the space increases #######Delete lvm logical volume [root@27 ~]#lvremove /dev/vg1/shuju Do you really want to remove active logical volume vg1/shuju? [y/n]: y Prompt whether to delete Logical volume "shuju" successfully removed [root@27 ~]#vgdisplay --- Volume group --- VG Name vg1 System ID Format lvm2 Metadata Areas 3 Metadata Sequence No 10 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 3 Act PV 3 VG Size <7.99 GiB PE Size 4.00 MiB Total PE 2045 Alloc PE / Size 0 / 0 Free PE / Size 2045 / <7.99 GiB VG UUID OBZcYO-20eN-m2E6-bDn8-ZUCg-Pfro-7caBik [root@27 ~]#vgremove vg1 deleting a volume group Volume group "vg1" successfully removed [root@27 ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb2 lvm2 --- 2.00g 2.00g /dev/sdb3 lvm2 --- 1.00g 1.00g /dev/sdc lvm2 --- 5.00g 5.00g [root@27 ~]#pvremove /dev/sd{b2,b3,c} delete logical volumes Labels on physical volume "/dev/sdb2" successfully wiped. Labels on physical volume "/dev/sdb3" successfully wiped. Labels on physical volume "/dev/sdc" successfully wiped. [root@27 ~]#fdisk -l /dev/sdb Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x2d890684 Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 82 Linux swap / Solaris /dev/sdb2 4196352 8390655 2097152 8e Linux LVM #It can also be deleted /dev/sdb3 8390656 10487807 1048576 83 Linux /dev/sdb4 10487808 12584959 1048576 83 Linux
Logical volume snapshot
Snapshot is a special logical volume. It is the exact copy of the logical volume that exists when the snapshot is generated. For the temporary copy of existing data and other operations that need to be backed up or copied, snapshot is the most appropriate choice. Only when they are different from the original logical volume, will the snapshot consume space. The volume size of the established snapshot is less than or equal to the original logical volume. You can also use lvextend Extended snapshot
Logical volume manager snapshot
Snapshot is to record the system information at that time, just like photographing. If any data changes in the future, the original data will be moved to the snapshot area, and the unchanged area will be shared by the snapshot area and the file system
How logical volume snapshots work
A certain amount of space will be allocated to the snapshot when it is generated, but only when the original logical volume or snapshot has changed will these spaces be used. When the original logical volume has changed, the old data will be copied to the snapshot. The snapshot only contains the changed data in the original logical volume or the changed data in the snapshot since the snapshot was generated. Because the snapshot area and the original L V shares many PE blocks, so the snapshot and the LV to be snapshot must be in the same VG. When the system recovers, the number of files cannot be higher than the actual capacity of the snapshot area
#Create a snapshot for an existing logical volume snapshot size is less than or equal to the logical volume size snapshot includes attribute backups lvcreate -l 64 -s -n data-snapshot -p r /dev/vg0/data \#Mount snapshot mkdir -p /mnt/snap mount -o ro /dev/vg0/data-snapshot /mnt/snap \#Restore snapshot umount /dev/vg0/data-snapshot umount /dev/vg0/data lvconvert --merge /dev/vg0/data-snapshot \#Delete snapshot umount /mnt/databackup lvremove /dev/vg0/databackup
Snapshot example [root@27 ~]#df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 12M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda2 100G 1.5G 99G 2% / /dev/sda5 50G 33M 50G 1% /data /dev/sda1 1014M 141M 874M 14% /boot tmpfs 378M 0 378M 0% /run/user/0 /dev/mapper/vg1-shuju 7.3G 32M 6.9G 1% /mnt/shuju [root@27 ~]#cp /etc/fstab /mnt/shuju/f1 [root@27 ~]#cp /etc/fstab /mnt/shuju/f2 [root@27 ~]#cp /etc/fstab /mnt/shuju/f3 [root@27 ~]#ls /mnt/shuju f1 f2 f3 lost+found [root@27 ~]#lvcreate -n shuju_snapshot -s -p r -L 300M /dev/vg1/shuju ##### -n specified name - s snapshot r read only Logical volume "shuju_snapshot" created. [root@27 ~]#lvdisplay --- Logical volume --- LV Path /dev/vg1/shuju LV Name shuju VG Name vg1 LV UUID zKB4qu-XMnJ-U4Qx-2IlZ-XRT6-f7km-m6mB9q LV Write Access read/write LV Creation host, time 27, 2020-01-04 14:47:28 +0800 LV snapshot status source of shuju_snapshot [active] Show with snapshot LV Status available # open 1 LV Size 7.48 GiB Current LE 1915 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 --- Logical volume --- LV Path /dev/vg1/shuju_snapshot LV Name shuju_snapshot snapshot VG Name vg1 LV UUID G8n4yi-FOkw-RlbZ-GtEf-8IHh-4fRw-hYnoma LV Write Access read only Read-only attribute LV Creation host, time 27, 2020-01-04 15:39:49 +0800 LV snapshot status active destination for shuju Backup of data LV Status available # open 0 LV Size 7.48 GiB Current LE 1915 COW-table size 300.00 MiB COW-table LE 75 Allocated to snapshot 0.01% Snapshot chunk size 4.00 KiB Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:3 [root@27 ~]#mkdir /mnt/snap root@27 ~]#mount /dev/vg1/shuju_snapshot /mnt/snap mount: /dev/mapper/vg1-shuju_snapshot is write-protected, mounting read-only [root@27 ~]#ls /mnt/snap/ f1 f2 f3 lost+found Visual deception. The data you see is not here [root@27 ~]#df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 1919940 0 1919940 0% /dev tmpfs 1930680 0 1930680 0% /dev/shm tmpfs 1930680 11904 1918776 1% /run tmpfs 1930680 0 1930680 0% /sys/fs/cgroup /dev/sda2 104806400 1499084 103307316 2% / /dev/sda5 52403200 32992 52370208 1% /data /dev/sda1 1038336 144348 893988 14% /boot tmpfs 386140 0 386140 0% /run/user/0 /dev/mapper/vg1-shuju 7589336 32220 7153988 1% /mnt/shuju /dev/mapper/vg1-shuju_snapshot 7589336 32220 7153988 1% /mnt/snap [root@27 ~]#echo > /mnt/shuju/f1 [root@27 ~]#ll /mnt/shuju total 28 -rw-r--r--. 1 root root 1 Jan 4 15:57 f1 Data emptying -rw-r--r--. 1 root root 689 Jan 4 15:30 f2 -rw-r--r--. 1 root root 689 Jan 4 15:30 f3 drwx------. 2 root root 16384 Jan 4 14:54 lost+found [root@27 ~]#ll /mnt/snap/f1 -rw-r--r--. 1 root root 689 Jan 4 15:30 /mnt/snap/f1 View data in snapshot [root@27 ~]#rm -f /mnt/shuju/f2 delete f2 [root@27 ~]#ll /mnt/shuju/ total 24 -rw-r--r--. 1 root root 1 Jan 4 15:57 f1 -rw-r--r--. 1 root root 689 Jan 4 15:30 f3 drwx------. 2 root root 16384 Jan 4 14:54 lost+found [root@27 ~]#ll /mnt/snap snapshot still exists total 28 -rw-r--r--. 1 root root 689 Jan 4 15:30 f1 -rw-r--r--. 1 root root 689 Jan 4 15:30 f2 -rw-r--r--. 1 root root 689 Jan 4 15:30 f3 drwx------. 2 root root 16384 Jan 4 14:54 lost+found [root@27 ~]#umount /mnt/shuju [root@27 ~]#umount /mnt/snap [root@27 ~]#Lvconvert -- merge / dev / Vg1 / Shuju? Snapshot Merging of volume vg1/shuju_snapshot started. vg1/shuju: Merged: 100.00% [root@27 ~]#mount /dev/vg1/shuju /mnt/shuju [root@27 ~]#ls /mnt/shuju f1 f2 f3 lost+found //Note: if the snapshot is used up in one time, it will be gone
If sdb2 It's going to break [root@27 ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb2 vg1 lvm2 a-- <2.00g 0 /dev/sdb3 vg1 lvm2 a-- 1020.00m 520.00m /dev/sdc vg1 lvm2 a-- <5.00g 0 [root@27 ~]#pvdisplay --- Physical volume --- PV Name /dev/sdb2 VG Name vg1 PV Size 2.00 GiB / not usable 4.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 511 Free PE 0 Allocated PE 511 PV UUID jmJ13J-XHgq-ou2J-QVvB-CXy1-FTYX-8mnC5r --- Physical volume --- PV Name /dev/sdc VG Name vg1 PV Size 2.00 GiB / not usable 4.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 511 Free PE 0 Allocated PE 511 PV UUID IQ0xHD-btaL-XmmT-cE9Q-BQMU-kYA2-ZDUZxQ --- Physical volume --- PV Name /dev/sdb3 VG Name vg1 PV Size 5.00 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 1279 Free PE 1154 We found that there are 1154 more PE Allocated PE 125 PV UUID RGQEM5-1beD-BzaI-I1Pq-gng4-aUJZ-lEKlrP [root@27 ~]#pvmove /dev/sdc moves the PE of sdb2 to other places (whatever space is available) Removed "/dev/sdb2" from volume group "vg1" [root@27 ~]#pvdisplay /dev/sdbc --- Physical volume --- PV Name /dev/sdc VG Name You can see that it doesn't belong to any vg Space will be reduced accordingly PV Size 2.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID jmJ13J-XHgq-ou2J-QVvB-CXy1-FTYX-8mnC5r [root@27 ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb2 vg1 lvm2 a-- <2.00g 0 /dev/sdb3 vg1 lvm2 a-- 1020.00m 520.00m /dev/sdc lvm2 a-- <5.00g 0 [root@27 ~]#pvremove /dev/sdc can be removed and the partition can be directly unplugged and deleted volume --- PV Name /dev/sdc VG Name You can see that it doesn't belong to any vg Space will be reduced accordingly PV Size 2.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID jmJ13J-XHgq-ou2J-QVvB-CXy1-FTYX-8mnC5r [root@27 ~]#pvs PV VG Fmt Attr PSize PFree /dev/sdb2 vg1 lvm2 a-- <2.00g 0 /dev/sdb3 vg1 lvm2 a-- 1020.00m 520.00m /dev/sdc lvm2 a-- <5.00g 0 [root@27 ~]#pvremove /dev/sdc can be removed and the partition can be directly unplugged and deleted