Tag Archives: root

Shrinking LVM root volume

How to shrink the root volume on a Scientific Linux (RHEL6) installation:

  1. Make backups first. This could trash your Linux installation if something goes wrong.
  2. Get the appropriate rescue disk (boot.iso) from http://www.scientificlinux.org/download/. In my case, this was this file
  3. Burn it to CD.
  4. Boot your server from the rescue CD
  5. Choose the ‘rescue installed system’ option
  6. When prompted about mounting system partitions, choose to ‘Skip’.
  7. Once you get a shell, do something like the following:

    # Bring up the volume group
    lvm change -a y
    # fsck the root filesystem
    e2fsck -f /dev/<vgname>/<lvname>
    # shrink the root filesystem (ensuring you leave enough space for its data, obviously)
    resize2fs /dev/<vgname><lvname> <size>G
    # shrink the logical volume
    lvm lvreduce -L<size>G /dev/<vgname>/<lvname>

  8. Reboot and check it has worked okay.