make partition
fdisk /dev/md0
n
p
t
8e
w
Now go back to the #command line
partprobe makes the partition table effective
fdisk -l to view the partition name
Let's say /dev/md0p1
Create a physical voucher: pvcreate /dev/md0p1
Create a voucher group: vgcreate vg_instance /dev/md0p1
Create a logical coupon: lvcreate -L 2000G -n lv_instance vg_instance
Format the logical ticket: mkfs.ext4 /dev/vg_instance/lv_instance
Mount logical coupons mount /dev/vg_instance/lv_instance /var/lib/nova/instances
View logical coupon mount information blkid /dev/mapper/vg_instance-lv_instance
Make the mount bootable (it is best not to put the bootstrap mount in /etc/fstab, otherwise it may fail to boot)
Add before exit 0 in /etc/rc.local
/sbin/vgchange -ay /dev/vg_instance
mount /dev/vg_instance/lv_instance /var/lib/nova/instances
lvm快照:lvcreate -L 100G -s -n databackup /dev/vg_instance/lv_instance
Physical Coupon Related Commands
View physical coupon information: Display the status of all physical coupons: pvscan
View the detailed parameters of a physical coupon: pvdisplay /dev/md0p1
delete physical coupon pvremove /dev/md0p1
Voucher group related operations
View coupon group information: display the names of all coupon groups vgscan
View the detailed parameters of a coupon group: vgdisplay /dev/vg_instance
Reduce coupon group: remove a physical coupon from the coupon group: vgreduce vg_instance /dev/md0p1
Expansion coupon group: Add a physical coupon to the coupon group: vgextend vg_instance /dev/md0p1
Delete coupon group: vgremove /dev/vg_instance
Increase logical coupon size: lvextend -L +1000M /dev/vg_instance/lv_instance
Reduce logical ticket size: Lvreduce -L -100M /dev/vg_instance/lv_instance
Make changes take effect immediately resize2fs /dev/vg_instance/lv_instance
Remove logical coupon: lvremove /dev/vg_instance/lv_instance
In order to facilitate the management and setting of coupons during vgcreate and lvcreate: generally set
-s: Specifies the size of the extension block (PE), the default is 4MB;
(equivalent to a cluster on a disk, the basic unit of extending a logical volume. The latter value can be 8M 16M 32M 64M ..... up to 65532 extended blocks.
In this way, when using lvcreate, use -l followed by the number of pe blocks at the time of creation (much better than using -L directly followed by the size, you can try it if you have time)
Reference URL: http://blog.sina.com.cn/s/blog_588c88cb0100y4ev.html