shrinking lvm

Paul Howarth paul at city-fan.org
Mon Mar 21 11:50:28 UTC 2005


gaurav wrote:
> Hi Paul,
>            I think logical partition  will suffice for oracle installation,

I think you're confusing "Logical Volume" with "Logical Partition". See 
http://www.tldp.org/HOWTO/LVM-HOWTO/ for an explanation of LVM.

> Here is info you asked for
> 
> # vgdisplay
>  --- Volume group ---
>  VG Name               VolGroup00
>  System ID
>  Format                lvm2
>  Metadata Areas        1
>  Metadata Sequence No  3
>  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               38.16 GB
>  PE Size               32.00 MB
>  Total PE              1221
>  Alloc PE / Size       1220 / 38.12 GB
>  Free  PE / Size       1 / 32.00 MB
>  VG UUID               xmHw2k-SVQS-lnIQ-u0z5-8E9E-vHAy-YEYXj4

Right, so there's virtually no free space in your existing LVM setup, 
which means you'll need to shrink an existing volume.

> # lvscan
>  ACTIVE            '/dev/VolGroup00/LogVol00' [37.12 GB] inherit
>  ACTIVE            '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
> 
> #  df
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/mapper/VolGroup00-LogVol00
>                      38317560  14124468  22246676  39% /
> /dev/hda1               101086      9125     86742  10% /boot
> none                    257336         0    257336   0% /dev/shm
> //172.28.62.169/m     31312896  17075712  14237184  55% /opt/music

A fairly simple setup then, with just a "/" volume that has 22GB free.

What I would suggest is the following:

1. Boot using the rescue CD and do not mount your system's partitions 
(or unmount them afterwards).

2. Shrink your existing root filesystem using resize2fs. I would suggest 
shrinking it to a size of around 16GB (i.e. just bigger than the amount 
of space you're actually using).

3. Shrink your root logical volume (/dev/mapper/VolGroup00-LogVol00) 
using lvreduce to the size you actually want it to be (i.e. 37.12GB less 
the space you're going to allocate for Oracle). The size should be 
greater than the size you shrunk the root filesystem to in step 2.

3. Grow your existing root filesystem back to the full size of the 
volume it lives on, using "resize2fs /dev/mapper/VolGroup00-LogVol00".

At this point you will have a reduced size root partition, with extra 
space left in VolGroup00 that can be used to create logical volumes for 
Oracle's use.

You can use lvcreate to create the two additional volumes you require. 
What filesystems, if any, do you want to use for the two new volumes?

Look at the man pages for each of the commands referenced above and 
write down the commands you intend to use. Be sure that you understand 
what you're doing, as a mistake can trash your system, requiring a 
re-install.

Paul.




More information about the fedora-list mailing list