LVM extension into new space and partition edits

Eric Shubert ejs at shubes.net
Mon Aug 24 17:21:54 MST 2009


Alan Dayley wrote:
> I have lost the web page with the steps to do an extension of an LVM
> into unused disk space.  Let me explain my situation and ask my
> question.
> 
> I have a server with Red Hat Enterprise Linux 5.  It had two 250GB
> hard drives in a hardware RAID 1 mirror.  Working fine.  We needed
> more space, so here is what I did:
> 
> - Bought two identical model and recommended 1TB drives from Dell.
> (It's a Dell server.)
> - Using the RAID control interface, I took one 250GB drive offline.
> - Shutdown the server and removed the 250GB drive.
> - Installed one of the new 1TB drives in place of the 250GB drive just removed.
> - Powered up the RAID controller BIOS interface and commanded a
> rebuild of the mirror from the remaining 250GB drive to the 1TB drive.
> - Booted the system and everything was working.
> - Shutdown the system and removed the second 250GB drive, replacing it
> with the other 1TB drive.
> - Again used the RAID controller BIOS interface to rebuild the mirror
> from the first 1TB drive to the second one.
> - Booted the system and all is working well!
> 
> Except...
> 
> Now the partition table of the mirrored 1TB drives still only has
> partitions to use up to the old 250GBs.  I need to:
> 
> 1 - Update the partition table to expand the last partition into the
> unused 750GB of space.  (parted?)
> 2 - Expand the one or more logical volumes into the new space (lvextend)
> 3 - Expand the file system(s) into the new space (resize2fs)
> 
> I plan to expand /dev/sda5 into the empty space.  It is the last
> partition defined and so the least risky to expand, in my mind.  Here
> is the fdisk output:
> 
> # fdisk -l
> 
> Disk /dev/sda: 248.9 GB, 248999051264 bytes
> 255 heads, 63 sectors/track, 30272 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1               1           7       56196   de  Dell Utility
> /dev/sda2               8        1052     8393962+  8e  Linux LVM
> /dev/sda3   *        1053        1077      200812+  83  Linux
> /dev/sda4            1078       30272   234508837+   5  Extended
> /dev/sda5            1078       30272   234508806   8e  Linux LVM
> #
> 
> Question
> 
> I am extending into empty space on currently installed drives.  The
> instructions I can find online all seem to assume a new physical drive
> has been added and don't go into the partition issues on step 1 of my
> outline above.  All the utilities and commands that produce LVM
> information do not show the vast, unpartitioned space out there.  So,
> I assume step 1 is needed to open up the unallocated space into one of
> the partitions.
> 
> Am I on the right track, to use "parted" and expand the partition
> definition before expanding a logical volume?  Or am I missing
> something or making something more difficult?
> 
> Alan

Alan,
I think you're pretty much on track. You can of course expand sda5 
partition (I'd use qtparted if possible, probably with a live knoppix 
disc). You'd need to then expand the physical volume that's on the 
partition (remember, logical volumes belong to a physical volume).

I've never expanded a physical volume, so I don't know if that's even a 
possibility or not. I believe you'd either have to expand the physical 
volume in the expanded partition, or as an alternative simply create a 
new partition in the unused space, then create a new physical volume in 
the new partition. Any of your existing logical volumes could then be 
expanded by utilizing chunks of the new physical volume.

Make sense? I hope that someone corrects me if I'm wrong here.

-- 
-Eric 'shubes'



More information about the PLUG-discuss mailing list