lvm 通过扩容本身磁盘容量扩容
场景:sdb之前是3G容量,现在扩容了sdb的容量到8G。现在把新扩容的5G容量扩展到现有的逻辑卷中
[root@localhost ~]# pvresize /dev/sdb
Physical volume "/dev/sdb" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb
VG Name domuvg
PV Size 8.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 2047
Free PE 1280
Allocated PE 767
PV UUID Do2B23-Mg1v-z5JX-6NoJ-sXIk-Smwy-uR7IoE
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name domuvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 8.00 GiB
PE Size 4.00 MiB
Total PE 2047
Alloc PE / Size 767 / 3.00 GiB
Free PE / Size 1280 / 5.00 GiB
VG UUID 4Shwbf-0m2N-3icW-cEil-6W5x-JNLS-bXCZ7W
[root@localhost ~]# lvextend -l +100%FREE /dev/domuvg/alidata
Size of logical volume domuvg/alidata changed from 2.00 GiB (511 extents) to 7.00 GiB (1791 extents).
Logical volume alidata successfully resized
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/domuvg/swap
LV Name swap
VG Name domuvg
LV UUID xZdi63-3wLm-rKE5-1EYh-0Q7p-bHZM-oibkoj
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-10-08 15:10:14 +0800
LV Status available
# open 1
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/domuvg/alidata
LV Name alidata
VG Name domuvg
LV UUID g2pjLY-epuy-2Ba0-eBLc-EjIr-sSAO-mt8VOF
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-10-08 15:10:15 +0800
LV Status available
# open 1
LV Size 7.00 GiB
Current LE 1791
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
[root@localhost ~]# resize2fs /dev/domuvg/alidata
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/domuvg/alidata is mounted on /alidata; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/domuvg/alidata to 1833984 (4k) blocks.
The filesystem on /dev/domuvg/alidata is now 1833984 blocks long.
[root@localhost ~]# df -Ph
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 7.3G 1020M 5.9G 15% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/mapper/domuvg-alidata 6.9G 4.5M 6.6G 1% /alidata