dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
845
tld
join:2002-12-19

tld

Member

Resizing extended partitions with parted for new LVM PVs

I'm reading some very conflicting things on something I've done (with no issues) several times in the past. That is, on a disk that's been increased in size in a VM environment, increasing the size of an extended partition to the end of the disk in order to allow the creation of new logical partitions, where those new logical partitions will be used as LVM PVs. After doing that, those LVM PVs are added to an LVM volume group, allowing resize of an LVM logical volume, thus allowing resize of the file system with resize2fs.

In a case where extended/logical partitions aren't involved (that is all physical partitions) this is just a matter of creating new partitions with fdisk and adding those to LVM. When an extended partition is involved, fdisk will not be able to use the new space for any new logical partitions unless the extended partition is increased. I've done this several times in the past using parted similar to what's described here:

»sites.google.com/site/rh ··· lvminuse

Generally though I use parted in interactive mode with units set to 's' (sector), accepting the default for the starting sector, and entering -1 for the end (the sector at the end of the disk).

After doing that, fdisk will allow you to add a new logical partition.

One thing that bothers me is that parted gives this dire warning when you do this:
WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs. We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
There are several confusing things about this warning. Only the logical partitions (as apposed to the extended partition) actually have any file system, and even then, only by virtue of being part of the LVM volume group and subsequent logical volume on which the actual file system is created. In this case, I am in fact only changing the end point of the extended partition.

Is there something wrong with what I'm doing there, and is there a better way to do it? Like I said, I've read all sorts of conflicting things ranging from things like the link above that imply this is exactly how to do this, all the way to things that say parted can't do it at all. Confusing as hell. I sure don't know any other way, and I've yet to have an issue doing so.

Thanks in advance.
Tom
tld

tld

Member

The details of parted in this regard are pretty strange. Looking at this bug, it appears that until very recent versions of parted, it had no capability to just resize the partition without trying to resize the file system:

»bugzilla.redhat.com/show ··· d=807101

Again, given that in this case the file system was actually created on the LVM logical volume, I have no idea what the affect of that is, if anything. Beyond confusing.

The only other option for just resizing the partition is the old school method of using fdisk in sector mode and do delete and re-add the partition making sure to use the original starting sector. However I'm not even sure you can do that with an extended partition that already contains logical partitions.

Given how common use of VM etc makes this scenario these days it seems crazy that it's this cryptic.

Tom

PToN
Premium Member
join:2001-10-04
Houston, TX

PToN to tld

Premium Member

to tld
Well, your first link clearly says "No LVM"...

It's pretty straight forward.

You have a Volume Group, you attach a disk, you do a PV create on the new disk, you extend the Volue Group with the new disk, and then you extend the Logical Volume with the new available space in the VG.

The fact it is a VM doesnt make it any different than a Phjysical server.

You probably need to brush up or refresh on your LVM skills

Have a good one.
tld
join:2002-12-19

tld

Member

said by PToN:

You probably need to brush up or refresh on your LVM skills

Have a good one.

Wow...did you actually read my post? It sure doesn't seem that way. I understand the LVM part perfectly and have done that literally hundreds of times.

My questions are all regarding steps before that part, specifically resizing an extended partition with existing logical partitions, in order to create a new logical partition...and specifically why parted prints that warning and appears to be trying to resize a file system.

The fact that after all that, yes, I'm adding the logical partition to LVM as a PV etc, has nothing to do with it. With or without LVM involved, the resizing I'm referring to is necessary when you grow a disk in VM that already has extended and logical partitions.

Tom