cancel
Showing results for 
Search instead for 
Did you mean: 

grow LVM disk

 
SOLVED
Go to solution
Piotr Kirklewski
Super Advisor

grow LVM disk

Hi there
Gprated or PartitionMagic don't support resizing the LVM drive. Is there any software available on the market that does the trick ?
Regards
Peter
Jesus is the King
8 REPLIES
Kapil Jha
Honored Contributor
Solution

Re: grow LVM disk

why do u need another software when its already there in linux.
have u tried
man lvextend

BR,
Kapil+
I am in this small bowl, I wane see the real world......
Steven E. Protter
Exalted Contributor

Re: grow LVM disk

Shalom,

fdisk -l
# To see layout
pvdisplay -v

lvextend -l disk device

Next step depends on what version of the OS you are talking about.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Piotr Kirklewski
Super Advisor

Re: grow LVM disk

Now I remember doing that on HPUX several years ago.
I'm running CentOS:

Linux version 2.6.18-164.15.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Wed Mar 17 11:30:06 EDT 2010

So what would be the next step ?
Jesus is the King
bullz
Super Advisor

Re: grow LVM disk

ext2online (or) ext3onlie will be the next step after lvextend.
Matti_Kurkela
Honored Contributor

Re: grow LVM disk

In RHEL/CentOS 5, there is no special ext2online/ext3online command, only resize2fs (which works on ext3 too).

The resize2fs command will automatically detect if the filesystem is mounted, and do the right thing in each case.

i.e. after running lvextend, the next step is simply:

resize2fs -p

The "-p" option prints a completion bar, so you'll see that the operation is running. If the filesystem is already very large, the extension may take a while, so it's nice to have some feedback to reassure you it's not hung up.

If you run "df" repeatedly while resize2fs is making an on-line extension, you can see the filesystem getting bigger and bigger in steps.

MK
MK
bullz
Super Advisor

Re: grow LVM disk

I rember i used ext2online (or 3) in RHEL. That i installed some rpm i guess. Even i increased root FS using ext3online after lvextend. Please correct me if i am wrong.
Matti_Kurkela
Honored Contributor

Re: grow LVM disk

bullz, that was in RHEL 4.

In RHEL 5, the functionality of ext2online was integrated to resize2fs.

Piotr's kernel version indicates he has a RHEL/CentOS 5.

Version 4 would have a 2.6.9-* kernel.

MK
MK
Piotr Kirklewski
Super Advisor

Re: grow LVM disk

So I created a step by step howto in order to share with the community. This is a Centos 5 64 bit VM on VmWare ESXi 4.0.

=============================================

Stop the VM

On the ESXi host run: vmkfstools -X 10g ./test.vmdk

Start the VM log in and run:

fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1044 8185117+ 8e Linux LVM


[root@localhost ~]# pvdisplay -v
Scanning for physical volume names
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 7.81 GB / not usable 25.28 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 249
Free PE 0
Allocated PE 249
PV UUID Hnw1fc-tqXm-sfzP-0vF1-CmhA-bEXb-mP4mv8


[root@localhost ~]# lvdisplay -v
Finding all logical volumes
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID al4VyF-DKXD-cbC8-PEmg-fDMy-0Prx-3bokbB
LV Write Access read/write
LV Status available
# open 1
LV Size 5.78 GB
Current LE 185
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID FqvvFP-9v0m-bd3f-wcfm-oOUF-dkcP-HCHIh3
LV Write Access read/write
LV Status available
# open 1
LV Size 2.00 GB
Current LE 64
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1


fdisk /dev/sda (and create a new primary partition, partition number 3)

[root@localhost ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1044 8185117+ 8e Linux LVM
/dev/sda3 1045 1305 2096482+ 83 Linux

lvextend â L10G /dev/sda2

pvcreate /dev/sda3

pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created

pvs

vgextend VolGroup00 /dev/sda3

[root@localhost ~]# vgdisplay VolGroup00
--- Volume group ---
VG Name VolGroup00
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 9.75 GB
PE Size 32.00 MB
Total PE 312
Alloc PE / Size 249 / 7.78 GB
Free PE / Size 63 / 1.97 GB
VG UUID zHLZCU-jryC-xnVR-y5Hb-cfKa-WKmH-JRYoDe


lvextend -l+63 /dev/VolGroup00/LogVol00

[root@localhost ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 7.75G
LogVol01 VolGroup00 -wi-ao 2.00G

df -h /

[root@localhost ~]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 829M 4.6G 16% /


So as you see now I have 6.4 GB of free space instead of 4.6GB.

Thanks for the effort. Ticket closed.
Jesus is the King