● LVM Build
1. Divide the physical partition and change the partition ID to 8e
Pvs|pvdisplay Viewing physical volumes
Vgs|vgdisplay Viewing physical volume groups
Lvs|lvdisplay to view logical volume devices
Monitoring commands
Watch-n 1 \
' echo ' = = = Pvinfo = = = "\
;p vs\
; echo "= = = Vginfo = = =" \
; vgs\
; echo "= = = Lvinfo = = =" \
; lvs\
;d f-h/mnt '
Create
PVCREATE/DEV/VDB1 physical partitions into physical volumes
Vgcreate WESTOS/DEV/VDB1 to make a physical volume group of/DEV/VDB1 This physical volume vg0
Lvcreate-l 100m-n lv0 Westos set up vg0 device in lv0 This group-l specify device size-n Specify device name
Mkfs.xfs/dev/westos/lv0
mount/dev/westos/lv0/mnt/
Expansion
Lvextend-l 200m/dev/westos/lv0 Extended LVM device to 200M
Xfs_growfs/dev/westos/lv0 enlarge XFS File system to device size
PVCREATE/DEV/VDB2 add a piece of equipment to PV/DEV/VDB2
Vgextend WESTOS/DEV/VDB2 Add the newly created/DEV/VDB2 to the Westos
Lvextend-l 600m/dev/westos/lv0 Extended LVM device to 600M
Xfs_growfs/dev/westos/lv0 enlarge XFS File system to device size
Capacity reduction
umount/mnt/Uninstalling the device
Mkfs.ext4/dev/westos/lv0 Modify the file system type to Ext
E2fsck-f/dev/westos/lv0 Detection File system
Resize2fs/dev/westos/lv0 100M file system reduced to 100M
mount/dev/westos/lv0/mnt/Mount
Snapshot
umount/mnt/
Lvcreate-l 10m-n lv0-backup-s/dev/westos/lv0
Create a snapshot for/dev/vg0/lv0
-L Specify Snapshot size
-n Specifies the snapshot name
-s Specifies the snapshot template device
mount/dev/westos/lv0-backup/mnt/hanging in the mirror
Delete Step
umount/mnt/
Lvremove/dev/westos/lv0-backup
Lvremove/dev/westos/lv0
Vgremove Westos
Pvremove/dev/vdb1
Fdisk/dev/vdb
D+enter
D+enter
Wq
Partprobe
Script New partition
Vim 1
#!/bin/bash
Fdisk/dev/vdb << End
N
+1g
Wq
End
This article from the "12147236" blog, reproduced please contact the author!
"Linux Rookie 2" LVM