Resizing an LVM

Robert L. Cochran cochranb at
Mon Jun 4 21:50:17 UTC 2007

Hi Chris,

Yes, I discovered the hard way last night that my idea will not work. After following the steps I myself outlined earlier -- it looks like both logical volumes within the volume group /dev/VolGroup00 were trashed. That means LogVol00 (which I think housed / ) and LogVol01 (which I think was swap.) /boot appears to be intact since it is outside of the LVM, but as soon as I did my partition shrinking procedure, and rebooted, the kernel panicked. I can't get the kernel messages to stop long enough for me to read them but I suspect the panic is because the kernel couldn't mount LogVol00.

I do get the impression that shrinking an lvm is a destructive process. It blows the filesystem away. Or perhaps my mistake was one of not getting the new lvm sizes all perfectly matched -- fdisk and lvresize.

I do have a backup of most of my critical files, so I can reinstall from scratch today or whenever and not feel too much pain. I hope. 


Bob Cochran

> -----Original Message-----
> From: Chris Tyler [mailto:chris at]
> Sent: Monday, June 4, 2007 03:03 AM
> To: fedora-list at
> Cc: 'Robert L Cochran'
> Subject: Re: Resizing an LVM
> On Sun, 03 Jun 2007 17:37:12 -0400 Robert L Cochran wrote: 
> > Here is what I believe I need to do.
> > 
> > 1. Boot the Fedora 7 DVD in rescue mode.
> > 2. Do not mount the file system, instead just go to a shell prompt and
> > 3. lvm vgscan
> > 
> > Gets the name of the volume group
> > 
> > 4. lvm vgchange -a y /dev/VolGroup00
> > 
> > Activates the volume
> > 
> > 5. e2fsck -f /dev/VolGroup00/LogVol00
> > 
> > Checks file system for errors
> > 
> > 6. resize2fs /dev/VolGroup00/LogVol00 119G
> > 
> > shrinks the file system down to 119 Gb
> > 
> > 7. fdisk
> > 
> > shrinks size of partition
> Unfortunately, this will not work, because shrinking the LV will not
> reduce the size of the PV.
> If you need real partitions (not LVs) for the other operating systmes,
> you are at the present time out of luck for a direct conversion, because
> pvresize has not been implemented (see the manpage for lvm).
> What you could do, though, is temporarily attach another disk (IDE, USB,
> or FireWire), then:
> 1. Create a partition on the temp disk (fdisk).
> 2. Make that partition a PV (pvcreate).
> 3. Add that partition to your volume group (vgextend).
> 4. Migrate the data off the old PV to the new one (pvmove).
> 5. Remove the original PV from the VG (vgreduce)
> 6. Recreate the PV on the original disk, smaller than before. (fdisk
> followed by pvcreate).
> 7. Add the recreated PV to the VG (vgextend).
> 8. Migrate the data from the temp disk to the original disk (pvmove).
> 9. Remove PV on the temp disk from your VG (vgreduce).
> This is why it's a good idea, when setting up a new large disk for use
> with LVM, to divide the disk into multiple partitions and use all of
> them as PVs in the VG (instad of creating one big PV) -- it gives you
> more flexibility to later move some of that space out of the VG so it
> can be used for something else. (It also lets you do an in-situ
> migration to RAID; if, for example, you have 5 PVs, you can migrate to
> RAID PV-by-PV as long as you have 20% free space in your VG).
> --
> Chris Tyler
> Fedora Daily Package -

More information about the fedora-list mailing list