#创建逻辑卷
[root@wanghaiyang ~]# pvcreate /dev/sd[bcde]
Physical volume "/dev/sdb" successfully created
Physical volume "/dev/sdc" successfully created
Physical volume "/dev/sdd" successfully created
Physical volume "/dev/sde" successfully created
#出目录 -s指定PE大小
[root@wanghaiyang ~]# vgcreate -s 8 vg0 /dev/sd[bcde]
Volume group "vg0" successfully created
#切割指定大小使用 -L指定切割大小 -n创建名字
[root@wanghaiyang ~]# lvcreate -L 20G -n xuexi vg0
Logical volume "xuexi" created
#格式化
[root@wanghaiyang ~]# mkfs.ext4 /dev/vg0/xuexi
[root@wanghaiyang ~]# ll /dev/vg0/xuexi
lrwxrwxrwx. 1 root root 7 Feb 10 07:47 /dev/vg0/xuexi -> ../dm-2
#挂载
[root@wanghaiyang ~]# mount /dev/vg0/xuexi ./sh
#查看
[root@wanghaiyang ~]# ls sh
lost+found
#扩建大小 -L 40G 扩大到40G -L+20G 扩大20G
[root@wanghaiyang ~]# lvextend -L 40G /dev/vg0/xuexi
Extending logical volume xuexi to 40.00 GiB
Logical volume xuexi successfully resized
#挂载时候使用的命令,对扩建的磁盘格式化,不影响之前
[root@wanghaiyang ~]# resize2fs /dev/vg0/xuexi
[root@wanghaiyang ~]# df -h
/dev/mapper/vg0-xuexi 20G 172M 19G 1% /root/sh
[root@wanghaiyang ~]# df -h |grep "/dev/mapper/vg0"
/dev/mapper/vg0-xuexi 40G 176M 38G 1% /root/sh
LVM逻辑卷
最新推荐文章于 2023-02-19 16:00:24 发布