LVM on Raw Block Devices: Partition Table Necessity and Management with parted


1 views

You've discovered a legitimate approach in Linux storage management: using LVM directly on raw block devices without a partition table. This method is fully supported and works because:

  • LVM's physical volumes (PVs) can reside on entire disks (/dev/sdb) or partitions (/dev/sdb1)
  • The PV header contains its own metadata structure at the start of the device
  • No partition table is required for LVM to function

Here's the typical workflow you've observed:

# Create PV directly on raw device
pvcreate /dev/sdb

# Create VG
vgcreate myvg /dev/sdb

# Create LV
lvcreate -n mylv -L 10G myvg

# Create filesystem
mkfs.ext4 /dev/myvg/mylv

While the raw device approach works, partition tables become essential when:

  • You need to mix LVM with non-LVM partitions on the same disk
  • The disk will be used in systems that expect partition tables (some BIOS/UEFI implementations)
  • You want clear partition labeling for maintenance
  • The disk might be moved to Windows systems

To add a partition table to an already-in-use LVM disk:

# First ensure all data is backed up!
# Unmount any filesystems using this disk

# Wipe existing LVM signatures (destructive!)
wipefs -a /dev/sdb

# Create new partition table
parted /dev/sdb mklabel gpt

# Create partition consuming entire disk
parted /dev/sdb mkpart primary 0% 100%

# Set partition type to LVM
parted /dev/sdb set 1 lvm on

# Now recreate your PV on the partition
pvcreate /dev/sdb1

The error unrecognised disk label you encountered is expected when:

  • No partition table exists (you're using the raw device)
  • The disk contains only LVM metadata without a partition table
  • The disk has an unknown partition scheme

To verify a disk's partition status:

# Check for partition table
parted /dev/sdb print

# Alternative methods:
lsblk -f /dev/sdb
fdisk -l /dev/sdb
blkid /dev/sdb

In enterprise environments, we typically recommend:

  1. Always use partition tables for better compatibility
  2. Standardize on GPT (for disks >2TB or UEFI systems)
  3. Document disk layouts clearly

Example of a robust setup:

# GPT partition table with aligned partitions
parted /dev/sdb mklabel gpt
parted /dev/sdb mkpart primary 1MiB 100%
parted /dev/sdb set 1 lvm on

# Create PV with proper alignment
pvcreate --dataalignment 1m /dev/sdb1

For legacy MBR systems, replace mklabel gpt with mklabel msdos.


Yes, you can absolutely use LVM directly on raw block devices without a partition table. The workflow you described (pvcreate → vgcreate → lvcreate → filesystem) is technically valid and commonly used in enterprise storage scenarios. Here's why this works:


# Example of direct LVM initialization
pvcreate /dev/sdb
vgcreate myvg /dev/sdb
lvcreate -n mylv -L 100G myvg
mkfs.xfs /dev/myvg/mylv
mount /dev/myvg/mylv /mnt/data

While not required, partition tables offer advantages in these scenarios:

  • When mixing LVM with non-LVM partitions on the same disk
  • For BIOS/GPT compatibility requirements
  • When disk alignment optimization is needed
  • For better compatibility with some hardware RAID controllers

To add a GPT partition table to your existing LVM device (without data loss):


parted /dev/sdb mklabel gpt
parted /dev/sdb mkpart primary 1MiB 100%
parted /dev/sdb set 1 lvm on

The "unrecognised disk label" error is expected when:


$ parted /dev/sdb print
Error: /dev/sdb: unrecognised disk label
Model: Vendor Storage (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B

This indicates no partition table exists, which is normal for direct LVM usage. The disk remains fully functional for LVM operations.

Testing with different configurations:


# Raw device performance test
dd if=/dev/zero of=/dev/myvg/mylv bs=1M count=1000

# Partitioned device comparison
dd if=/dev/zero of=/dev/sdb1 bs=1M count=1000

In most modern systems (kernel 3.10+), performance differences are negligible (<2%).

  • For single-purpose LVM disks: Raw device is acceptable
  • For mixed-usage disks: Always use partition tables
  • Document your disk layout clearly in /etc/fstab comments
  • Consider adding a protective MBR for GPT disks: sgdisk -p /dev/sdb

To verify LVM configuration regardless of partition table:


pvdisplay -v
vgdisplay -v
lvdisplay -v
lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT