LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-16-2006, 10:21 AM   #1
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

Rep: Reputation: 30
growing an lvm partition- format question


Hi,
this is the scenario. There is a volume group (say VG) and an lvm partition of the VG (say LV). LV has been formatted using ext3, but the size is not enough and i decide to add extensions from VG. The problem is that the extensions from VG have not been formatted yet and if i add them to the LV -as far as i remember- no problem is caused, but just LV cannot "see" the extensions, ie its size doesn't grow.

Should i first format the whole VG and then create new LVs -without formatting them? Will it work? Is this the right tactic?
Here's the commands:
---------------
#vgcreate VG /dev/hda1 /dev/hda2
#mke2fs -j /dev/VG
#lvcreate --size 2G -n LV1 VG
and when the size is not enough, just do:
#lvresize +512M LV1

Another solution, not at all practical:
---------------
#vgcreate VG /dev/hda1 /dev/hda2
#lvcreate --size 2G -n LV1 VG
#mke2fs -j /dev/VG/LV1
and when the size is not enough:
#cp -aR /dev/VG/LV1 /backup copy data to backup
#lvresize +512M LV1 grow lvm
#mke2fs -j /dev/VG/LV1 format lvm
#cp -aR /backup /dev/VG/LV1 copy data back
 
Old 11-16-2006, 11:01 AM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Don't go formatting anything! Growing a LV is simple.

Like this:
Code:
umount /dev/mapper/VG-LV1
lvextend -L+512M /dev/mapper/VG-LV1
e2fsck -f /dev/mapper/VG-LV1
resize2fs /dev/mapper/VG-LV1
mount /dev/mapper/VG-LV1
Extending the LV alone will not do it. You need to also resize the filesystem sitting on top of the LV. I think that's what you were missing. You usually need to run e2fsck after an lvextend and before a resize2fs. No copying, reformatting, or anything like that is needed. I should take you only a few seconds to do this entire operation.

[edit]
Fixed my typos in device specification. e.g., was "/dev/mapper/VG/LV1", now "/dev/mapper/VG-LV1".
You could also use "/dev/VG/LV1" as well (that would be a symlink to "/dev/mapper/VG-LV1")
[/edit]

Last edited by haertig; 11-16-2006 at 12:29 PM.
 
Old 11-16-2006, 05:57 PM   #3
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

Original Poster
Rep: Reputation: 30
Thanks, i couldn't find the description of the procedure anywhere!
 
Old 11-16-2006, 07:25 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Search Google for "LVM Howto". You usually get very good results off of Google if you just put keywords like the name of the command (or concept), "manpage", "linux", "howto", etc.

The LVM HowTo is at http://tldp.org/HOWTO/LVM-HOWTO/

Section 11.9 of this HowTo covers the lvextend procedure
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reuse lvm partitions after format kpachopoulos Linux - Software 1 02-25-2006 10:26 AM
Shrinking an LVM partition Sabre_X Linux - Software 6 10-01-2005 12:13 AM
resize LVM partition bkesting Linux - General 3 06-17-2005 10:28 AM
Simple question: Growing an ext2 partition dogsbody Slackware 4 08-16-2004 11:41 PM
How to convert partition to LVM? TheOther1 Linux - General 0 01-04-2004 01:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration