vgscan – Scans and Displays Volume Groups on the System

The vgscan command is a Linux utility used to scan all disks for volume groups and display them on the system. It is a useful tool for system administrators who need to manage storage devices and logical volumes.

Overview

The vgscan command scans all disks for volume groups and updates the system’s cache file /etc/lvm/cache/.cache. It then displays a list of all volume groups found on the system. This command is useful when new disks are added to the system, or when the system is booted with new disks.

Here is an example of how to use vgscan:

$ sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg01" using metadata type lvm2
  Found volume group "vg02" using metadata type lvm2

This output shows that two volume groups, vg01 and vg02, were found on the system.

Options

The following table lists all available options for the vgscan command:

Option Description
-a, --activate Activates any volume groups found during the scan.
-d, --debug Enables debug output.
-h, --help Displays help information and exits.
-v, --verbose Enables verbose output.
-v, --version Displays version information and exits.

Troubleshooting Tips

  • If no volume groups are found, make sure that all disks are properly connected and powered on.
  • If the cache file /etc/lvm/cache/.cache is corrupted, delete the file and run vgscan again to regenerate it.
  • If the vgscan command fails with an error message, check the system logs for more information.

Notes

  • The vgscan command does not create or modify any volume groups. It only scans for existing volume groups and updates the system’s cache file.
  • To create a new volume group, use the vgcreate command.
  • To extend an existing volume group, use the vgextend command.