When expanding a BTRFS filesystem with disks of different sizes (like your 500GB + 2TB scenario), the filesystem's chunk allocation behavior becomes crucial. BTRFS handles mixed-size disks by allocating chunks of equal size across devices, which can lead to apparent "wasted" space if not configured properly.
The secret lies in understanding BTRFS allocation modes:
- Single: Files stored on one device (no redundancy, max space usage)
- Dup: Duplicate copies on same device (for metadata protection)
- RAID0: Striped across devices (performance focus)
- RAID1: Mirrored (redundancy, halves available space)
For your 500GB + 2TB setup, consider this approach:
# Convert existing single-disk filesystem to multi-device
sudo btrfs device add /dev/sdb /mnt/btrfs
# Balance with single data profile (max space utilization)
sudo btrfs balance start -dconvert=single /mnt/btrfs
# Optional: Keep metadata redundant for safety
sudo btrfs balance start -mconvert=raid1 /mnt/btrfs
To further optimize space usage:
# Check current allocation
sudo btrfs filesystem usage /mnt/btrfs
# Set default allocation profile (for new writes)
sudo btrfs property set /mnt/btrfs compression zstd
sudo btrfs property set /mnt/btrfs alloc_start 1G
When using mixed-size disks:
- Hot data tends to migrate to larger disks over time
- Small files benefit from RAID1 metadata
- Consider periodic balancing with filters:
sudo btrfs balance start -dusage=50 /mnt/btrfs
If you encounter ENOSPC errors despite having free space:
# Check actual space allocation
sudo btrfs filesystem show /mnt/btrfs
# Force rebalance when metadata is full
sudo btrfs balance start -musage=90 /mnt/btrfs
When expanding a BTRFS filesystem with disks of different sizes, the key challenge lies in the filesystem's allocation strategy. BTRFS primarily uses two profiles for data distribution:
# Current filesystem status check
sudo btrfs filesystem show /mnt/data
While BTRFS doesn't natively support perfect space utilization across mismatched disks, we can implement workarounds:
# Adding the new disk (2TB) to existing filesystem
sudo btrfs device add /dev/sdb /mnt/data
# Balancing with specific filters
sudo btrfs balance start -dusage=50 /mnt/data
For better space management, consider these approaches:
# Setting different RAID profiles for metadata and data
sudo btrfs balance start -mconvert=raid1 -dconvert=raid0 /mnt/data
# Creating separate profiles for different data types
sudo btrfs filesystem df /mnt/data
sudo btrfs balance start -dconvert=single /mnt/data
Here's how I successfully combined 500GB and 2TB disks:
# Initial setup
sudo mkfs.btrfs -d single /dev/sda1
sudo mount /dev/sda1 /mnt/data
# Adding second disk
sudo btrfs device add /dev/sdb1 /mnt/data
sudo btrfs filesystem balance /mnt/data
# Monitoring allocation
watch -n 1 sudo btrfs filesystem usage /mnt/data
Consider these best practices when planning future expansions:
# Setting up proper allocation groups
sudo btrfs fi balance start -v -dusage=0 /mnt/data
# Checking fragmentation status
sudo btrfs filesystem defrag -r -v /mnt/data