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

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

This command is used to display information about Logical Volume Manager (LVM) logical volumes. It is a useful tool for managing storage systems and analyzing the configuration of logical volumes. The lvdisplay command provides details such as the logical volume name, volume group, size, allocation type, and more.

Use case 1: Display information about all logical volumes

Code:

sudo lvdisplay

Motivation: By using this command, you can get an overview of all logical volumes in the system. This can be helpful for system administrators or anyone managing storage systems to analyze the current state of logical volumes.

Explanation: The lvdisplay command is executed with the sudo prefix to run it with administrative privileges. It does not take any arguments, so it displays information about all logical volumes available on the system.

Example output:

--- Logical volume ---
LV Path                /dev/vg1/lv1
LV Name                lv1
VG Name                vg1
LV UUID                xyzxyz-1234-5678-abcdef123456
LV Write Access        read/write
LV Creation host, time localhost, 2021-01-01 12:00:00 -0400
LV Status              available
# open                 1
LV Size                100.00 GiB
Current LE             25600
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           254:0

This output provides detailed information about the logical volume lv1 located in the volume group vg1. It includes the LV Path, LV Name, VG Name, LV UUID, LV Write Access, LV Creation host, LV Status, LV Size, Current LE (Logical Extents), Segments, Allocation, Read ahead sectors, and Block device.

Use case 2: Display information about all logical volumes in volume group vg1

Code:

sudo lvdisplay vg1

Motivation: This command allows you to specifically focus on a particular volume group and obtain details about all logical volumes within that group. This can be useful when analyzing the configuration and capacity of a specific volume group.

Explanation: The lvdisplay command is executed with the sudo prefix for administrative privileges. The vg1 argument is provided after the command to specify the volume group for which you want to display information about logical volumes.

Example output:

--- Logical volume ---
LV Path                /dev/vg1/lv1
LV Name                lv1
VG Name                vg1
LV UUID                xyzxyz-1234-5678-abcdef123456
LV Write Access        read/write
LV Creation host, time localhost, 2021-01-01 12:00:00 -0400
LV Status              available
# open                 1
LV Size                100.00 GiB
Current LE             25600
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           254:0

--- Logical volume ---
LV Path                /dev/vg1/lv2
LV Name                lv2
VG Name                vg1
LV UUID                abcabc-5678-1234-abcdef567890
LV Write Access        read/write
LV Creation host, time localhost, 2021-01-01 12:00:00 -0400
LV Status              available
# open                 1
LV Size                200.00 GiB
Current LE             51200
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           254:1

The output displays detailed information about all the logical volumes (lv1 and lv2) in the volume group vg1. It includes the same set of information as in the previous example.

Use case 3: Display information about logical volume lv1 in volume group vg1

Code:

sudo lvdisplay vg1/lv1

Motivation: This use case is specific to obtaining information about an individual logical volume within a particular volume group. It allows you to focus on a specific logical volume and get its details.

Explanation: The lvdisplay command is executed with the sudo prefix for administrative privileges. The vg1/lv1 argument is used to specify the volume group (vg1) and logical volume (lv1). By providing this argument, the command fetches information only about the specified logical volume.

Example output:

--- Logical volume ---
LV Path                /dev/vg1/lv1
LV Name                lv1
VG Name                vg1
LV UUID                xyzxyz-1234-5678-abcdef123456
LV Write Access        read/write
LV Creation host, time localhost, 2021-01-01 12:00:00 -0400
LV Status              available
# open                 1
LV Size                100.00 GiB
Current LE             25600
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           254:0

This output provides detailed information about the logical volume lv1 located in the volume group vg1. It includes the same set of information as in the previous examples.

Conclusion:

The lvdisplay command is a valuable tool for managing Logical Volume Manager (LVM) logical volumes. It allows users to get detailed information about logical volumes, volume groups, and their configurations. By utilizing the various arguments, it becomes easy to focus on specific logical volumes or volume groups for analysis and management purposes.

Related Posts

How to use the command mp3info (with examples)

How to use the command mp3info (with examples)

mp3info is a command-line tool that allows you to view and edit ID3v1 tags of MP3 files.

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

How to use the command jcal (with examples)

The jcal command is used to display calendar information in the Jalali format, with the current day highlighted.

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

How to use the command updatedb (with examples)

The updatedb command is used to create or update the database used by locate.

Read More