LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 12-18-2010, 09:50 PM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Rep: Reputation: 32
Question Need to extend an lvm to a second hard drive on Centos 5.5


I've added a second drive to a system and I need to extend the lvm and the filesystem to the second disk. Is there a way to do this online with centos 5.5? I specifically need help extending the actual ext3 filesystem which seems to be the trick part.
 
Old 12-18-2010, 09:54 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
What in particular ?. Grow the vg, grow the lv, grow the filesystem.
 
Old 12-18-2010, 10:46 PM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by syg00 View Post
What in particular ?. Grow the vg, grow the lv, grow the filesystem.
Well I need the command / program to use to grow the filesystem... there are several out there and some people say it can be done on line with some and some say it can not...
 
Old 12-18-2010, 10:50 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Been years since ext3 couldn't be grown online. resize2fs is the "standard" tool. What version of e2fstools do you have - see the manpage for resize2fs.
 
Old 12-18-2010, 11:18 PM   #5
ubyt3m3
Member
 
Registered: Apr 2008
Distribution: Slackware64 13.37, Solaris 10, RHEL5/6
Posts: 92

Rep: Reputation: 19
One thing you can do is to first backup your stuff, format/partition on your 2nd drive, do 'vgextend' to grow the volume group you already have, do 'lvextend' to grow or 'lvcreate' to create a new logical volume, and then 'resize2fs' to extend your file system.

--gibb
 
Old 12-18-2010, 11:31 PM   #6
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by syg00 View Post
Been years since ext3 couldn't be grown online. resize2fs is the "standard" tool. What version of e2fstools do you have - see the manpage for resize2fs.
The version resize2fs is 1.35. e2fstools gives command not found... not sure if that is an issue.
 
Old 12-18-2010, 11:40 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You should be o.k with that - e2fstools is the package; there won't be a program/manpage of that name.
 
Old 12-18-2010, 11:56 PM   #8
chickenjoy
Member
 
Registered: Apr 2007
Distribution: centos,rhel, solaris
Posts: 239

Rep: Reputation: 30
I believe the basic requirements of an online lvm resize is kernel 2.6 or later AND an ext3 file system. Since your using the latest centos 5.5 then you must have kernel 2.6.18-x and hopefully an ext3 system.

This is how I would do it:

1. create a partition on the second hard drive.
2. declare it as a pv
3. extend the existing volume group of the logical volume you want to extend by adding the pv you just created.
4. #vgdisplay -v <you vg name> to check if the vg has really been increased and by the right amount too.
5. now to resize the logical volume: (note: change the values accordingly- don't forget!)
Code:
# lvdisplay		<--- check the current 'LV size'
# lvresize -L 386MB /dev/volgroup001/logvolvar1			<--- you set what you want the size to become not how much you want to add.
# lvdisplay again

# df -h /dev/mapper/volgroup001-logvolvar1		<--- your should still see the old size.

# resize2fs -f -p /dev/volgroup001/logvolvar1
	-f = force
	-p = print summary of progress
# df -h /dev/mapper/volgroup001-logvolvar1	<--- you should see the new size
You don't have to unmount the fs; but it is better to be on the safe side and do the above when there is minimum or no program accessing the fs.

Last edited by chickenjoy; 12-18-2010 at 11:57 PM.
 
Old 12-19-2010, 12:50 AM   #9
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Good stuff guys Thanks chickenjoy for the very clear instructions!
 
  


Reply



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
How to set up LVM and Raid 1 with CentOS on a 6 hard drive system? keithestrop Linux - Newbie 7 04-05-2010 10:48 AM
Adding a new hard drive to my LVM simplified Linux - Newbie 8 07-25-2009 11:03 AM
how can you extend your linux hard drive after installation? aszxcv Linux - Newbie 6 11-10-2008 05:15 PM
Combining Volumes on LVM Drive in CentOS 5.0 Linux31 Linux - Hardware 2 05-27-2007 08:14 AM
Extend ext3 Partition Using Unpartitioned Space On Same Hard Drive - Fedora Core 6 aaron4katie Linux - Hardware 9 01-11-2007 05:20 AM

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

All times are GMT -5. The time now is 04:56 AM.

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