Saturday, August 14, 2010

Resize Logical Volume (LV) in Linux

Here is the quick steps to Resize Logical Volume in Linux..

If you want grow (resize) 'logvolopt1' to 20GB

 1. lvresize -L 20GB /dev/volgroup001/logvolopt1
 2. lvdisplay - to confirm new size of logical volume
 3. df -h - will still reveal the current size
 4. Resize the file system to update the INODE table on the logical volume to account for the new storage in 'logvolopt1'
  'resize2fs -f -p /dev/volgroup001/logvolopt1'

Note: You may resize file systems online if the following are met:

  a. 2.6x kernel series
  b. MUST be formatted with ext3

If you want to shrink (resize) 'logvolopt1' to 15GB

 1. lvresize -L 15GB /dev/volgroup001/logvolopt1
 2. lvdisplay 
 3. df -h 
 4. resize2fs -f -p /dev/volgroup001/logvolopt1

 Note: online shrinking is not supported

 5. df -h

Note: Check disk utilization prior to shrinking to reduce the risk of losing data.. 

Hope these Quick HOWTO will help administrators for quick reference.
cheers :-)