Operating environment: VirtualBox RedHat6.4 64-bit version expansion reason:/dev/vg_rhel64/lv_root occupancy rate of 100%, Causes some apps to fail to continue operation procedure: 1. Shut down the system and add a 10G disk to the virtual Machine 2. View the name of the newly added disk
[[email protected] ~]# Fdisk-cul learned that the disk corresponds to the name/DEV/SDC
3. To the SDC partition, divide only one district SDC1
[Email protected] ~]# FDISK-CU/DEV/SDC
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0xa655ad49.
Changes'll remain in memory only, until the decide to write them.
After that, of course, the previous content won ' t is recoverable.
Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite)
Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 1
First sector (2048-20971519, default 2048):
Using Default Value 2048
Last sector, +sectors or +size{k,m,g} (2048-20971519, default 20971519):
Using Default Value 20971519
Command (M for help): P
disk/dev/sdc:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * MB = bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xa655ad49
Device Boot Start End Blocks Id System
/DEV/SDC1 2048 20971519 10484736-up Linux
Command (M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
4. Create PV on SDC1
[Email protected] ~]# PVCREATE/DEV/SDC1
Physical volume "/DEV/SDC1" successfully created
5. View PV Status
[Email protected] ~]# Pvdisplay
---physical volume---
PV NAME/DEV/SDB2
VG Name Vg_rhel64
PV Size 14.51 gib/not usable 3.00 MiB
Allocatable Yes (but full)
PE Size 4.00 MiB
Total PE 3714
Free PE 0
Allocated PE 3714
PV UUID VBVNOJ-7R81-0BGJ-J8TR-NQ2W-I84V-XJZLQZ
---physical volume---
PV Name/dev/sda5
VG Name VG_MYVG
PV Size 1.00 gib/not usable 4.00 MiB
Allocatable Yes (but full)
PE Size 4.00 MiB
Total PE 255
Free PE 0
Allocated PE 255
PV UUID CMX1TX-1LDX-WTRF-QXOX-MYG3-WR5G-KLWUG9
---physical volume---
PV Name/dev/sda6
VG Name VG_MYVG
PV Size 1021.00 mib/not usable 0
Allocatable Yes (but full)
PE Size 4.00 MiB
Total PE 255
Free PE 0
Allocated PE 255
PV UUID q9fgfp-0ghf-kmtk-vrfa-2f95-ekrg-7bq40d
"/DEV/SDC1" is a new physical volume of "10.00 GiB"
---NEW physical volume---
PV NAME/DEV/SDC1
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Krvmui-kzmd-qgdp-sbl6-yyfz-q5y6-pa1vv0
6. View the current status of the system VG
[Email protected] ~]# Vgdisplay
---Volume Group---
VG Name Vg_rhel64
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
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 14.51 GiB
PE Size 4.00 MiB
Total PE 3714
Alloc pe/size 3714/14.51 GiB
Free Pe/size 0/0
VG UUID Yb3igx-1sdp-mofz-i4is-0odt-nhvd-se5uar
---Volume Group---
VG Name VG_MYVG
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
ACT PV 2
VG Size 1.99 GiB
PE Size 4.00 MiB
Total PE 510
Alloc pe/size 510/1.99 GiB
Free Pe/size 0/0
VG UUID x9suhj-gq4c-avxr-daq1-ceib-vtgf-nvwqv9
7. Expanding the VG
[Email protected] ~]# vgextend VG_RHEL64/DEV/SDC1
Volume Group "Vg_rhel64" successfully extended
8. View the status of VG after expansion
[Email protected] ~]# Vgdisplay
---Volume Group---
VG Name Vg_rhel64
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
ACT PV 2
VG Size 24.50 GiB
PE Size 4.00 MiB
Total PE 6273
Alloc pe/size 3714/14.51 GiB
Free Pe/size 2559/10.00 GiB
VG UUID Yb3igx-1sdp-mofz-i4is-0odt-nhvd-se5uar
---Volume Group---
VG Name VG_MYVG
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
ACT PV 2
VG Size 1.99 GiB
PE Size 4.00 MiB
Total PE 510
Alloc pe/size 510/1.99 GiB
Free Pe/size 0/0
VG UUID x9suhj-gq4c-avxr-daq1-ceib-vtgf-nvwqv9
9. View the current LV situation in the system
[Email protected] ~]# Lvdisplay
---Logical volume---
LV Path/dev/vg_rhel64/lv_root
LV Name Lv_root
VG Name Vg_rhel64
LV UUID y2oxr6-yrxx-fetw-giol-ihmc-hbov-fiuc83
LV Write Access Read/write
LV Creation Host, Time rhel64.oracle.com, 2017-11-13 21:47:39 +0800
LV Status Available
#open 1
LV Size 12.54 GiB
Current LE 3210
Segments 1
Allocation inherit
Read ahead Sectors Auto
Currently set to 256
Block Device 253:0
---Logical volume---
LV Path/dev/vg_rhel64/lv_swap
LV Name Lv_swap
VG Name Vg_rhel64
LV UUID Ouubwz-wqmd-kz5b-ka62-ifgy-hfd5-6bpdzl
LV Write Access Read/write
LV Creation Host, Time rhel64.oracle.com, 2017-11-13 21:47:42 +0800
LV Status Available
#open 1
LV Size 1.97 GiB
Current LE 504
Segments 1
Allocation inherit
Read ahead Sectors Auto
Currently set to 256
Block Device 253:1
---Logical volume---
LV PATH/DEV/VG_MYVG/LV_MYLV
LV Name Lv_mylv
VG Name VG_MYVG
LV UUID vfq38a-3mj1-rrso-2eci-e9go-wz2a-ywu3x8
LV Write Access Read/write
LV Creation Host, Time rhel64.oracle.com, 2018-01-12 14:14:35 +0800
LV Status Available
#open 1
LV Size 1.99 GiB
Current LE 510
Segments 2
Allocation inherit
Read ahead Sectors Auto
- currently set to 25610. For LV expansion
[[email protected] ~]# LVEXTEND/DEV/VG_RHEL64/LV_ROOT/DEV/SDC1
Extending Logical volume Lv_root to 22.54 GiB
Logical Volume Lv_root successfully resized
11. See the LV [[email after expansion Protected] ~]# Lvdisplay
---Logical volume---
LV path/dev/vg_rhel64/lv_root
LV Name lv_root
VG name Vg_rhe L64
LV UUID y2oxr6-yrxx-fetw-giol-ihmc-hbov-fiuc83
LV Write Access read/write
LV Creation host, time rhel64.oracle.com, 2017-11-13 21:47:39 +0800
LV Status available
#open 1
LV Size 22.54 GiB
Current LE 5769
segments 2
Allocation inherit
Read ahead sectors auto
Currently set to 256
Block Device 253:0
---Logical volume---
LV Path/dev/vg_rhel64/lv_swap
LV Name Lv_swap
VG Name Vg_rhel64
LV UUID Ouubwz-wqmd-kz5b-ka62-ifgy-hfd5-6bpdzl
LV Write Access Read/write
LV Creation Host, Time rhel64.oracle.com, 2017-11-13 21:47:42 +0800
LV Status Available
#open 1
LV Size 1.97 GiB
Current LE 504
Segments 1
Allocation inherit
Read ahead Sectors Auto
Currently set to 256
Block Device 253:1
---Logical volume---
LV PATH/DEV/VG_MYVG/LV_MYLV
LV Name Lv_mylv
VG Name VG_MYVG
LV UUID vfq38a-3mj1-rrso-2eci-e9go-wz2a-ywu3x8
LV Write Access Read/write
LV Creation Host, Time rhel64.oracle.com, 2018-01-12 14:14:35 +0800
LV Status Available
#open 1
LV Size 1.99 GiB
Current LE 510
Segments 2
Allocation inherit
Read ahead Sectors Auto
- Currently set to 256
Block device 253:212. Viewing the current partition status of the system[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_rhel64-lv_root
13G 12G 104M 100%/
Tmpfs 1.5G 72K 1.5G 1%/DEV/SHM
/DEV/SDB1 485M 33M 427M 8%/boot
/DEV/SDA1 18G 172M 17G 1%/u01
/dev/sda2 7.9G 146M 7.4G 2%/software
/dev/mapper/vg_myvg-lv_mylv
2.0G 11M 1.9G 1%/LVM
No expansion
13. Pair/Capacity expansion[Email protected] ~]# Resize2fs/dev/vg_rhel64/lv_root
RESIZE2FS 1.41.12 (17-may-2010)
Filesystem at/dev/vg_rhel64/lv_root is mounted on/; On-line resizing required
Old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of/dev/vg_rhel64/lv_root to 5907456 (4k) blocks.
The filesystem on/dev/vg_rhel64/lv_root is now 5907456 blocks long.
14. View the status of the partition after expansion[Email protected] ~]# df-th
Filesystem Type Size used Avail use% mounted on
/dev/mapper/vg_rhel64-lv_root
Ext4 23G 12G 9.5G 56%/
Tmpfs tmpfs 1.5G 72K 1.5G 1%/DEV/SHM
/DEV/SDB1 ext4 485M 33M 427M 8%/boot
/DEV/SDA1 ext4 18G 172M 17G 1%/u01
/dev/sda2 ext4 7.9G 146M 7.4G 2%/software
/dev/mapper/vg_myvg-lv_mylv
Ext4 2.0G 11M 1.9G 1%/LVM
You can see that the/partition has been expanded to 23G from the original 13G
The expansion of LVM in Linux