1. 初始化/dev/sdb为PV
pvcreate /dev/sdb
2. 追加到已有VG组(centos_hikvisionos)
# 追加
vgextend centos_hikvisionos /dev/sdb
# 创建新的VG组
vgcreate ${NewVG} /dev/sdb
多个PV加入VG组时,列在VG组后面以空格分隔
3. 创建LV
# VG组centos_hikvisionos剩余所有空间分配到${LVName}
lvcreate -l +100%free -n ${LVName} centos_hikvisionos
# 分配指定大小空间
lvcreate -L 5G -n ${LVName} centos_hikvisionos
4. 格式化LV
mkfs -t xfs /dev/centos_hikvisionos/${LVName}
5. 挂盘
mkdir /data
echo "/dev/mapper/centos_hikvisionos-${LVName} /data xfs default 0 0" >> /etc/fstab
mount -a