[root@nagios_client1 ~]# lvs #查看邏輯卷
ios
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convertide
lv_root VolGroup -wi-ao---- 8.51g ui
lv_swap VolGroup -wi-ao---- 1.00g orm
[root@nagios_client1 ~]# vgs #查卷組it
VG #PV #LV #SN Attr VSize VFreeio
VolGroup 1 2 0 wz--n- 9.51g 0 form
[root@nagios_client1 ~]# pvs #查物理卷class
PV VG Fmt Attr PSize PFreerequire
/dev/sda2 VolGroup lvm2 a-- 9.51g 0 cli
查看主機總線號
[root@nagios_client1 ~]# ls /sys/class/scsi_host/
host0 host1 host2
從新掃描SCSI總線來添加設備
[root@nagios_client1 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@nagios_client1 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@nagios_client1 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
用fdisk /dev/sda 進行分區,將剩餘空間建立一個sda3主分區。ID格式爲8e,建立好分區後按t 再按 8e 設置
partprobe能夠修改kernel中分區表,使kernel從新讀取分區表。
[root@nagios_client1 ~]# rpm -q parted
package parted is not installed
[root@nagios_client1 ~]# yum install parted
[root@nagios_client1 ~]# rpm -q parted
parted-2.1-29.el6.x86_64
使用partprobe重載分區也只能是對不一樣的硬盤才能及時生效。對於同一塊硬盤,修改過度區信息後,必須重啓系統才能使修改過的分區信息生效。
[root@nagios_client1 ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@nagios_client1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup lvm2 a-- 9.51g 0
/dev/sda3 lvm2 --- 40.00g 40.00g #新建立出來的(PV)物理卷
#查看原來VG卷:
[root@nagios_client1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 9.51g 0
卷組VolGroup添加新的物理卷sda3來增大卷組的容量:
[root@nagios_client1 ~]# vgextend VolGroup /dev/sda3
Volume group "VolGroup" successfully extended
#查看擴展後的VG卷:
[root@nagios_client1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 2 2 0 wz--n- 49.50g 40.00g
查看邏輯卷的絕對路徑:
[root@nagios_client1 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/VolGroup/lv_root
....
擴展邏輯卷的大小
[root@nagios_client1 ~]# lvextend -l +100%free /dev/VolGroup/lv_root
Size of logical volume VolGroup/lv_root changed from 8.51 GiB (2178 extents) to 48.50 GiB (12417 extents).
Logical volume lv_root successfully resized
最後要使用resizefs2命令從新加載邏輯卷的大小才能生效:
[root@nagios_client1 ~]# resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 4
Performing an on-line resize of /dev/VolGroup/lv_root to 12715008 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 12715008 blocks long.