LVM commands tutorial : Part 3 : Logical Volume (lvextend, lvreduce, lvchange)

Series of tutorial to learn LVM commands.lvm_tutorials

In this part, learn how to extend, reduce and change state of logical volume (lvextend, lvreduce, lvchange)


 

In continuation to last part of logical volume, we will be seeing more commands on lvol in this post. Previous posts of this LVM command tutorial can be found on below links :

Logical volumes like VG can be extended and shrinked. We will be seeing lvextend, lvreduce, lvchange commands in this post.

Command : lvextend

To extend logical volume, you should have enough free space within that VG. Command syntex is pretty much similar to lvcreate command for size. Only thing is you need to supply final required size in command. For example current LV size is 1GB and you want to extend it with 2GB. Then you need to give final 3GB size in command argument.

Another important option is of mirror copies. It plays vital role in root disk mirroring. -m is the option with number of mirror copies as a argument.


Command : lvreduce

This command used for decreasing number of mirror copies or decreasing size of LV. This is data destroying command. Hence make sure you have datat of related file system backed up first. The size and mirror copy options are works same for this command as well . -L for LE_reduce_size, -l number of LE to be reduces and -m is number of copies to be reduced.

While reducing mirror copies if one of the PV is failed or missing then command wont run successful. you need to supply -k option which will proceed to remove mirror in case PV is missing.


Command : lvchange

This command is used for changing characteristics of LV. There are numerous options which can be used.

  • -a y/n Activate or deactivate LV
  • -C y/n Change contiguous allocation policy
  • -D y/n Change distributed allocation policy
  • -p w/r Set permission
  • -t timeout Set timeput in seconds
  • -M y/n Change mirror write cache flag
  • -d p/s Change scheduling policy

This is end of second post on LV commands. In next post we will see lvsync and lvlnboot commands.

Any thoughts?