• Home
  • Disclaimer
  • Contact
  • Archives
  • About
  • Subscribe
  • Support
  • Advertise

Kernel Talks

Unix, Linux, & Cloud!

  • How-to guides
    • Howto
    • Disk management
    • Configurations
    • Troubleshooting
  • OS
    • HPUX
    • Linux
  • Miscellaneous
    • Software & Tools
    • Cloud Services
    • System services
    • Virtualization
  • Certification Preparations
    • AWS Certified Solutions Architect – Associate
    • AWS Certified Solutions Architect – Professional
    • AWS Certified SysOps Administrator – Associate
    • AWS Certified Cloud Practitioner
    • Certified Kubernetes Administrator
    • Hashicorp Certified Terraform Associate
    • Oracle Cloud Infrastructure Foundations 2020 – Associate
  • Tips & Tricks
  • Linux commands
You are here: Home / Disk management

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

Published: November 19, 2016 | Modified: June 20, 2020



Series of the tutorial to learn LVM commands. In this part, learn how to extend, reduce and change the state of the logical volume (lvextend, lvreduce, lvchange)

In continuation of last part of a 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 :

  • Part 1 : Physical Volume (pvcreate, pvdisplay)
  • Part 1 : Physical Volume (pvchange, pvmove)
  • Part 2 : Volume group (vgcreate, vgdisplay, vgscan)
  • Part 2 : Volume group (vgextend, vgreduce, vgexport, vgimport)
  • Part 2 : Volume group (vgcfgbackup, vgcfgrestore, vgchange)
  • Part 2 : Volume group (vgremove, vgsync)
  • Part 3 : Logical Volume (lvcreate, lvdisplay, lvremove)
  • Part 3 : Logical Volume (lvsync, lvlnboot)

Logical volumes like VG can be extended and shrank. We will be seeing lvextend, lvreduce, lvchangecommands in this post.

Command: lvextend

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

# lvextend -L 3072 /dev/vg01/lvol1
Logical volume "/dev/vg01/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

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

# lvextend -m 1 /dev/vg00/lvol1 /dev/disk/disk2_p2
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Command: lvreduce

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

# lvreduce -L 500 /dev/vg01/lvol1
When a logical colume is reduced useful data might get lost;
do you really want the command to proceed (y/n) : y
Logical volume "/dev/vg01/lvol1" has been successfully reduced.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

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

Command: lvchange

This command is used for changing the characteristics of LV. There are numerous options that 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 timeout in seconds
  • -M y/n Change mirror write cache flag
  • -d p/s Change scheduling policy

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

⇠ Previous article
LVM commands tutorial: Part 3: Logical Volume (lvcreate, lvdisplay, lvremove)
Next article ⇢
LVM commands tutorial: Part 3: Logical Volume (lvsync, lvlnboot)

Related stuff:

  • Understanding /etc/hosts file
  • Host to guest disk mapping in HP iVM
  • Step by step procedure to take ignite tape backup in HPUX
  • cut command and its examples
  • LVM commands tutorial : Part 2 : Volume group (vgcreate, vgdisplay, vgscan)
  • HPUX Patch naming conventions
  • How to change process priority in Linux or Unix
  • Why HPUX loosing market grip
  • LVM commands tutorial : Part 2 : Volume group (vgcfgbackup, vgcfgrestore, vgchange)
  • HPUX boot process
  • How to do safe and graceful Measureware service restart in HPUX
  • How to mount ISO file in Linux?

Filed Under: Disk management, HPUX Tagged With: how to activate logical volume, how to deactivate logical volume, how to extend logical volume, how to reduce logical volume, lvchange command, lvextend command, lvm, lvreduce command, resize logical volume

If you like my tutorials and if they helped you in any way, then

  • Consider buying me a cup of coffee via paypal!
  • Subscribe to our newsletter here!
  • Like KernelTalks Facebook page.
  • Follow us on Twitter.
  • Add our RSS feed to your feed reader.

Share Your Comments & Feedback: Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get fresh content from KernelTalks

  • Email
  • Facebook
  • RSS
  • Twitter

Get Linux & Unix stuff right into your mailbox. Subscribe now!

* indicates required

This work is licensed under a CC-BY-NC license · Privacy Policy
© Copyright 2016-2023 KernelTalks · All Rights Reserved.
The content is copyrighted to Shrikant Lavhate & can not be reproduced either online or offline without prior permission.