扩容 /dev/mapper/centos-root空间的过程记录

时间:2021-02-27 08:20:58


Last login: Sun Mar 31 08:26:03 2019 from 10.0.0.3
[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 1.4G 3.1G 31% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@vmhzpcentosdisk ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 4.8G 1.5G 3.3G 31% /
devtmpfs devtmpfs 507M 0 507M 0% /dev
tmpfs tmpfs 520M 0 520M 0% /dev/shm
tmpfs tmpfs 520M 7.4M 513M 2% /run
tmpfs tmpfs 520M 0 520M 0% /sys/fs/cgroup
/dev/sda1 xfs 1.1G 163M 901M 16% /boot
tmpfs tmpfs 104M 0 104M 0% /run/user/0
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
[root@vmhzpcentosdisk ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 4.39g
swap centos -wi-ao---- 616.00m
[root@vmhzpcentosdisk ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1G 0 disk
└─sda1 8:1 0 1G 0 part /boot
sdb 8:16 0 5G 0 disk
└─sdb1 8:17 0 5G 0 part
├─centos-root 253:0 0 4.4G 0 lvm /
└─centos-swap 253:1 0 616M 0 lvm [SWAP]
sdc 8:32 0 2G 0 disk
├─sdc1 8:33 0 1G 0 part
└─sdc2 8:34 0 1023M 0 part
sdd 8:48 0 2G 0 disk
├─sdd1 8:49 0 1G 0 part
└─sdd2 8:50 0 1023M 0 part
sr0 11:0 1 1024M 0 rom
[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created.
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdc2
Physical volume "/dev/sdc2" successfully created.
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created.
[root@vmhzpcentosdisk ~]# pvcreate /dev/sdd2
Physical volume "/dev/sdd2" successfully created.
[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 lvm2 --- 1.00g 1.00g
/dev/sdc2 lvm2 --- 1023.00m 1023.00m
/dev/sdd1 lvm2 --- 1.00g 1.00g
/dev/sdd2 lvm2 --- 1023.00m 1023.00m
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
[root@vmhzpcentosdisk ~]# vgextend centos /dev/sdc1
Volume group "centos" successfully extended
[root@vmhzpcentosdisk ~]# vgextend centos /dev/sdd1
Volume group "centos" successfully extended
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 3 2 0 wz--n- <6.99g 1.99g
[root@vmhzpcentosdisk ~]# vgdisplay -v centos
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size <6.99 GiB
PE Size 4.00 MiB
Total PE 1789
Alloc PE / Size 1279 / <5.00 GiB
Free PE / Size 510 / 1.99 GiB
VG UUID elZKnn-cOks-RapN-sZiu-tqIo-YE0w-G7qxfK

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID bntBvT-ohQb-h5AS-g7Uz-S2IZ-MJXY-g5vHN2
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 1
LV Size 4.39 GiB
Current LE 1125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 1jlIZY-wZeS-rpqo-PZGl-TSzc-qQBY-cy1MVV
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 2
LV Size 616.00 MiB
Current LE 154
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

--- Physical volumes ---
PV Name /dev/sdb1
PV UUID XlSjh3-kTyb-wkzF-hk73-3tG1-zLZX-imxY82
PV Status allocatable
Total PE / Free PE 1279 / 0

PV Name /dev/sdc1
PV UUID 5U1Vau-bqEe-irpJ-Ldgh-jstZ-rAxC-W9gPUc
PV Status allocatable
Total PE / Free PE 255 / 255

PV Name /dev/sdd1
PV UUID U3w6IS-Uo5K-bcWj-RkRC-sQ0H-SLeE-wl0H5Z
PV Status allocatable
Total PE / Free PE 255 / 255

[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 1.4G 3.1G 31% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@vmhzpcentosdisk ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 4.8G 1.5G 3.3G 31% /
devtmpfs devtmpfs 507M 0 507M 0% /dev
tmpfs tmpfs 520M 0 520M 0% /dev/shm
tmpfs tmpfs 520M 7.4M 513M 2% /run
tmpfs tmpfs 520M 0 520M 0% /sys/fs/cgroup
/dev/sda1 xfs 1.1G 163M 901M 16% /boot
tmpfs tmpfs 104M 0 104M 0% /run/user/0
[root@vmhzpcentosdisk ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 centos lvm2 a-- <5.00g 0
/dev/sdc1 centos lvm2 a-- 1020.00m 1020.00m
/dev/sdc2 lvm2 --- 1023.00m 1023.00m
/dev/sdd1 centos lvm2 a-- 1020.00m 1020.00m
/dev/sdd2 lvm2 --- 1023.00m 1023.00m
[root@vmhzpcentosdisk ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 3 2 0 wz--n- <6.99g 1.99g
[root@vmhzpcentosdisk ~]# vgdisplay -v centos
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 3
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 3
Act PV 3
VG Size <6.99 GiB
PE Size 4.00 MiB
Total PE 1789
Alloc PE / Size 1279 / <5.00 GiB
Free PE / Size 510 / 1.99 GiB
VG UUID elZKnn-cOks-RapN-sZiu-tqIo-YE0w-G7qxfK

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID bntBvT-ohQb-h5AS-g7Uz-S2IZ-MJXY-g5vHN2
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 1
LV Size 4.39 GiB
Current LE 1125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 1jlIZY-wZeS-rpqo-PZGl-TSzc-qQBY-cy1MVV
LV Write Access read/write
LV Creation host, time converter, 2019-02-22 01:34:34 +0800
LV Status available
# open 2
LV Size 616.00 MiB
Current LE 154
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

--- Physical volumes ---
PV Name /dev/sdb1
PV UUID XlSjh3-kTyb-wkzF-hk73-3tG1-zLZX-imxY82
PV Status allocatable
Total PE / Free PE 1279 / 0

PV Name /dev/sdc1
PV UUID 5U1Vau-bqEe-irpJ-Ldgh-jstZ-rAxC-W9gPUc
PV Status allocatable
Total PE / Free PE 255 / 255

PV Name /dev/sdd1
PV UUID U3w6IS-Uo5K-bcWj-RkRC-sQ0H-SLeE-wl0H5Z
PV Status allocatable
Total PE / Free PE 255 / 255


[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 1.4G 3.1G 31% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0

[root@vmhzpcentosdisk ~]# lvextend -L +1G /dev/mapper/centos-root
Size of logical volume centos/root changed from <4.40 GiB (1126 extents) to <5.40 GiB (1382 extents).
Logical volume centos/root successfully resized.
[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 1.4G 3.1G 31% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@vmhzpcentosdisk ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=5, agsize=288000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=1153024, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1153024 to 1415168
[root@vmhzpcentosdisk ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 5.4G 1.4G 4.1G 25% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@vmhzpcentosdisk ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1G 0 disk
└─sda1 8:1 0 1G 0 part /boot
sdb 8:16 0 5G 0 disk
└─sdb1 8:17 0 5G 0 part
├─centos-root 253:0 0 5.4G 0 lvm /
└─centos-swap 253:1 0 616M 0 lvm [SWAP]
sdc 8:32 0 2G 0 disk
├─sdc1 8:33 0 1G 0 part
│ └─centos-root 253:0 0 5.4G 0 lvm /
└─sdc2 8:34 0 1023M 0 part
sdd 8:48 0 2G 0 disk
├─sdd1 8:49 0 1G 0 part
│ └─centos-root 253:0 0 5.4G 0 lvm /
└─sdd2 8:50 0 1023M 0 part
sr0 11:0 1 1024M 0 rom
[root@vmhzpcentosdisk ~]#