• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lvextend: command not found

by Deepika

Logical Volume Manager 2 (LVM2) allows you to aggregate physical storage devices into volume groups. You can then divide that aggregated space into one or more logical volumes. Once created, logical volumes can be extended to utilize unused space within the volume group, allowing the file system residing on the logical volume to be extended as well.

The lvextend command is used to extend the logical volume. Before we use lvextend there are few steps that need to be followed. The following are sample steps to extend a Volume Group (VG), a Logical Volume (LV), and a filesystem using a device named /dev/sdN as its Physical Volume (PV).

1. Create a PV from a free disk or partition (e.g. /dev/sdN1 as a partition):

# pvcreate /dev/sdN1

You can also use a complete disk to create a physical volume with pvcreate.

2. Extend the VG (/dev/sdN1 is an existing PV path):

# vgextend vgdata /dev/sdN1

Extend the LV and resize the underlying filesystem together (/dev/vgdata/lvdata is the existing LV path), which will be extended by 125 GB:

# lvextend -r -L +125G /dev/vgdata/lvdata

If you encounter the below error while running the command lvextend:

lvextend: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install lvm2
Ubuntu apt-get install lvm2
Alpine apk add lvm2
Arch Linux pacman -S lvm2
Kali Linux apt-get install lvm2
CentOS yum install lvm2
Fedora dnf install lvm2
Raspbian apt-get install lvm2

lvextend Command Examples

1. Increase a volume’s size to 120 GB:

# lvextend --size 120G logical_volume

2. Increase a volume’s size by 40 GB as well as the underlying filesystem:

# lvextend --size +40G -r logical_volume

3. Increase a volume’s size to 100% of the free physical volume space:

# lvextend --size 100%FREE logical_volume

Filed Under: Linux

Some more articles you might also be interested in …

  1. The Squid Service in Failed State with Error: “Failed to make swap directory /var/spool/squid/00: (13) Permission denied”
  2. CentOS / RHEL 6 : How to password-protect single user mode
  3. “az appconfig”: Manage App configurations on Azure (Command Examples)
  4. aws lambda: CLI for AWS lambda (Command Examples)
  5. vdir: command not found
  6. Starting iptables Fails with Error “Another app is currently holding the xtables lock”
  7. conky Command Examples in Linux
  8. sar Command Examples in Linux
  9. nmcli Command Examples in Linux (Cheat Sheet)
  10. XFS error: Unable to mount filesystem With Noacl Permission in CentOS/RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • csh: The shell (command interpreter) with C-like syntax (Command Examples)
  • csc: The Microsoft C# Compiler (Command Examples)
  • crystal: Tool for managing Crystal source code
  • cryfs: A cryptographic filesystem for the cloud

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright