• Comments
  • Shrinking a volume - check my commands

    Posted on

    I have been asked by my superiors to make 1tb of space on one of our Redhat EL 6.9 servers available for a new application. We had previously put all of the available space into one Volume Group, so that one needs to be shrunk to make the space available to create the new one. My goal is to reduce the size with the least risk possible. I have tried booting this server to a gparted live iso through ilo before, but was unsuccessful, so we had to accomplish resizing of partitions through the ssh console.

    Unfortunately it is impractical for us to back up the data on the existing volume so I know there is some risk of data loss. I'm hoping however that the more experienced Linux sysadmins here can check my commands for errors and to help me minimize the risk of data loss.

    according to the output of the pvs command, /dev/foo_vg is mounted on /dev/sdb1, is currently sized at 4.37t and has 3.37t free.
    according to the output of lvs, I have four logical volumes totaling 1020g within /dev/foo_vg

    Here are the commands I propose to run:

    unmount file system

    umount -v /dev/foo_vg

    check for errors

    e2fsck -f /dev/foo_vg

    Resize file system (greater than size of data but less than all available free space)

    resize2fs /dev/foo_vg 2200GB

    Reduce size of volume (less than reduction of file system size done by resize2fs)

    lvreduce -l -1024G /dev/foo_vg

    check for errors again

    e2fsck -f /dev/foo_vg

    Resize to use all available free space in volume

    resize2fs /dev/foo_vg

    Mount file system

    mount /dev/foo_vg /dev/sdb1

    Thanks for any helpful comments or suggestions anyone can give me.

    by

    points

    Responses

    Red Hat
    © 2025 Red Hat, Inc.