How to use the command `pvdisplay` (with examples)

How to use the command `pvdisplay` (with examples)

The pvdisplay command is used to display information about Logical Volume Manager (LVM) physical volumes. This command allows you to retrieve important details about the physical volumes in an LVM setup, such as size, free space, allocation policy, and more. It helps in managing and monitoring the physical storage in a Linux system.

Use case 1: Display information about all physical volumes

Code:

sudo pvdisplay

Motivation: The motivation for using this use case is to retrieve detailed information about all physical volumes in the LVM setup. This can be useful for monitoring the overall storage usage, identifying any potential issues or inconsistencies in the physical volumes, and planning for storage expansion or allocation.

Explanation:

  • sudo: The sudo command is used to execute the subsequent command with superuser (root) privileges, which is often required for retrieving detailed system information.
  • pvdisplay: This is the main command that displays information about the physical volumes.

Example output:

--- Physical volume ---
PV Name               /dev/sda1
VG Name               vg1
PV Size               <100.00 GiB / not usable 0   
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              25599
Free PE               0
Allocated PE          25599
PV UUID               ABCDEFGHIJKLMNOPQRSTUVWXYZ

--- Physical volume ---
PV Name               /dev/sdb1
VG Name               vg1
PV Size               <250.00 GiB / not usable 0   
Allocatable           yes 
PE Size               4.00 MiB
Total PE              63999
Free PE               32000
Allocated PE          31999
PV UUID               ZYXWVUTSRQPONMLKJIHGFEDCBA

Use case 2: Display information about the physical volume on drive /dev/sdXY

Code:

sudo pvdisplay /dev/sdXY

Motivation: The motivation for using this use case is to retrieve specific information about a particular physical volume. This can be useful for inspecting the properties of a specific drive or troubleshooting any issues related to a particular physical volume.

Explanation:

  • sudo: As before, sudo is used to execute the command with root privileges.
  • pvdisplay: This is the main command to display information about the physical volumes.
  • /dev/sdXY: This argument specifies the path of the physical volume you want to retrieve information about. Replace sdXY with the actual device name of the physical volume, such as /dev/sda1.

Example output:

--- Physical volume ---
PV Name               /dev/sda1
VG Name               vg1
PV Size               <100.00 GiB / not usable 0   
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              25599
Free PE               0
Allocated PE          25599
PV UUID               ABCDEFGHIJKLMNOPQRSTUVWXYZ

Conclusion:

The pvdisplay command is a powerful tool for retrieving detailed information about LVM physical volumes. It allows you to monitor the overall storage usage, identify potential issues, and troubleshoot specific physical volumes. By understanding and utilizing the different use cases of this command, you can effectively manage and maintain your storage infrastructure in a Linux system.

Related Posts

How to use the command "loadkeys" (with examples)

How to use the command "loadkeys" (with examples)

Loadkeys is a command used to load the kernel keymap for the console.

Read More
How to use the command snakefmt (with examples)

How to use the command snakefmt (with examples)

Snakefmt is a command line tool that allows users to format Snakemake files, which are used for creating and managing data workflows.

Read More
How to use the command "clifm" (with examples)

How to use the command "clifm" (with examples)

The command “clifm” is a command-line file manager that allows users to navigate and manage their files and directories using the command line interface.

Read More