1.在虚拟机设置里添加3快新硬盘
[[email protected] ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 5G 0 disk
sdc 8:32 0 5G 0 disk
sdd 8:48 0 5G 0 disk
sr0 11:0 1 3.8G 0 rom
2.创建分区
[[email protected] ~]# fdisk /dev/sdb
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 10485759 5241856 83 Linux
[[email protected] ~]# fdisk /dev/sdc
设备 Boot Start End Blocks Id System
/dev/sdc1 2048 10485759 5241856 83 Linux
[[email protected] ~]# fdisk /dev/sdd
设备 Boot Start End Blocks Id System
/dev/sdd1 2048 10485759 5241856 83 Linux
3.将磁盘加入物理卷
[[email protected] ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[[email protected] ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created.
[[email protected] ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created.
[[email protected] ~]# pvs 查看
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <19.00g 0
/dev/sdb1 lvm2 --- <5.00g <5.00g
/dev/sdc1 lvm2 --- <5.00g <5.00g
/dev/sdd1 lvm2 --- <5.00g <5.00g
4.创建卷组 “ jz1 jz2 jz3 ”
[[email protected] ~]# vgcreate jz1 /dev/sdb1
Volume group "jz1" successfully created
[[email protected] ~]# vgcreate jz2 /dev/sdc1
Volume group "jz2" successfully created
[[email protected] ~]# vgcreate jz3 /dev/sdd1
Volume group "jz3" successfully created
查看
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <19.00g 0
jz1 1 0 0 wz--n- <5.00g <5.00g
jz2 1 0 0 wz--n- <5.00g <5.00g
jz3 1 0 0 wz--n- <5.00g <5.00g
5.创建逻辑卷 “ lj1 lj2 lj3 ”大小以及分配逻辑卷名称和卷组
[[email protected] ~]# lvcreate -L 1G -n lj1 jz1
Logical volume "lj1" created.
[[email protected] ~]# lvcreate -L 1G -n lj1 jz2
Logical volume "lj1" created.
[[email protected] ~]# lvcreate -L 1G -n lj1 jz3
Logical volume "lj1" created.
查看
[[email protected] ~]# lvscan
ACTIVE ‘/dev/jz3/lj1‘ [1.00 GiB] inherit
ACTIVE ‘/dev/jz2/lj1‘ [1.00 GiB] inherit
ACTIVE ‘/dev/jz1/lj1‘ [1.00 GiB] inherit
ACTIVE ‘/dev/centos/swap‘ [2.00 GiB] inherit
ACTIVE ‘/dev/centos/root‘ [<17.00 GiB] inherit
格式化文件系统为ext4
[[email protected] ~]# mkfs.ext4 /dev/jz1/lj1
[[email protected] ~]# mkfs.ext4 /dev/jz2/lj1
[[email protected] ~]# mkfs.ext4 /dev/jz3/lj1
挂载到yp1 yp2 yp3
mkdir /yp1
mkdir /yp2
mkdir /yp3
mount /dev/jz1/lj1 /yp1/
mount /dev/jz2/lj1 /yp2/
mount /dev/jz3/lj1 /yp3/
做扩展
[[email protected] ~]# lvextend -L +1G /dev/jz3/lj1
Size of logical volume jz3/lj1 changed from 1.00 GiB (256 extents) to 2.00 GiB (512 extents).
Logical volume jz3/lj1 successfully resized.
最后lsblk查看
原文地址:http://blog.51cto.com/13859004/2144616