Reduce LVM Partition Size

Environment
  • Ubuntu 9.04 x64
Introduction
Wanna the resize the logical volumes

Procedures

Allow to control the availability of the logical volumes
#vgchange -a y
3 logical volume(s) in volume group "VolGroup00" now active
Check the logical volume before resizing
#e2fsck -f /dev/VolGroup00/LogVolume02
e2fsck 1.41.4 (27-Jan-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/LogVolume02: 75/9682944 files (13.3% non-contiguous), 6692532/38707200 blocks
Umount it and resize it to be the wanted size
#umount /media/LogVolume02
#resize2fs  -f /dev/VolGroup/LogVolume02 70G
resize2fs 1.41.4 (27-Jan-2009)
Resizing the filesystem on /dev/VolGroup00/LogVolume02 to 18350080 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVolume02 is now 18350080 blocks long.

#lvreduce -L 70G /dev/VolGroup00/LogVolume02
   WARNING: Reducing active logical volume to 70.00GB
   THIS MAY DESTROY YOUR DATA (filesystem etc/)
Do you really want to reduce LogVolume02? [y/n]: y
   Reducing logical volume LogVolume02 to 70.00GB
   Logical volume LogVolume02 successfully resized
Mount it back when successful

Reference
  • http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/LVM-HOWTO.html#commontask