Setting Up RAID on Your Linux Dedicated Server: A Complete Guide

Understanding RAID for Dedicated Servers

Redundant Array of Independent Disks (RAID) is a critical technology for production dedicated servers that require data protection and performance optimization. Choosing the right RAID level can mean the difference between a minor disk failure and catastrophic data loss.

BRHOSTING.COM dedicated servers are available with multiple NVMe SSD and HDD configurations, letting you implement the RAID level that best matches your workload requirements. This guide covers software RAID setup using mdadm on Linux.

RAID Levels Compared

RAID 0 (Striping)

  • Minimum disks: 2
  • Redundancy: None
  • Performance: Excellent read/write
  • Use case: Temporary data, caching layers, non-critical workloads

RAID 1 (Mirroring)

  • Minimum disks: 2
  • Redundancy: Survives 1 disk failure
  • Performance: Good read, normal write
  • Use case: OS drives, small databases, boot volumes

RAID 5 (Striping with Parity)

  • Minimum disks: 3
  • Redundancy: Survives 1 disk failure
  • Performance: Good read, moderate write
  • Use case: File servers, medium databases, web hosting

RAID 10 (Mirrored Stripes)

  • Minimum disks: 4
  • Redundancy: Survives multiple failures (one per mirror)
  • Performance: Excellent read/write
  • Use case: High-performance databases, transaction processing

Setting Up RAID 1 with mdadm

Install mdadm

sudo apt update
sudo apt install mdadm -y

Identify Your Disks

lsblk
sudo fdisk -l

Assume we have two identical NVMe drives: /dev/nvme0n1 and /dev/nvme1n1.

Create Partitions

sudo parted /dev/nvme0n1 mklabel gpt
sudo parted /dev/nvme0n1 mkpart primary 0% 100%
sudo parted /dev/nvme0n1 set 1 raid on

sudo parted /dev/nvme1n1 mklabel gpt
sudo parted /dev/nvme1n1 mkpart primary 0% 100%
sudo parted /dev/nvme1n1 set 1 raid on

Create the RAID Array

sudo mdadm --create /dev/md0 --level=1 --raid-devices=2   /dev/nvme0n1p1 /dev/nvme1n1p1

Verify the Array

cat /proc/mdstat
sudo mdadm --detail /dev/md0

Create Filesystem and Mount

sudo mkfs.ext4 /dev/md0
sudo mkdir /mnt/raid1
sudo mount /dev/md0 /mnt/raid1

Persist the Configuration

sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo update-initramfs -u
echo "/dev/md0 /mnt/raid1 ext4 defaults 0 2" | sudo tee -a /etc/fstab

Setting Up RAID 10

For high-performance database servers, RAID 10 with four NVMe drives offers the best balance of speed and redundancy:

sudo mdadm --create /dev/md0 --level=10 --raid-devices=4   /dev/nvme0n1p1 /dev/nvme1n1p1 /dev/nvme2n1p1 /dev/nvme3n1p1

Monitoring and Alerting

# Enable email notifications for RAID events
sudo vim /etc/mdadm/mdadm.conf
# Add: MAILADDR [email protected]

# Check array status periodically
sudo mdadm --monitor --scan --daemonise

Recovering from a Failed Disk

# Remove the failed disk
sudo mdadm /dev/md0 --remove /dev/nvme1n1p1

# Add replacement disk
sudo mdadm /dev/md0 --add /dev/nvme2n1p1

# Monitor rebuild progress
watch cat /proc/mdstat

Conclusion

Proper RAID configuration is essential for any production dedicated server. At BRHOSTING.COM, our servers support up to 4 NVMe drives, enabling RAID 10 configurations that deliver both performance and reliability. Contact our team if you need assistance selecting the optimal RAID configuration for your workload.

Back to Blog