LVM Resizing

Hi,

IMPORTANT: PLEASE ALWAYS BACKUP YOUR DATA FIRST BEFORE TOUCHING PARTITION TABLES ETC

first there are a few tools we need to accomplish this: resize2fs, lvscan, lvresize. Use "lvscan" to show your LVM group(s).

Here the steps to extend your LV:

  1. # lvscan
    Scans for available LV
  2. # fschk.ext3 /dev/VolGroup00/LogVol00
    Does a sanity check and corrections on the filesystem before further manipulation. Here the type is Ext3.
  3. # lvresize -L 15G /dev/VolGroup00/LogVol00
    Sets capacity of the concerned LV (here LogVol00) to 15 GB
  4. # resize2fs /dev/VolGroup00/LogVol00 15G
    Resizes the partition inside the LV to a capacity of 15 GB

Here are the steps to shrink your LV:

  1. # lvscan
    Scans for available LV
  2. # fschk.ext3 /dev/VolGroup00/LogVol00
    Does a sanity check and corrections on the filesystem before further manipulation. Here the type is Ext3.
  3. # resize2fs /dev/VolGroup00/LogVol00 15G
    Sets capacity of the concerned LV (here LogVol00) to 15 GB
  4. # lvresize -L 15G /dev/VolGroup00/LogVol00
    Sets capacity of the concerned LV (here LogVol00) to 15 GB

All these steps can be done with the disk online, except for the root partition. If you want to modify this, you have to boot into a live cd. Also note that step 3 and 4 are inverted. If you want to increase your capacity you first need to grow your LV then the partition, if you want to shrink your capacity first shrink your partition then the LV. PLEASE TAKE CARE that your LV is NOT smaller than your partition! In this case DATA LOSS is almost sure.