首页 > 代码库 > IOM项目LVM方案
IOM项目LVM方案
需求:
由于将11块本地硬盘做成一个vg,四个lv,但是在dm上面的IO遇到了瓶颈
现在将4块盘,做成两个vg,每个vg两个lv,条带化宽度为2,深度为64K
step1创建VG
[root@localhost ~]# vgcreate vg0 /dev/sdb1 /dev/sdc1
Volume group "vg0"successfully created
[root@localhost ~]# vgcreate vg1 /dev/sdd1 /dev/sde1
Volume group "vg1"successfully created
[root@localhost ~]#
step2创建LV
[root@localhost ~]# lvcreate -L 1.8T-n lvdata1 -i 2 -I 64 vg0
Rounding up size to full physicalextent 1.80 TiB
Logical volume "lvdata1"created
[root@localhost ~]# lvcreate -L 1.8T-n lvdata2 -i 2 -I 64 vg0
Rounding up size to full physicalextent 1.80 TiB
Logical volume "lvdata2"created
[root@localhost ~]# vgdisplay vg0
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 3.64 TiB
PE Size 4.00 MiB
Total PE 953862
Alloc PE / Size 943720 / 3.60 TiB
Free PE / Size 10142 / 39.62 GiB
VG UUID Re8exl-7XnT-GlQa-7nO8-fUy8-YgCb-FLSbUR
[root@localhost ~]# lvcreate -L 1.8T-n lvdata3 -i 2 -I 64 vg1
Rounding up size to full physicalextent 1.80 TiB
Logical volume "lvdata3"created
[root@localhost ~]# lvcreate -L 1.8T-n lvdata4 -i 2 -I 64 vg1
Rounding up size to full physicalextent 1.80 TiB
Logical volume "lvdata4"created
step3格式化LV
[root@localhost ~]# mkfs.ext4/dev/vg0/lvdata1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=16 blocks, Stripe width=32 blocks
120799232 inodes, 483184640 blocks
24159232 blocks (5.00%) reserved for thesuper user
First data block=0
Maximum filesystem blocks=4294967296
14746 block groups
32768 blocks per group, 32768 fragments pergroup
8192 inodes per group
Superblock backups stored on blocks:
32768,98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000,7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000,214990848
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accountinginformation:
done
This filesystem will be automatically checkedevery 21 mounts or
180 days, whichever comes first. Usetune2fs -c or -i to override.
[root@localhost ~]# mkfs.ext4/dev/vg0/lvdata2
[root@localhost ~]# mkfs.ext4/dev/vg1/lvdata3
[root@localhost ~]# mkfs.ext4/dev/vg1/lvdata4
step4.挂载目录
mount /dev/vg0/lvdata1 /data1
mount /dev/vg1/lvdata3 /data2
这里根据项目需求,我们只需要挂载两个目录即可。
step6配置本地磁盘
mkdir /data5
mkdir /data6
mkdir /data7
mkdir /data8
mkdir /data9
mkdir /data10
mkdir /data11
mount /dev/sdf1 /data5
mount /dev/sdg1 /data6
mount /dev/sdh1 /data7
mount /dev/sdi1 /data8
mount /dev/sdj1 /data9
mount /dev/sdk1 /data10
mount /dev/sdl1 /data11
step5.加到开机启动
vi /etc/rc.local
mount /dev/vg0/lvdata1 /data1
mount /dev/vg1/lvdata3 /data2
mount /dev/sdf1 /data5
mount /dev/sdg1 /data6
mount /dev/sdh1 /data7
mount /dev/sdi1 /data8
mount /dev/sdj1 /data9
mount /dev/sdk1 /data10
mount /dev/sdl1 /data11
[root@localhost rules.d]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Dec 405:55:16 2014
#
# Accessible filesystems, by reference, aremaintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8)and/or blkid(8) for more info
#
UUID=20837b76-a9d5-4b7b-bd4c-a9469106bba6 / ext4 defaults 1 1
UUID=69d5918e-c1b6-4567-9e88-927dee78a4ac/boot ext4 defaults 1 2
UUID=3a8fc471-ad91-4c72-b5d4-d22301fce859swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/data1 /dev/mapper/vg0-lvdata1 ext4 defaults 0 0
/data2 /dev/mapper/vg1-lvdata3 ext4 defaults 0 0
/data5 /dev/sdf1 ext4 defaults 0 0
/data6 /dev/sdg1 ext4 defaults 0 0
/data7 /dev/sdh1 ext4 defaults 0 0
/data8 /dev/sdi1 ext4 defaults 0 0
/data9 /dev/sdj1 ext4 defaults 0 0
/data10 /dev/sdk1 ext4 defaults 0 0
/data11 /dev/sdl1 ext4 defaults 0 0
IOM项目LVM方案