多塊盤製作成一個lvm

weixin_33896726發表於2018-01-26

1、建立pv
[root@autodeploy nfs]# pvcreate /dev/vdd1
WARNING: xfs signature detected on /dev/vdd1 at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/vdd1.
Physical volume "/dev/vdd1" successfully created
[root@autodeploy nfs]# pvcreate /dev/vde1
Physical volume "/dev/vde1" successfully created

2、建立vg
[root@autodeploy nfs]# vgcreate nfs_vg /dev/vdd1 /dev/vde1
Volume group "nfs_vg" successfully created

3、建立lv
[root@autodeploy ~]# lvcreate -l 100%FREE -n nfs_lv nfs_vg
Logical volume "nfs_lv" created.
大小可以指定,比如:
lvcreate -l 100G -n nfs_lv nfs_vg

4、格代化lv為xfs
[root@autodeploy dev]# mkfs.xfs /dev/nfs_vg/nfs_lv
meta-data=/dev/nfs_vg/nfs_lv isize=256 agcount=4, agsize=262143488 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=1048573952, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=511999, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

5、新加入一塊100G的盤
pvcreate /dev/vdf1

把pv加到VG中:vgextend nfs_vg /dev/vdf1

將邏輯卷分割槽VG(nfs_vg)增加100G:lvextend -L +100G /dev/nfs_vg/nfs_lv

調整xfs: resize2fs -p /dev/nfs_vg/nfs_lv

相關文章