Re: Freeing pv space for snapshots

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, 2007-01-05 at 19:04 -0500, Paul wrote:
> On Thu, January 4, 2007 11:40 pm, Alvin Chang wrote:
> > On 05/01/07, Aleksandar Milivojevic <alex@xxxxxx> wrote:
> >> I've used it, and it works correctly (and it is available in CentOS
> >> 4.4).  It shrinks file system as it should.  The only things Paul should
> >> be careful is to first shrink file system, than logical volume and to
> >> correctly calculate file system size and by how many extents he can
> >> shrink logical volume.  If he shrinks logical volume too much, he might
> >> end up loosing data.  Running fsck in non-destructive mode (fsck -N)
> >> and/or attempting to mount file system read-only after he shrinks
> >> logical volume might be a good idea to test all is OK.
> > A little technique you can use is:
> > 1. shrink the file system to the size slightly less than what you really
> > want
> > 2. reduce LV to the size that is what you really want
> > 3. expand the file system to the size of the LV (usually the resize
> > program can be told to expand the file system to maximum available
> > space automatically on the LV.)
> 
> You guys are great!  Thanks.  It was a breeze!  I really have fun learning
> more and more.  I feel like an LVM expert now.  Here's the steps I took:
> 
> First my lv was like 38G, and I wanted to make it about 32G in the end.  I
> know that should be way more than enough.  I also did a dd to an image
> file on a secondary drive for a precaution (always have a failsafe
> recovery!)
> 
> 1.  booted up on CentOS 4.4 Live CD.  -When I booted up on it, I told it
> to boot nonet to not bring up the interfaces, but it did anyhow.  I did a
> "ifconfig eht0 down" to do a shut on it.  Anyhow, out of all the LiveCD's
> I have tried, I do like the Centos the best!
> 
> 2.  e2fsck -fv /dev/VolGroup00/LogVol00
> 
> 3.  resize2fs -p /dev/VolGroup00/LogVol00 30G
> 
> 4.  lvresize -L 32G /dev/VolGroup00/LogVol00
> 
> 5.  resize2fs -p /dev/VolGroup00/LogVol00 (size defaults to lv size)
> 
> Now I have my free PV space!
> 
> # pvdisplay
>   --- Physical volume ---
>   PV Name               /dev/hda2
>   VG Name               VolGroup00
>   PV Size               38.22 GB / not usable 0
>   Allocatable           yes
>   PE Size (KByte)       32768
>   Total PE              1223
>   Free PE               143
>   Allocated PE          1080
>   PV UUID               cQCke5-zi9o-xhOW-HlR5-M46g-VbHC-99Csch
> 
> Now I am on to learning how to do a full backup with snapshots!
> 

Good job ... first thing to understand (at least as I understand it :P)
is that you will only be able to create a snapshot that is 6GB or
smaller.

So, as long as the used space on the LVs you take snapshots of are < 6GB
will be OK, otherwise you will have problems.

My understanding is that you need free space that is going to be at
least as large as the "used space" on the "LARGEST" LV that you are
going to create a snapshot for.  (At least that is how I currently setup
my VGs and LVs where snapshots are involved).

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux