Q: I have a LVM(logical volume) in my Linux, i need to extend the size without offline the logical volume.
A:
You will need to ensure you have spaces in volume group. Assuming the VG name is : VolGroup00.
[root@linux1 data]# vgdisplay
— Volume group —
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 10
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 8
Open LV 8
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.36 TB
PE Size 32.00 MB
Total PE 44703
Alloc PE / Size 28570 / 872.81 GB
Free PE / Size 16133 / 524.16 GB
VG UUID d2vwa2-6JHI-lTXJ-0WHg-iXhv-6COc-h01kf6
According to “Free PE/Size” you have 524.16GB left . Then you are good to proceed with the steps.
Lets check the current size of the LV you want to resize
[root@linux1 data]# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-lvdata
296G 191M 281G 1% /data
Lets start increasing the size!
[root@linux1 data]# lvextend -L+20G /dev/VolGroup00/lvdata
Extending logical volume lvdata to 320.00 GB
Logical volume lvdata successfully resized
Then resize it live!
[root@linux1 data]# resize2fs /dev/VolGroup00/lvdata
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/lvdata is mounted on /data; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/lvdata to 83886080 (4k) blocks.
The filesystem on /dev/VolGroup00/lvdata is now 83886080 blocks long.
The final output you are looking for 🙂
[root@linux1 data]# df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-lvdata
315G 195M 299G 1% /data
Easy right? The original guide in Redhat showed “ext2online” but i don’t see it in my /sbin ! Luckily my best friend google told me resize2fs is the new method 🙂 Redhat you should update your documentation!
Leave a Reply