Extending LVM

Extend partition by 1Gb.

# lvresize -L +1G /dev/vg00/lvol0
# e2fsck -f /dev/vg00/lvol0
# resize2fs -pf /dev/vg00/lvol0


Notes:

  • resize2fs has replaced ext2online in FC6.
  • need to unmount volume prior to doing resize2fs.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

resize2fs and lvreduce

Instead of calculating blocks, you could directly use 1G instead. Make sure to check disk with e2fsck prior.

e2fsck -vf -C0 /dev/vg00/lvol0
resize2fs -p /dev/vg00/lvol0 1G
lvreduce -L -1G /dev/vg00/lvol0

Shrinking LVM

To shrink a 2Gb partition to a 1Gb size.

Note: The block size is specified in 4k blocks.

1Gb = 1*1024*1024/4 = 262144 blocks.

# resize2fs -pf /dev/vg00/lvol0 262144
# e2fsck -f /dev/vg00/lvol0
# lvreduce -L -1G /dev/vg00/lvol0

Additionally, you can go back and do a resize2fs to the actual lvm size that gets created.

Comment