Welcome to the Linux Foundation Forum!

resize2fs.

Hi.

I am going over LVM again.

I have 3 partitions creating a logical volume size 60GB. If I want to reduce this down to 25GB i know I reduce the filesystem and then reduce the logical volume. I am a little confused about the resize2fs and lvreduce command line options. Is this correct?

$ sudo resize2fs /dev/vg/mylvm 25GB # I take it this shrinks the filesystem to 25GB?
$ sudo lvreduce -L 25G /dev/vg/mylvm # Does this reduce the current size by 25GB (60-25=35GB) or set the final size to
# 25GB?

Thanks.

Comments

  • coop
    coop Posts: 915

    -L 25 G Sets the size to 25 G. I believe -L -25G would reduce it by 25G, -L +25G would increase it.

    Note you could have also used lvresize -r to both reduce the filesystem and change the partition size in one step instead of two

  • lee42x
    lee42x Posts: 380

    It sets the new size to 25G, use -L +10G to add more to your disk, or -10G to reduce the disk by 10G. See man 8 lvreduce for additional information.

  • WarrenUK
    WarrenUK Posts: 72

    Thanks.

    Yes I found the lvresize option after posting the question in the chapter. Saves using resize2fs - two commands in one!

Categories

Upcoming Training