Centos6,ssd磁盘扩容
首先使用fdisk创建新磁盘:
fdisk /dev/sdc
第一步:创建pv
[root@h103 ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
第二步:将新的pv加入到vg
[root@h103 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 39.51g 0
vgdata 1 1 0 wz--n- 220.00g 10.00g
[root@h103 ~]# vgextend vgdata /dev/sdc1
Volume group "vgdata" successfully extended
[root@h103 ~]# lvextend -l +100%FREE /dev/mapper/vgdata-lvdata
Size of logical volume vgdata/lvdata changed from 210.00 GiB (53760 extents) to 349.99 GiB (89597 extents).
Logical volume lvdata successfully resized.
第三步:扩容LVM
[root@h103 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
35G 8.9G 25G 27% /
tmpfs 20G 0 20G 0% /dev/shm
/dev/sda1 477M 37M 415M 9% /boot
/dev/mapper/vgdata-lvdata
207G 58G 139G 30% /opt
cm_processes 20G 844K 20G 1% /var/run/cloudera-scm-agent/process
[root@h103 ~]# resize2fs /dev/mapper/vgdata-lvdata
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vgdata-lvdata is mounted on /opt; on-line resizing required
old desc_blocks = 14, new_desc_blocks = 22
Performing an on-line resize of /dev/mapper/vgdata-lvdata to 91747328 (4k) blocks.
The filesystem on /dev/mapper/vgdata-lvdata is now 91747328 blocks long.
PV、VG、LV三者关系:
PV PV PV PV
↓↓↓↓
VG
↓↓
LV LV 分区3 剩余空间