When working with LVM (Logical Volume Manager), administrators often need to inspect logical volumes in a way similar to how fdisk -l
displays physical partitions. While tools like lvs
provide basic LV information, they don't show partition type IDs (like "8e" for LVM or "83" for Linux filesystems) that we're accustomed to seeing in physical partition tables.
Logical volumes don't actually have partition types in the same way physical partitions do. The type codes you see in fdisk -l
are part of the partition table metadata (MBR or GPT), while LVM logical volumes are abstracted layers above this. However, we can still retrieve similar information through alternative methods.
Here are several approaches to get the information you need:
1. Checking Underlying Physical Volumes
If you need the partition type of the physical volume that hosts your LVM:
# First identify the physical volume
pvdisplay
# Then check its partition type
fdisk -l /dev/sdX | grep "LVM"
2. Inspecting Filesystem Types
For logical volumes, what's more relevant is usually the filesystem type rather than partition type:
# Using blkid
blkid /dev/mapper/vgname-lvname
# Using lsblk with filesystem info
lsblk -f /dev/mapper/vgname-lvname
# Using file command
file -s /dev/mapper/vgname-lvname
3. Comprehensive LVM Information
For a complete picture of your LVM setup:
# Show physical volumes, volume groups and logical volumes
pvs; vgs; lvs
# Detailed logical volume information
lvdisplay /dev/vgname/lvname
# With filesystem information
lsblk -o NAME,FSTYPE,MOUNTPOINT,SIZE /dev/mapper/vgname-lvname
Consider these additional utilities that might provide the information in different formats:
# Using parted
parted /dev/mapper/vgname-lvname print
# Using hdparm (for low-level info)
hdparm -I /dev/mapper/vgname-lvname
# Using sfdisk (alternative to fdisk)
sfdisk -l /dev/mapper/vgname-lvname
Here's how you might investigate an LVM setup from start to finish:
# List all block devices
lsblk
# Identify which are LVM physical volumes
pvs
# Check the partition type of the physical device
fdisk -l /dev/sda
# List logical volumes
lvs
# Check filesystem type of a logical volume
blkid /dev/vg00/lvol0
# Mount and verify
mount /dev/vg00/lvol0 /mnt/test
df -h /mnt/test
Remember that logical volumes are fundamentally different from physical partitions:
- LVs don't have partition tables (MBR/GPT)
- The "type" concept applies to the containing physical partition
- Filesystem type is what's typically needed for LVs
- Some tools might show "LVM" as the type for the whole device
When working with LVM (Logical Volume Manager) in Linux, many administrators miss the familiar partition type information that fdisk -l
provides for physical partitions. While lvs
gives us basic logical volume information, it doesn't show the equivalent of partition types (like Linux's "83" or LVM's "8e").
LVM logical volumes don't actually have partition types in the same way physical partitions do. The partition type is a concept from the MBR/GPT partition tables that doesn't directly translate to LVM's abstraction layer. However, we can infer similar information through alternative methods.
Here are several approaches to get equivalent information:
1. Using file Command
The most direct way to determine what's on a logical volume:
file -s /dev/vg_name/lv_name
Example output for an ext4 filesystem:
/dev/vg_data/lv_root: Linux rev 1.0 ext4 filesystem data
2. Checking Filesystem Type
For mounted volumes, use:
df -Th | grep /dev/mapper
Or for unmounted volumes:
blkid /dev/vg_name/lv_name
3. LVM Metadata Inspection
For detailed LVM information:
lvdisplay -v vg_name/lv_name
If you need to see the original partition types of the physical volumes that make up your volume group:
fdisk -l /dev/sdX
Look for partitions marked with "8e" (Linux LVM) type.
Combine multiple commands for a comprehensive view:
for lv in $(lvs --noheadings -o lv_path); do
echo -n "$lv: ";
file -s $lv | cut -d: -f2-;
done
The key distinction is that while physical partitions have type codes in their partition table entries, LVM logical volumes are simply block devices that can contain any data. The equivalent concept is the filesystem type, which you can check with the methods above.