From:http://bbs.chinaunix.net/thread-3613556-1-1.html
Test environment: Under VMware, centos6,64-bit version, the original system default partition,/dev/sda3 is LOGVOL01, mount to/on. Add a new 30G HDD SDB, expand the new HDD capacity to the original/up.
Test steps:
1.sdb partition, divide only one SDB1 2. Create PV on SDB1
- Pvcreate/dev/sdb1
Copy Code
Shows the situation of the lower PV
[Email protected] ~]# pvdisplay---physical volume---PV name/dev/sda3 VG Name volgr Oup PV Size 18.80 gib/not usable 3.00 MiBAllocatable Yes (but full) PE Size 4.00 MiB total pe 4813 free PE 0 allocated PE 4813 PV UUID r3dcdh-tavs-z0dy-btcg-f5fz-f8mf-dpajw3
"/DEV/SDB1" is a new physical volume of "30.00 GiB"---NEW physical volume---PV name/dev/sdb1 VG Name PV Size 30.00 GiBallocatable NO PE Size 0 Total pe 0 free PE 0 allocated PE 0 PV UUID 1YNXMW-JBLF-XAEE-ZKGD-0BSV-S7BL-SU1MQL
3. View the system now in the case of VG
[[email protected] ~]# vgdisplay ---Volume group--- vg name &nbs P volgroup system ID Format lvm2 metadata areas 1 Metadata Sequence no 3 vg access Read/write & NBSP; VG status resizable max lv 0 cur lv &n bsp; 2 open lv 2 Max pv 0 cur pv &nb Sp 1 aCT pv 1 VG Size 18.80 GiBPE Size 4.00 MiB total PE 4813 Alloc pe/size 4813/18.80 GiB free pe/size 0/0 VG UUID Xdh5kq-vkjk-nroe-dssd-mi1h-sqgk-r07ton
4. Expansion of VG
- Vgextend VOLGROUP/DEV/SDB1
Copy Code
Normal prompt: Volume group "VolGroup" successfully extended
5. Check the condition of the VG after expansion
[[email protected] ~]# vgdisplay ---Volume group--- vg name &nbs P volgroup system ID Format lvm2 metadata areas 2 Metadata Sequence no 4 vg access Read/write & NBSP; VG status resizable max lv 0 cur lv &n bsp; 2 open lv 2 Max pv 0 cur pv &nb Sp 2 aCT pv 2 VG Size 48.80 GiBPE Size 4.00 MiB total PE 12492 Alloc pe/size 4813/18.80 GiB free pe/size 7679/30.00 GiB VG UUID Xdh5kq-vkjk-nroe-dssd-mi1h-sqgk-r07ton
6. View the status of the system LV
[Email protected] ~]# lvdisplay---Logical volume---LV name/dev/volgroup/logvol01 VG Name VolGroup LV UUID iuveuw-2bmn-mm3h-gh16-fkar-chos-ifsosr LV Write Access read/write LV Status Available # open 1 LV Size 16.80 GiBCurrent LE 4301 segments 1 Allocation inherit Read ahead sectors auto- Currently set to Block device 253:0
---Logical volume--- lv name / Dev/volgroup/logvol00 vg name VolGroup & NBSP; LV uuid U9WYDB-XADG-TCE1-FPXO-UYVE-V5GP-A8ULZR lv Write access read/write   LV status available # Open 1 lv size & nbsp; 2.00 GiB current le Segments 1 allocation inherit read ahead sectors auto -currently set to 256 Block device& nbsp 253:1
7. Expansion LV
[[email protected] ~]# LVEXTEND/DEV/VOLGROUP/LOGVOL01/DEV/SDB1 extending Logical volume LOGVOL01 to 46.80 GiB Logical Volume LogVol01 successfully resized
8. Check the LV after expansion
[Email protected] ~]# lvdisplay---Logical volume---LV name/dev/volgroup/logvol01 VG Name VolGroup LV UUID iuveuw-2bmn-mm3h-gh16-fkar-chos-ifsosr LV Write Access read/write LV Status Available # open 1 LV Size 46.80 GiBCurrent LE 11980 segments 2 Allocation inherit Read ahead sectors auto- Currently set to Block device 253:0
---Logical volume--- lv name / Dev/volgroup/logvol00 vg name VolGroup & NBSP; LV uuid U9WYDB-XADG-TCE1-FPXO-UYVE-V5GP-A8ULZR lv Write access read/write   LV status available # Open 1 lv size & nbsp; 2.00 GiB current le Segments 1 allocation inherit read ahead sectors auto -currently set to 256 Block device& nbsp 253:1
9. Now the system partition is as follows,/no expansion
[[email protected] ~]# df-h file system capacity has been used with available percent mount points /dev/mapper/volgroup-logvol01 17G 8.3G 7.5G 53%/ tmpfs 499M 0 499M 0%/dev/shm/dev/sda1 194M 25 M 159M 14%/boot
10. Add/Enlarge
[email protected] ~]# resize2fs/dev/mapper/volgroup-logvol01 resize2fs 1.41.12 (17-may-2010) Filesystem At/dev/ma PPER/VOLGROUP-LOGVOL01 is mounted on/; On-line resizing required Old desc_blocks = 2, new_desc_blocks = 3 performing an on-line resize Of/dev/mapper/volgroup-lo GVol01 to 12267520 (4k) blocks. The filesystem on/dev/mapper/volgroup-logvol01 is now 12267520 blocks long.
11. After the expansion of the partition situation
[[email protected] ~]# df-h file system capacity has been used with available percent mount points /dev/mapper/volgroup-logvol01 47G 8.3G 36G 19%/ tmpfs 499M 0 499M 0%/dev/shm/dev/sda1 194M 25 M 159M 14%/boot
can see/partition has been successfully expanded from 18g+ to 47G
Linux Server plus HDD expansion