Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extend LVM partition *backwards*

91 views
Skip to first unread message

bmearns

unread,
Dec 19, 2008, 5:01:58 PM12/19/08
to bme...@ieee.org
I have an unused partition located behind an LVM partition (behind
meaning that it starts at a lower cylinder than the LVM partition).
I'd like to extend the LVM partition backwards over the unused
parition to add the extra space to the LVM. Is there a way to safely
do this without fubaring my LVMs?

Thanks,
-Brian

David W. Hodgins

unread,
Dec 19, 2008, 6:54:57 PM12/19/08
to
On Fri, 19 Dec 2008 17:01:58 -0500, bmearns <mear...@gmail.com> wrote:

> I'd like to extend the LVM partition backwards over the unused
> parition to add the extra space to the LVM. Is there a way to safely
> do this without fubaring my LVMs?

Do not delete the existing partition, or you may run into problems with
the partition numbering. Use a partitioning tool, such as cfdisk, to change
the existing partition type to 8e.

Run "pvcreate /dev/sdxx", to initialize the partition, as a physical volume.
"vgextend whateveryourvolumegroupnameis /dev/sdxx" adds the partition to
the volume group.
lvextend is used to increase the space for a given logical volume.

You then have to resize the filesystem on the logical volume, using the
program appropriate to the filesystem type, such as resize2fs,
resize_reiserfs, etc.

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)

J.O. Aho

unread,
Dec 20, 2008, 5:19:01 AM12/20/08
to

You add the slice to the volume group (add hdc1)

vgextend my_volume_group /dev/hdc1

then you need to add it to a logical volume (add 1G)

lvextend -L+1G /dev/myvg/homevol

after this you need to extend the file system (example for ext2/3)

umount /dev/myvg/homevol/dev/myvg/homevol
resize2fs /dev/myvg/homevol
mount /dev/myvg/homevol /home

I suggest you take a look at the LVM HowTo for more information
http://tldp.org/HOWTO/LVM-HOWTO/
mainly the sections 11.5 and 11.9 for your part.

--

//Aho

bmearns

unread,
Dec 20, 2008, 12:11:09 PM12/20/08
to
On Dec 20, 5:19 am, "J.O. Aho" <u...@example.net> wrote:
> bmearns wrote:
> > I have an unused partition located behind an LVM partition (behind
> > meaning that it starts at a lower cylinder than the LVM partition).
> > I'd like to extend the LVM partition backwards over the unused
> > parition to add the extra space to the LVM. Is there a way to safely
> > do this without fubaring my LVMs?
>
> You add the slice to the volume group (add hdc1)
>
>  vgextend my_volume_group /dev/hdc1
>
> then you need to add it to a logical volume (add 1G)
Thanks for the help guys. I'm actually looking for a way to get rid of
the extra partition, though, and merge it with the LVM one. I know I
can just add it to the Volume Group, but I don't like the idea of
having unnecessary physical partitions lying around and jut stitching
every thing together with lvm. Maybe that's an unnecessary concern
though?

Thanks,
-Brian

>
>  lvextend -L+1G /dev/myvg/homevol
>
> after this you need to extend the file system (example for ext2/3)
>
>  umount /dev/myvg/homevol/dev/myvg/homevol
>  resize2fs /dev/myvg/homevol
>  mount /dev/myvg/homevol /home
>

> I suggest you take a look at the LVM HowTo for more informationhttp://tldp.org/HOWTO/LVM-HOWTO/

J.O. Aho

unread,
Dec 20, 2008, 1:46:40 PM12/20/08
to
bmearns wrote:

> Thanks for the help guys. I'm actually looking for a way to get rid of
> the extra partition, though, and merge it with the LVM one. I know I
> can just add it to the Volume Group, but I don't like the idea of
> having unnecessary physical partitions lying around and jut stitching
> every thing together with lvm. Maybe that's an unnecessary concern
> though?

It's a unnecessary concern and not doing it will avoid you from a lot of
trouble, not only the renaming of slices, but extending the LVM on the same slice.

--

//Aho

David W. Hodgins

unread,
Dec 20, 2008, 2:00:48 PM12/20/08
to
On Sat, 20 Dec 2008 12:11:09 -0500, bmearns <mear...@gmail.com> wrote:

> Thanks for the help guys. I'm actually looking for a way to get rid of
> the extra partition, though, and merge it with the LVM one. I know I

Removing that partition, and then resizing the existing lvm partition
will renumber the partitions, and will result in the physical order
of the partitions being different then the logical order. While linux
programs have no problem with the orders being different, some m$ stuff,
like fdisk, does.

If you do decide to remove the partition, make sure you have a full copy
of everything on another drive, first. I wouldn't. Avoiding renumbering
the partitions, is one of the things lvm is designed to help avoid.

bmearns

unread,
Dec 21, 2008, 2:05:01 PM12/21/08
to
Ok, great. Thanks all for the help. I guess I'll let LVM do it's job
and stop worrying so much about partitions!

-Brian

0 new messages