While both lvextend
and lvresize
can increase LV size, they have fundamental differences:
# lvextend only grows volumes
lvextend -L+1G /dev/vg00/lvol1
# lvresize can both grow and shrink
lvresize -L-500M /dev/vg00/lvol1 # Shrinking operation
lvresize -L+2G /dev/vg00/lvol1 # Growing operation
The 32MB rounding you observed stems from Physical Extent (PE) alignment. LVM operates in PE units (default 4MB). To change this behavior:
# Create VG with 1MB PE size (must be done initially)
vgcreate -s 1M vg00 /dev/sdb1
# For existing VGs, you can't change PE size but can use:
lvresize --resizefs -L+1M /dev/vg00/lvol1 # Attempts exact resize
When you need granular control over LV sizes:
# Method 1: Use extents count instead of absolute size
lvextend -l +128 /dev/vg00/lvol1 # Adds 128 extents
# Method 2: Combine with filesystem resize
lvresize --resizefs -r -L+1M /dev/vg00/lvol1
# Method 3: Use --noudevsync flag (for older systems)
lvextend --noudevsync -L+1M /dev/vg00/lvol1
Remember that after LV extension, filesystems often need separate resizing:
# For ext4:
resize2fs /dev/vg00/lvol1
# For XFS:
xfs_growfs /mount/point
# Modern approach combining both:
lvresize -r -L+1G /dev/vg00/lvol1
While both lvextend
and lvresize
can increase logical volume sizes, they serve distinct purposes in LVM management:
# lvextend ONLY grows volumes (simpler syntax)
lvextend -L+1G /dev/vg00/lvol1
# lvresize can grow OR shrink (more flexible)
lvresize -L-500M /dev/vg00/lvol1 # Shrinking example
The 32MB rounding you're seeing relates to LVM's physical extent (PE) size. By default, LVM allocates space in PE units (typically 4MB). This explains why attempting to add 1MB results in a 32MB allocation.
# Check your PE size with:
vgdisplay your_volume_group | grep "PE Size"
# Example output showing 4MB PEs:
PE Size 4.00 MiB
While you can't allocate smaller than a single PE, you can control the rounding behavior:
# Method 1: Use exact size instead of delta
lvextend -L 321M /dev/mapper/rootvg-home
# Method 2: Use --nosizecheck (use with caution)
lvextend -L+1m --nosizecheck /dev/mapper/rootvg-home
- Use lvextend when: You only need to grow volumes and want simpler syntax
- Use lvresize when: You need bidirectional resizing or advanced options like:
lvresize --resizefs -L+2G /dev/vg00/lvol1 # Grow FS simultaneously
Here's a complete example showing proper filesystem extension after LVM expansion:
# 1. Check current space
df -h /home
# 2. Extend the logical volume (using precise sizing)
lvextend -L+1G /dev/mapper/rootvg-home
# 3. Resize the filesystem (for ext4)
resize2fs /dev/mapper/rootvg-home
# Alternative single-command approach:
lvresize --resizefs -L+1G /dev/mapper/rootvg-home