(编辑:jimmy 日期: 2024/11/16 浏览:2)
因生产需要对/data目录进行扩容,由原来的90G扩容到190G,增加100G的空间.
生产环境是RHEL服务器,后端通过光纤交换机连的EMC存储。首先在EMC存储上把空闲的硬盘做RAID,划分LUN,映射到生产RHEL服务器。
(注意:此种扩容的前提是分区必须采用LVM格式完成)
一、原服务器磁盘信息
#df -H
/dev/datavg/lv_data
90G 81G 9G 90% /data
#lvdisplay
--- Logical volume ---
LV Name /dev/datavg/lv_data
VG Name datavg
LV UUID Sgpcu1-7Xhr-0gwH-qjJ6-QwBB-k2KA-9DJvFt
LV Write Access read/write
LV Status available
# open 1
LV Size 90.00 GB
Current LE 24882
Segments 10
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
二、重启服务器,识别到EMC上新加的LUN后,在服务器端进行扩容datavg卷
#powerrmt display dev=all
Pseudo name=emcpowery
CLARiiON ID=CKM00110900942 [SG_DRAGON]
Logical device ID=6006016003602C00F0154D04917BE011 [LUN 211]
state=alive; policy=CLAROpt; priority=0; queued-IOs=0;
Owner: default=SP A, current=SP A Array failover mode: 1
==============================================================================
--------------- Host --------------- - Stor - -- I/O Path -- -- Stats ---
### HW Path I/O Paths Interf. Mode State Q-IOs Errors
==============================================================================
7 qla2xxx sdan SP B0 active alive 0 0
5 qla2xxx sdas SP B1 active alive 0 0
7 qla2xxx sdbo SP A1 active alive 0 0
5 qla2xxx sdq SP A0 active alive 0 0
#powerrmt config
#powerrmt save
三、步骤:
Fdisk /dev/emcpowery1 然后按n添加一个新分区;
输入p创建主分区,两次回车将空间全部分给这个分区;
输入t转换分区类型;输入8e表示转换为linux lvm分区;
输入w写入保存退出。
创建PV
[root@linuxas /]# pvcreate /dev/ emcpowery1
加入到已有的逻辑卷组中
[root@linuxas /]# vgextend datavg /dev/ emcpowery1
为LVM扩容
[root@linuxas /]# lvextend -L +100G /dev/datavg/lv_data
检查LVM设备对应inode和block之间的关系
[root@linuxas /]# e2fsck –f /dev/datavg/lv_data
使增加的容量生效
[root@linuxas /]# resize2fs /dev/datavg/lv_data
四、验证
#df -H
/dev/datavg/lv_data
190G 81G 109G 43% /data
#lvdisplay
--- Logical volume ---
LV Name /dev/datavg/lv_data
VG Name datavg
LV UUID Sgpcu1-7Xhr-0gwH-qjJ6-QwBB-k2KA-9DJvFt
LV Write Access read/write
LV Status available
# open 1
LV Size 190.00 GB
Current LE 39882
Segments 10
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1