lvscan – Scan Logical Volumes

The lvscan command is used to scan all the available logical volumes in the system. Logical volumes are a type of virtual block device that can span across multiple physical block devices. lvscan scans the system to locate all available logical volumes, and then it lists them in a tabular format, providing information like the volume group name, logical volume name, size, and status.

Overview

The syntax of the lvscan command is as follows:

lvscan [options]

When executed without any options, lvscan scans all the available logical volumes in the system and displays them in a tabular format. The output contains the following columns:

  • LV: The logical volume name.
  • VG: The volume group name to which the logical volume belongs.
  • Attr: The attributes of the logical volume, such as read/write permissions.
  • LSize: The logical volume size.
  • Pool: The name of the pool to which the logical volume belongs.
  • Origin: The name of the origin volume if the logical volume is a snapshot.
  • Data%: The percentage of the logical volume that contains data.
  • Meta%: The percentage of the logical volume that contains metadata.
  • Move: The status of the logical volume if it is in the process of being moved to a different physical volume.
  • Log: The name of the logical volume’s log device if it is a mirrored logical volume.

Here are a few examples of how to use lvscan:

Example 1: Scan all logical volumes

lvscan

This command scans all the available logical volumes in the system and lists them in a tabular format.

Example 2: Display only active logical volumes

lvscan -a

This command scans only the active logical volumes in the system and lists them in a tabular format.

Example 3: Display verbose output

lvscan -v

This command displays verbose output, which includes additional information like the device path, major and minor numbers, and open count.

Options

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

Option Description
-a, –active Scan only active logical volumes
-d, –debug Enable debug messages
-h, –help Display help message
-q, –quiet Suppress all output
-v, –verbose Display verbose output
-V, –version Display version information

Troubleshooting tips

  • If lvscan does not display any logical volumes, it could mean that there are no logical volumes available in the system. In this case, you may need to create a new logical volume using the lvcreate command.
  • If lvscan displays an error message saying that it cannot find a logical volume, it could mean that the logical volume has been removed or is not available. You can use the lvremove command to remove the logical volume or the lvchange command to change the logical volume’s attributes.

Notes

  • lvscan is a part of the LVM (Logical Volume Manager) system, which provides a flexible and scalable way to manage disk space in Linux systems.
  • Logical volumes are created from physical volumes, which can be either a partition or a whole disk. Logical volumes can be resized, moved, and even mirrored across multiple physical volumes.
  • LVM provides several other commands like pvcreate, vgcreate, lvcreate, pvresize, vgextend, lvextend, and lvreduce, which are used to manage the physical volumes, volume groups, and logical volumes.