[CentOS] Re: LVM Resizing Problem

Wojtek.Pilorz wpilorz at bdk.pl
Mon May 7 07:56:42 UTC 2007


On Sun, 6 May 2007, Scott Lamb wrote:

> Date: Sun, 6 May 2007 13:47:28 -0700
> From: Scott Lamb <slamb at slamb.org>
> Reply-To: CentOS mailing list <centos at centos.org>
> To: CentOS mailing list <centos at centos.org>
> Subject: Re: [CentOS] Re: LVM Resizing Problem
> 
> On May 6, 2007, at 8:14 AM, Ross S. W. Walker wrote:
> >> LVM even warned you --IN CAPS-- "THIS MAY DESTROY YOUR DATA".
> >> I guess it was right. I haven't had much luck with reducing a
> >> volume below its
> >> initial size. I usually make a new LV and rsync or cp -a the
> >> data over to it.
> >>  I try to leave some free space just for this. Or add a drive
> >> temporarily.
> >
> > Were the LV calculations done in the VG's extent size unit?
> >
> > Most people forget LVM rounds to the closest whole extent in it's
> > calculations which I believe is 4MB by default, so care must be
> > taken to make sure any file system fits comfortably in there
> > first.
> 
> Is there any tool which is aware of both the filesystem and LVM  
> layers and can correctly ensure the filesystem fits?
no tool as such I am aware of, but bc is your good friend.
Use lvdisplay rather than lvs, pvdisplay,. etc and count in LE (logical 
extents) rather than MB or GB.


> 
> The filesystem on my only large disk array is corrupt, presumably due  
> to some problem in one of the Fedora Core 6 update kernels. I  
> rebooted into single user mode, fscked (which found a huge number of  
> errors) and rebooted and it's still complaining. So it's time to  
> start over with a fresh filesystem on a more trustworthy dom0 system  
> (CentOS 5). I don't have anything vital stored only there, but there  
> are a number of large files I'd like to save if possible. They don't  
> fit anywhere else.
> 
> Here's my plan:
> 
> 1. boot a CentOS 5 DVD in rescue mode, fsck the filesystem again
> 2. shrink the existing filesystem and LV (crossing my fingers)
You canno shring ext3 until it fsck clean, as far as I remember.

> 3. install CentOS 5 to a new LV and filesystem
> 4. copy whatever's left of these files
> 5. delete the old LV
> 6. expand the new filesystem and LV
> 
> Never done steps #2 and #6 before, and I want to give it as much  
> chance of success as possible with an already-screwed-up filesystem.  
I would suggest you to add external HDD (e.g. USB2, or IDE/SATA with 
USB2/PATA+SATA converter) and copy your data.
If the filesystem is screwed up, resizing can only make its state worse.


> I see the section in the LVM HOWTO [1], but it doesn't mention the  
> sort of gotcha you're describing. I'm skeptical of LVM's  
> documentation in general. It doesn't even mention RAID (md), instead  
> including some incredibly stupid recipes virtually guaranteed to lose  
> all your data when one disk out of many fails [2].
Could you please elaborate or give some pointers about reasons for those 
recipes being stupid, etc. ?

> 
> [1] - http://www.tldp.org/HOWTO/LVM-HOWTO/reducelv.html
> [2] - http://www.tldp.org/HOWTO/LVM-HOWTO/recipeadddisk.html
> 
> Cheers,
> Scott
> 
> 




More information about the CentOS mailing list