lvm disk volume management

= physical volume PV = physical partitions
vg = volume group
LV = logical
first to the physical disk (physical partition) into pv, then the new vg on pv, vg across PV for expansion, such as PV (SDB) to the expansion can vg (sda), then New on vg lv, LV dilatation can not be cross-VG, LV dilatation only in their own VG inside.
#lsblk see a few hard drives
#pvcreate / dev / sdb1 / dev / sdb2 / dev / sdb3 create pv (or the pvcreate # / dev / sdb)
#pvcreate / dev / sda2 -FF forced to create pv, sometimes automatic installation of centos lvm the system will sda2 formatted into lvm format, without -ff can not be re-formatted into pv of sda2

#vgcreate vg1 / dev / sdb [1-3 ] Create vg
#lvcreate LV1 -L -n 1.5G create the VG1 lv
format
# the mkfs.xfs / dev / the VG1 / LV1
#pvs view pv information
#vgs See vg information
#lvs View lv information
in this pv expansion and vg lv
#lvextend -L + 300M / dev / vg1 / lv1 will vg1 following lv1 expand 300M
# resize2fs / dev / Vg1 / LV1 RHEL6 update command
#xfs_growfs / dev / mapper / LV1 rhel7 update Life

yum -y install parted -y

#partprobe / dev / sdb partition table refresh
cross pv vg expansion and LV
#vgextend vg1 / dev / SDB: the expansion of the remaining space in PV2 (SDB) to vg1
#lvextend -L + 300M / dev / vg1 / LV1: the vg1 the following lv1 expand 300M
# resize2fs / dev / Vg1 / LV1 RHEL6 update command

xfs_growfs / dev / mapper / LV1 rhel7 Update Command

#partprobe / dev / sdb partition table refresh
narrow
#vgextend vg1 / dev / sdb5
#lvreduce -L 1G / dev / vg1 / # LV1 LV1 reduced to 1G of space, if you can not use vga1 narrow
#vgreduce vg1 / dev / sdb1 # vg1 delete sdb1, sdb1 if it can not be deleted using the
delete
#umount / dev / vg1 / LV1
#lvremove LV1 / dev / vg1
#vgremove / dev / vg1
#pvremove / dev / sdb [1-5]

Snapshot creation and restore
#lvcreate -s -L -n lv1_sp 1.5G / dev / vg1 / LV1
#umount / dev / vg1 / LV1
#mount / dev / vg1 / lv1_sp / LV1

Guess you like

Origin blog.51cto.com/hzcto/2452371