1753287 Members
5428 Online
108792 Solutions
New Discussion юеВ

lvextend

 
admin1979
Super Advisor

lvextend


Hello,

On a test environment, I have created a volume group vg1 and inside that added 1 pv. Created a logical volume lv1 and the size of the lv
became 18GB. Formatted the logical volume and mounted the logical volume. Created few files in it. Now added another PV to VG1 inorder
to increase the size. Then used,

lvextend -L +30G lv1 , the command completed successfully.

But now the mounted lv1 is still showing the original size 18GB. I remounted the same but no help.
Anything to execute to take new change effect?

Thanx,
admin
5 REPLIES 5
Matti_Kurkela
Honored Contributor

Re: lvextend

You probably extended the LV but not the filesystem inside it.

After extending the LV, you must extend the filesystem. This requires a filesystem-specific tool: for ext2/ext3 filesystems, the tool is resize2fs. (RHEL4 had a different tool called ext2online for extending mounted ext3 filesystems; with newer distributions, this is integrated into resize2fs)

For ReiserFS, the tool is resize_reiserfs. I think XFS also had its own method, but I cannot remember it just now.

Read the man page of the respective tool for your filesystem for more details.

Note: if you have to shrink a LV, the order of operations will be different: first shrink the filesystem (which generally cannot be done while the filesystem is mounted), then reduce the LV. The bottom line is: the filesystem must never be larger than the LV that encloses it, or else you may lose data.

MK
MK
Michal Kapalka (mikap)
Honored Contributor

Re: lvextend

hi,

lvextend extend only logical volume, not the file system.

the command is depend which FS type is used.

an example :

http://www.netadmintools.com/art366.html


mikap
admin1979
Super Advisor

Re: lvextend

Ok I ran resize2fs after unounting the filesystem. And it asked me to run

e2fsadm -f /dev/vg1/lv1

Is it necessary? Why? Will it harm the inside data?
Matti_Kurkela
Honored Contributor

Re: lvextend

Please read the man page of e2fsadm on your system to find out what the -f option does: on my RHEL3 systems, the e2fsadm does not have the -f option nor any documentation about it.

Debian 5.0, RHEL4 and RHEL5 distributions don't seem to even have the e2fsadm command at all.

It might be helpful if you could tell the name and version of your Linux distribution, so that someone who uses the same version could give you more detailed advice.

MK
MK
admin1979
Super Advisor

Re: lvextend

Yes Sure....Its SLES 10 environment.

It says,

-f Force checking even if the file system seems clean.

I knew its usage but my question is why is it mendatory to run it before resize2fs?.....
maybe i m asking too much