查看逻辑卷组情况
[root@linuxas /]# vgdisplay
--- Volume group ---
VG Name tgt
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.06 GB (VG为逻辑卷组的大小)
PE Size 4.00 MB (PE为逻辑卷组最小存储单位)
Total PE 272
Alloc PE / Size 0 / 0
Free PE / Size 272 / 1.06 GB
VG UUID g33wzW-yCvX-gc64-YQuD-LYeP-zgra-TGAa8G
1、新添一块硬盘并进行分区操作,并指定为LVM
- [root@linuxas /]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 535 4096575 83 Linux
/dev/sda3 536 854 2562367+ 83 Linux
/dev/sda4 855 1044 1526175 5 Extended
/dev/sda5 855 905 409626 82 Linux swap / Solaris
/dev/sda6 906 1044 1116486 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 8e Linux LVM
2、创建物理卷
- [root@linuxas /]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
3、将新添的物理卷加入到已有的逻辑卷组中
- [root@linuxas /]# vgextend tgt /dev/sdb1
Volume group "tgt" successfully extended
4、为LVM扩容
- [root@linuxas /]# lvextend -L 5368M /dev/tgt/lvm
(此命令将此卷的总容量定为5368M)
Extending logical volume lvm to 5.24 GB
Logical volume lvm successfully resized
或者用
- [root@linuxas /]# lvextend -L +1000M /dev/tgt/lvm
(此命令将此卷的总容量增加1000M)
- [root@linuxas /]# e2fsck -f /dev/tgt/lvm ( 检查LVM设备对应inode和block之间的关系)
- [root@linuxas /]# resize2fs /dev/tgt/lvm (使增加的容量生效)