Prepare 3 hard disks without partitioning ideas—PV----VG—LV
lsblk
##Create PV
pvcreate /dev/sdb
##View the current PV
pvscan
pvs
vgcreate datevg /dev/sdb (datavg is the name given)
vgscan
pvscan ##Get echo pv/dev/sdb added to VG datevg capacity XXfree #create
LV
lvcreate -L 200M -n lv1 datavg -L (specify the size of lv) Specify the name of 200m lv1 to create from datevg
lvcreate -L 300M -n lv2 datavg
lvscan ## Get the echo /dev/datevg/lv1 200m
/dev/datevg/lv2 300m
Then look at lsblk to look at /dev/sdb? ? ? ?
##Format, create a file system mount
mkfs.xfs /dev/datevg/lv1
mkfs.ext4 /dev/datevg/lv2
mkdir /mnt/lv1 /mnt/lv2
挂载
mount /dev/datevg/lv1 /mnt/lv1
mount /dev/datevg/lv2 /mnt/lv2
mount -a
df -h (df-Th) plus TYPE type
LVM complete
############################################## #######
Expand VG
vgs
pvcreate /dev/sdc becomes PV first
vgextend datevg /dev/sdc view pvscan
vgs free becomes bigger and the experiment is successful
Continue to expand
pvcreate /dev/sdd
vgextend datevg /dev/sdd
Keep viewing VFree Keep getting bigger
########################################## ###################
Reduce VG data migration! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
pvs view
pvmove /dev/sdb /dev/sdc still sdb data to sdc
vgreduce datevg /dev/sdb
pvscan
Check the changes. Data migration completed
Note:
pv cannot cross vg
lv cannot cross vg
multiple vg
can be created in the system multiple lv can be created in vg