[linux-lvm] LVM question on move and resize

Dieter Stüken stueken at conterra.de
Fri Jul 14 11:00:08 UTC 2006


John Koshi wrote:
> I assume the next steps will be (from a rescue CD):
> 
> 1) Use fdisk to format the unused 25 Gb space in the
>    extended partition, to a new type 8E partition.
> 2) Use pvcreate to create a new physical vol there.
> 3) Use vgextend to extend VolGroup00 to include the
>    new physical volume.
> 4) Use lvextend to extend LogVol00 by the XX Gb.
> 5) Do a file system check of LogVol00.
> 
> Does this look right? Am I missing any steps?

after you grow LogVol00 you also have to expand the
ext2/ext2 filesystem inside (step 4a)

resize2fs -p /dev/mapper/VolGroup00-LogVol00

This actually does the real work. resize2fs recommends
to perform an fsck before. If you are in doubt, do it,
else you may skip this using "resize2fs -f -p".

You don't have to supply a size, resize2fs will find
the current size of the extended volume auomatically

Will you perform this while booting from a rescue CD?
If this is your root filesystem you have to, anyway.
Else you possibly have to reboot, after changing the
partition table, because it may be locked by the system
while it is in use.

Tip: you may rename your VG and your LVs to get expressive
names like "/dev/mapper/Sonota-Root". Imo this is less 
error prone than working with technical names like "LogVol42".

> Disk /dev/hda: 80.0 GB, 80026361856 bytes
> 255 heads, 63 sectors/track, 9729 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>    Device Boot      Start         End      Blocks   Id  System
> /dev/hda1   *           1        5201    41777001    7  HPFS/NTFS
> /dev/hda2            9704        9729      208845   88  Linux plaintext
> /dev/hda3            5202        5214      104422+  83  Linux
> /dev/hda4            5215        9703    36057892+   f  W95 Ext'd (LBA)
> /dev/hda5            8425        9703    10273536   8e  Linux LVM
> Partition table entries are not in disk order

So you end up with an extended partition containing your LVM.
Even if this works, it is an ugly solution. This Win95 extended
partition hack is something like a poor-mans LVM with partition
magic as its management tool.
 
It would be much better, to REPLACE the extended partition by LVM. Unfortunately I don't see any easy migration path without an external
disk. If you have any spare disk, to temporary hold the 8.2Gb root
volume, I may point out an other solution.

Dieter.




More information about the linux-lvm mailing list