LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 04-30-2005, 05:47 AM   #1
ntwrkguru
LQ Newbie
 
Registered: Apr 2005
Location: Philadelphia, PA
Distribution: Ubuntu 8.04 (Mint), Puppy 4.0
Posts: 6

Rep: Reputation: 0
Adding a new partition to an existing LV


I've had FC3 on my box for some time now with a 40GB drive. Everything is working great except 40GB isn't large enough. I added a new 120GB drive (/dev/hdb) and now I would like to add it to the existing logical volume mounted as / and I can't get it working.

I did the fdisk...no problems. I see

Then, I ran mkfs and created a single partition; hdb1. I am able to mount this partition with no problems, but I would really like this to be added to the exisiting ~38GB / partition.

The 38GB / partition is mounted as /Vol00/Log00. I am not in front of the box at the moment, but I can gladly post a reply with /etc/fstab if needed.

Any help is greatly appreciated.

Last edited by ntwrkguru; 04-30-2005 at 09:22 AM.
 
Old 04-30-2005, 09:34 AM   #2
ntwrkguru
LQ Newbie
 
Registered: Apr 2005
Location: Philadelphia, PA
Distribution: Ubuntu 8.04 (Mint), Puppy 4.0
Posts: 6

Original Poster
Rep: Reputation: 0
Update

Well, I thought I had it figured out, but instead managed to screw it up. Now booting puts it into a kernel panic.... I could try and rescue it from a boot disk, but I have everything backed up, so I think I'll just reinstall FC3 and let the installer take care of the new disk (hopefully).

But, I know I was on the right track and I think I know where I made the mistake.

First, I backed out all of what I did....fdisk /dev/hdb

-deleted partition 1
-added a new primary partition 1
-changed the type to 8e (forgot this the 1st time through, and left it at 83)
-wrote changes

Then, ran vgextend VolGroup00 /dev/hdb1
Then, ran lgextend -L 122.91G VolGroup00/LogVol00 /dev/hdb1

So far so good, but / is still not showing the new space....Oops....forgot to format the partition....

mkfs.ext3 -j /dev/hdb1

Ok, should be good now, right? Hmm... / is *still* not showing the partition. Maybe I need to reboot to remount the volume.

Uh oh...kernel panic.

Looking back, I think I needed to redo the vgextend and lgextend following the mkfs. Maybe someone can confirm or deny that one.

In the meantime, I'll be reinstalling the OS...
 
Old 11-02-2005, 09:23 AM   #3
Dragineez
Member
 
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 278

Rep: Reputation: 41
Me Too

Gee I'm glad I'm not the only one that's made this mistake!
 
Old 11-02-2005, 02:18 PM   #4
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
This one’s a little old to be responding to, but the mistakes are somewhat common, so here’s some insight about adding a physical volume to a volume group for future readers.

**********

The two primary mistakes ntwrkguru made were (1) the failure to convert the new partition into a LVM physical volume and (2) the failure to unmount the ext3-containing LVM before modifying it.

1) After creating the new partition of type 8e (Linux LVM), convert it to an LVM physical volume using the command:

pvcreate /dev/hdb1 # Use the actual partition, not hdb1

The partitioning and creation of the physical volume can be done while running FC.

2) The easiest way to work with the unmounted LVM is to boot into linux rescue mode using the first installation CD (boot: linux rescue), but don’t search for or mount the FC installation. That’s the point: Keep the filesystem(s) unmounted.

From the rescue command prompt, you may need to activate the LVM with the following commands:

lvm vgscan
lvm lvscan
lvm vgchange -a y

Note that when using the lvm commands from FC rescue mode, you need to precede them with “lvm ” for them to work. Now extend the volume group:

lvm vgextend VolGroup00 /dev/hdb1 # Use the actual partition designation

Now see how may free physical extents (PE) and how much free space are available in the volume group:

lvm vgdisplay VolGroup00 # Use the actual VG name

As an example, assume that the Free PE from vgdisplay was 1280 (40GB using 32MB physical extents). Now add that many new physical extents to the logical volume.

lvm lvextend -l +1280 /dev/VolGroup00/LogVol00 # Use the actual # PE and VG/LV names

where the “-l +#” means you want to increase the size by “#” PE’s. Now enlarge the ext3 filesystem to fill the logical volume:

resize2fs /dev/VolGroup00/LogVol00 # Use the actual VG/LV names

You will get a message telling you to run e2fsck, so do what the message says and then run resize2fs...

That’s it! You’re done!


For more details about these commands, see:

man pvcreate
man vgextend
man lvextend
man resize2fs

**********

Be aware that if you want to reduce the size of the logical volume someday, you will need to first reduce the size of the ext3 filesystem and then reduce the size of the logical volume. There is no safety check that will stop you from making the logical volume smaller than the filesystem. And doing that will have very undesirable consequences.

**********

A good LVM reference is the LVM HowTo, paying particular attention to Chapter 11 “Common Tasks”: http://www.ibiblio.org/pub/Linux/doc...LVM-HOWTO.html

Last edited by WhatsHisName; 11-02-2005 at 02:22 PM.
 
Old 11-02-2005, 02:33 PM   #5
Dragineez
Member
 
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 278

Rep: Reputation: 41
Important Knowledge Never Goes Out of Date

The original thread may have been old, but it was very timely for me since I have not yet resorted to re-installing. Your very thorough reply will be most helpful. Thanx!
 
Old 11-02-2005, 04:08 PM   #6
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
Dragineez: It’s good to hear that the information was useful.

The problem with LVMs when you first run into them is that they aren’t intuitively obvious. Kind of like the first time you had to do partitioning in linux. Everything up until then had been drive C: and drive D: on your hard drive.

Suddenly, you had to understand not only what a partition was, but the differences between primary, extended and logical partitions. And eventually, you began to realize that a partition and a filesystem weren’t the same thing. Well, maybe that last point isn’t so clear to everyone, but it will be once you understand LVMs.

Last edited by WhatsHisName; 11-02-2005 at 04:10 PM.
 
Old 11-02-2005, 11:50 PM   #7
Dragineez
Member
 
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 278

Rep: Reputation: 41
BRILLIANT!!

That worked quite well. I owe you a cold one. At least now the kernel panic has gone away and the machine boots more or less normally.

I don't want to sound like too much of an idiot, but it can't be helped. I can't run the resize2fs command because the volume is mounted and I can't get it to umount. It just sits there, no feedback, not responding, doing nothing as far as I can tell. Not from the rescue CD or booting normally. If you could guide me past this last obstacle I shall be forever grateful. Besides, this exposure of my ignorance will at least give those in a similar state exposure to your wisdom without having to appear ignorant themselves.
 
Old 11-03-2005, 12:55 AM   #8
Dragineez
Member
 
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 278

Rep: Reputation: 41
DOH!

Quote:
Originally posted by WhatsHisName
The easiest way to work with the unmounted LVM is to boot into linux rescue mode using the first installation CD (boot: linux rescue), but don’t search for or mount the FC installation. That’s the point: Keep the filesystem(s) unmounted.
Sorry, must have been having a blonde moment.
 
Old 11-03-2005, 01:18 AM   #9
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
Blond moments aside, even if you search for and mount the FC installation in rescue mode, you can always unmount it, as long as you don't run “chroot /mnt/sysimage”.

The FC filesystem, or some part of it, will be mounted at /mnt/sysimage. If you have a single logical volume or partition, you can unmount /mnt/sysimage and then run resize2fs:

umount /mnt/sysimage

If multiple logical volumes and/or partitions are involved, you can go through and attempt to unmount the usual suspects:

unmount /mnt/sysimage/boot
unmount /mnt/sysimage/var
unmount /mnt/sysimage/usr
unmount /mnt/sysimage/home
unmount /mnt/sysimage/tmp
unmount /mnt/sysimage

and anything else you know to be present. Then, resize2fs should work. /mnt/sysimage is just a mountpoint created by FC rescue.

BTW, there's a nice section in the RHEL4 System Administration Guide that talks about rescue mode: http://www.redhat.com/docs/manuals/e...mode-boot.html

**********

What I normally do to make maintenance easier is to set aside about 3GB of disk space, usually in a logical partition, and install an extra FC “desktop” there without the office productivity and graphical image utilities to keep it small (openoffice is huge!), but I also add in a few extra administrative tools to make the spare installation more useful.

Then I can boot into the alternate FC installation and do whatever needs to be done (e.g., resizing, backups, filesystem checks, etc.). It gives you an environment with lots of tools to work with and gives you the ability to go online to research things you don't understand, unlike the FC rescue mode.
 
Old 11-03-2005, 09:22 AM   #10
Dragineez
Member
 
Registered: Oct 2005
Location: Annapolis
Distribution: Ubuntu
Posts: 278

Rep: Reputation: 41
Just So You Know...

Your advice worked beautifully. The system has not only been restored to its former glory, but has the additional drive added as well. Many thanks!
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding new group to existing user ALF Linux - Software 7 05-08-2006 10:35 PM
adding second router to existing network crnchyfrog Linux - Networking 2 06-06-2005 09:19 PM
adding an existing XP partition to GRUB phoeniks Linux - General 3 08-27-2004 01:54 PM
adding existing partition to lilo Kane2002 Linux - General 8 01-30-2004 04:03 PM
Adding new os to existing one synapse Linux - Newbie 1 01-27-2004 11:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 08:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration