[CentOS] LVM: Shrinking a physical partition

Thu Jan 19 04:55:25 UTC 2006
Michael Ubell <ubell at sleepycat.com>

The solution is here:
http://www.redhat.com/archives/linux-lvm/2004-December/msg00049.html

In brief:

vgcfgbackup, edit backup file, vgcfgrestore.

The tricky part was figuring out that Vol1 (the swap space)
had to be moved down as it was declared to start at a high
extent.  Not sure why they would do that.

Mike

On Jan 17, 2006, at 11:10 AM, Michael Ubell wrote:

> When I installed CentOS 4 it created a LVM partition
> occupying the bulk of my disk.  I would like to trim it
> back so I can put another partition for another (thrid)
> operating system.
>
> I found some directions that I thought would let me do
> this.  I used resize2fs to resize the filesystem and lvreduce
> to resize the logical volume.
>
> My problem is that I cannot reduce the size of the partition.
> When I do, I get errors when I try to boot:
>
>   Found volume gdevice-mapper: dm-linear: Device lookup failed
> roup "VolGroup00device-mapper: dm-linear: Device lookup failed
> " using metadataKernel panic - not syncing: Attempted to kill init!
>   type lvm2
>   device-mapper ioctl cmd 9 failed: Invalid argument
>   Couldn't load device 'VolGroup00-LogVol00'.
>   device-mapper ioctl cmd 9 failed: Invalid argument
>   Couldn't load device 'VolGroup00-LogVol01'.
>
> Here is the current configuration:
>
> lvm> vgs
>   VG         #PV #LV #SN Attr  VSize   VFree
>   VolGroup00   1   2   0 wz--n 154.03G 78.06G
> lvm> lvs
>   LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%
>   LogVol00 VolGroup00 -wi-ao  75.00G
>   LogVol01 VolGroup00 -wi-ao 992.00M
> lvm> vgdisplay
>   --- Volume group ---
>   VG Name               VolGroup00
>   System ID
>   Format                lvm2
>   Metadata Areas        1
>   Metadata Sequence No  4
>   VG Access             read/write
>   VG Status             resizable
>   MAX LV                0
>   Cur LV                2
>   Open LV               2
>   Max PV                0
>   Cur PV                1
>   Act PV                1
>   VG Size               154.03 GB
>   PE Size               32.00 MB
>   Total PE              4929
>   Alloc PE / Size       2431 / 75.97 GB
>   Free  PE / Size       2498 / 78.06 GB
>   VG UUID               P8ykKE-BJgP-tOkw-IgU3-btPA-54Ge-7JlcHn
>
> I would like to shrink the size of the Volume Group.
> Here is my partition table:
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *         554       10280    78132127+   7  HPFS/NTFS
> /dev/sda2               1         553     4441941   1b  Hidden W95  
> FAT32
> /dev/sda3           10281       10293      104422+  83  Linux
> /dev/sda4           10294       30401   161517510    5  Extended
> /dev/sda5           10294       30401   161517478+  8e  Linux LVM
>
> I thought I could just shrink sda5 to be about 77GB, but that
> results in the boot errors.
>
> lvm says that pvresize is not implemented.
>
> Any pointers?
>
> Mike
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos