• 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

vgextend Command Examples in Linux

by admin

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. However, if all of the physical storage in a volume group is already occupied by logical volumes, then more physical volumes must be added before the logical volume can be extended.

The vgextend command is used to dynamically extend the LVM volume group. It increases the capacity of the volume group by adding physical volumes to the volume group. The physical volumes in the LVM volume group can be added when the volume group is created using the vgcreate command, or dynamically added using the vgextend command.

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

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

# vgextend vgdata /dev/sdN1

3. 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

Syntax:

# vgextend [parameter]

Command parameters

  • -A – specify y|n to autobackup metadata.
  • -d – Debug mode
  • -t – Test only
  • -f – override various checks. Use with caution.
  • -q – suppress output and log messages.
  • -y – do not prompt for confirmation
  • reportformat basic|json – Output format to specify.

Examples of vgextend Command

Add the physical volume /dev/sdb1 to the volume group testvg:

# vgextend testvg /dev/sdb1

Filed Under: Linux

Some more articles you might also be interested in …

  1. openfortivpn Command Examples in Linux
  2. export: command not found
  3. expect: command not found
  4. lvsd Command Examples in Linux
  5. CentOS / RHEL : How to Enable SSL For Apache
  6. slocate command in linux
  7. How to obtain virtual/physical CPU information in Oracle VM (XEN)
  8. mktemp Command Examples in Linux
  9. playerctl Command Examples in Linux
  10. What is the refid in ntpq -p output?

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright