When working with fdisk
on Linux systems, you'll encounter various partition type codes. The two most relevant for Linux storage are:
83 - Linux native filesystem
8e - Linux LVM (Logical Volume Manager)
The partition type code is stored in the partition table (MBR or GPT) and serves as metadata indicating the intended purpose of the partition. While both types can technically contain LVM physical volumes, there are practical considerations:
# Creating a physical volume works on both types
pvcreate /dev/sdb1 # Works whether type is 83 or 8e
The partition type primarily affects:
- System tools that scan partition tables (e.g., installation programs)
- Auto-detection mechanisms during boot
- Compatibility with certain storage management utilities
For LVM usage, setting the partition type to 8e (Linux LVM) is considered best practice because:
# Example of creating an LVM-ready partition
fdisk /dev/sdb
n # New partition
p # Primary
1 # Partition number
[Enter] # Default first sector
[Enter] # Default last sector
t # Change type
8e # Set to Linux LVM
w # Write changes
You can still use LVM with type 83 partitions, especially in these scenarios:
- Whole disk LVM without partition table (
pvcreate /dev/sdb
) - Legacy systems with older LVM implementations
- When the partition might serve dual purposes
While the system will functionally work with either type, using 8e for LVM partitions improves clarity and compatibility with various system tools. The type indicator serves more as documentation than enforcement in modern Linux systems.
When working with fdisk
in Linux, you'll encounter multiple partition type codes that might seem confusing at first glance. The two relevant codes we're examining are:
83 Linux native filesystem
8e Linux LVM (Logical Volume Manager)
The partition type code primarily serves as metadata for the partition table. While both types can technically store LVM physical volumes, there are important implementation details:
- Type 83 (Linux): Originally meant for standard Linux filesystems (ext2/3/4, xfs, etc.)
- Type 8e (Linux LVM): Specifically designed to indicate LVM physical volumes
Despite the technical distinction, modern Linux systems handle both types similarly when it comes to LVM operations. Here's why:
# Creating PV on type 83 partition works fine:
pvcreate /dev/sdb1
# Same operation on type 8e partition:
pvcreate /dev/sdc1
The system doesn't actually check the partition type code when setting up LVM.
There are specific scenarios where choosing the correct type becomes important:
- Some partitioning tools may filter or highlight LVM partitions differently
- Certain bootloaders or system installers may look for specific type codes
- Enterprise storage systems might use the type code for automated provisioning
For production environments, it's recommended to:
# Set partition type to 8e when creating LVM physical volumes:
fdisk /dev/sdX
> t
> 8e
> w
This maintains consistency with enterprise standards and documentation.
The distinction dates back to early LVM implementations where:
- Type 83 was used before LVM became widely adopted
- Type 8e was introduced to clearly identify LVM volumes
- Modern kernels (2.6+) handle both types identically
For scripting and automation, you might want to explicitly check and set the type:
#!/bin/bash
# Check partition type
PART_TYPE=$(fdisk -l /dev/sdb1 | grep 'Id' | awk '{print $3}')
if [ "$PART_TYPE" != "8e" ]; then
echo "Converting partition type to Linux LVM"
echo -e "t\n8e\nw" | fdisk /dev/sdb
fi