lvm的管理脚本
#!/bin/bash#显示设备
lsblk
#创建物理卷
read -p "device:" device
pvcreate /dev/$device
#创建卷组
read -p "vgname:" vgname
vgcreate $vgname /dev/$device
#创建逻辑卷
read -p "lvname:" lvname
lvcreate -l 100%VG -n $lvname $vgname
#格式化逻辑卷
mkfs.xfs /dev/mapper/$vgname-$lvname
#创建挂载目录
read -p "mount dir:" dir
mkdir -p /$dir
#写入挂载磁盘信息,永久挂载
echo "/dev/mapper/$vgname-$lvname /$dir xfs defaults 0 0" >> /etc/fstab
mount -a
#展示
df -Th
{:6_299:}
页:
[1]