Understanding mdadm RAID10,f2 Layout: Technical Deep Dive for Linux Software RAID


2 views

When working with Linux software RAID (mdadm), the raid10,f2 layout presents an interesting case that differs from traditional RAID configurations. While most sysadmins understand conventional RAID levels, this particular setup raises questions when implemented on small disk arrays (2-3 disks).

The f2 modifier in raid10,f2 specifies a "far" layout with two copies. Here's the key distinction:


# Standard RAID10 (near):
# Disks: 0 1 2 3
# Layout: A B A B
#          C D C D

# RAID10,f2 (far, 2 copies):
# Disks: 0 1 2 3
# Layout: A A B B
#          C C D D

For a 2-disk setup (minimum requirement):

mdadm --create /dev/md0 --level=raid10 --raid-devices=2 --layout=f2 /dev/sda1 /dev/sdb1

The resulting layout will mirror across disks while maintaining the far-copy arrangement, providing better read performance than simple mirroring.

Benchmark comparisons show:

  • Read performance: ~1.5x standard RAID1
  • Write performance: Similar to RAID1 (single-disk write speed)
  • Fault tolerance: Can survive 1 disk failure (on 2-disk setups)

# Create array with 3 disks (unusual but possible)
mdadm --create /dev/md0 --level=raid10 --raid-devices=3 \
--layout=f2 /dev/sda1 /dev/sdb1 /dev/sdc1

# Check array status
cat /proc/mdstat

# Detailed information
mdadm --detail /dev/md0

# Filesystem creation
mkfs.ext4 /dev/md0

This layout shines in specific scenarios:

  • Small arrays (2-3 disks) needing better read performance than RAID1
  • Budget-conscious setups requiring redundancy
  • Applications with heavy read workloads (media servers, databases)

Recovery follows standard mdadm procedures, but note the specialized layout:


# Replace failed disk
mdadm /dev/md0 --fail /dev/sda1
mdadm /dev/md0 --remove /dev/sda1
mdadm /dev/md0 --add /dev/sdd1

RAID10,f2 is a specialized near/far RAID 10 variant in Linux's mdadm software RAID. The "f2" indicates a 2-copy layout with the following characteristics:


# Key parameters in mdadm create command:
--layout=f2      # Far replication with 2 copies
--raid-devices=N # Where N is total disks (2-3 in this context)

Unlike conventional RAID10 requiring 4+ disks, f2 layout provides redundancy with as few as 2 disks:

  • 2-disk array: Each block gets written to both disks (like RAID1 but with striping performance benefits)
  • 3-disk array: Data is striped across disks with each block having one replica on a different disk

Benchmarks show interesting tradeoffs:


# Sample performance test command:
hdparm -tT /dev/md0

# Typical results:
- Read speeds: 90-110% of raw disk speed (striping advantage)
- Write speeds: 60-80% of single disk (parity overhead)

Here's how to create a 2-disk RAID10,f2 array:


# Partition disks first (optional but recommended):
parted /dev/sda mklabel gpt
parted /dev/sda mkpart primary 1MiB 100%
parted /dev/sdb mklabel gpt
parted /dev/sdb mkpart primary 1MiB 100%

# Create array:
mdadm --create /dev/md0 --level=10 --raid-devices=2 \
--layout=f2 /dev/sda1 /dev/sdb1

# Filesystem creation:
mkfs.ext4 /dev/md0
mount /dev/md0 /mnt/raid

Ideal scenarios include:

  • Small NAS builds with 2-3 disks needing redundancy
  • Video editing workstations requiring both performance and safety
  • Database servers where RAID5 write penalty is unacceptable

The recovery process differs from standard RAID10:


# After disk replacement:
mdadm --manage /dev/md0 --add /dev/sdc1
# Monitor rebuild:
watch cat /proc/mdstat