RAID Configuration and Disk Health Monitoring: smartctl Guide
RAID levels overview (0/1/5/10), software RAID with mdadm, disk health checks with smartctl, monitoring with smartd, and interpreting SMART data.
Table of Contents
RAID Configuration and Disk Health Monitoring: smartctl Guide
Disk failures are inevitable in server environments. RAID (Redundant Array of Independent Disks) technology combines multiple disks to improve data safety and/or performance. This guide covers RAID levels, software RAID setup on Linux, and disk health monitoring with smartctl.
RAID Levels
RAID 0 — Striping
Data is distributed equally across disks.
- Minimum disks: 2
- Capacity: Sum of all disks
- Performance: High read/write speed
- Reliability: Zero — if one disk fails, all data is lost
- Use case: Temporary data, high-performance applications
RAID 1 — Mirroring
Data is written to all disks simultaneously.
- Minimum disks: 2
- Capacity: Smallest disk capacity
- Performance: Read speed increases, write speed unchanged
- Reliability: High — if one disk fails, the other continues
- Use case: OS disks, critical data
RAID 5 — Distributed Parity
Data and parity information are distributed across all disks.
- Minimum disks: 3
- Capacity: (N-1) × disk capacity
- Performance: Good read, moderate write
- Reliability: Tolerates 1 disk failure
- Use case: File servers, general-purpose storage
RAID 10 — Mirroring + Striping
Combination of RAID 1 and RAID 0.
- Minimum disks: 4
- Capacity: Half of total capacity
- Performance: Very high
- Reliability: Tolerates 1 disk failure per pair
- Use case: Databases, high performance + reliability
RAID Comparison Table
| Feature | RAID 0 | RAID 1 | RAID 5 | RAID 10 |
|---|---|---|---|---|
| Min. disks | 2 | 2 | 3 | 4 |
| Capacity | 100% | 50% | (N-1)/N% | 50% |
| Read speed | Very high | High | High | Very high |
| Write speed | Very high | Normal | Moderate | High |
| Fault tolerance | 0 disks | 1 disk | 1 disk | 1/pair |
| Data safety | None | High | High | Very high |
REXE physical servers may have a hardware RAID controller. Software RAID is managed by the Linux kernel as an alternative to hardware RAID.
Software RAID Setup with mdadm
Installing mdadm
# Ubuntu/Debian
sudo apt update
sudo apt install mdadm -y
# CentOS/AlmaLinux
sudo dnf install mdadm -y
Preparing Disks
# List existing disks
lsblk
fdisk -l
# View disk information
sudo fdisk -l /dev/sdb
sudo fdisk -l /dev/sdc
# Clear existing RAID signatures if present
sudo mdadm --zero-superblock /dev/sdb
sudo mdadm --zero-superblock /dev/sdc
Creating RAID 1
# Create RAID 1 array
sudo mdadm --create /dev/md0 \
--level=1 \
--raid-devices=2 \
/dev/sdb /dev/sdc
# Confirm creation (type yes)
# Monitor RAID status
watch cat /proc/mdstat
# Check completion status
cat /proc/mdstat
Creating RAID 5
# Create RAID 5 array (3 disks)
sudo mdadm --create /dev/md0 \
--level=5 \
--raid-devices=3 \
/dev/sdb /dev/sdc /dev/sdd
# Add a hot spare disk
sudo mdadm --create /dev/md0 \
--level=5 \
--raid-devices=3 \
--spare-devices=1 \
/dev/sdb /dev/sdc /dev/sdd /dev/sde
Saving RAID Configuration
# Update mdadm.conf
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
# Update initramfs
sudo update-initramfs -u
# View RAID status
sudo mdadm --detail /dev/md0
Creating a Filesystem on RAID
# Create ext4 filesystem
sudo mkfs.ext4 /dev/md0
# Create mount point
sudo mkdir /mnt/raid
# Mount
sudo mount /dev/md0 /mnt/raid
# Add to /etc/fstab for persistent mounting
echo '/dev/md0 /mnt/raid ext4 defaults 0 0' | sudo tee -a /etc/fstab
RAID Management
# View RAID status
sudo mdadm --detail /dev/md0
# List all RAID arrays
cat /proc/mdstat
# Mark a disk as failed
sudo mdadm /dev/md0 --fail /dev/sdb
# Remove failed disk
sudo mdadm /dev/md0 --remove /dev/sdb
# Add new disk
sudo mdadm /dev/md0 --add /dev/sdb
# Stop RAID
sudo mdadm --stop /dev/md0
# Start RAID
sudo mdadm --assemble /dev/md0
Disk Health Checks with smartctl
smartctl reads S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) data from disks.
Installing smartmontools
# Ubuntu/Debian
sudo apt install smartmontools -y
# CentOS/AlmaLinux
sudo dnf install smartmontools -y
Basic smartctl Commands
# View disk information
sudo smartctl -i /dev/sda
# Check SMART status
sudo smartctl -H /dev/sda
# Output: SMART overall-health self-assessment test result: PASSED
# View all SMART data
sudo smartctl -a /dev/sda
# Short summary
sudo smartctl -s on -a /dev/sda
Running SMART Tests
# Short test (1-2 minutes)
sudo smartctl -t short /dev/sda
# Long test (several hours)
sudo smartctl -t long /dev/sda
# View test results
sudo smartctl -l selftest /dev/sda
# Check test progress
sudo smartctl -a /dev/sda | grep -i "test"
Interpreting SMART Data
Important SMART attributes:
# View attributes
sudo smartctl -A /dev/sda
| ID | Attribute | Description | Critical Value |
|---|---|---|---|
| 1 | Raw_Read_Error_Rate | Raw read error rate | Should be 0 |
| 5 | Reallocated_Sector_Ct | Reallocated sector count | Should be 0 |
| 9 | Power_On_Hours | Total operating hours | Informational |
| 10 | Spin_Retry_Count | Spin retry count | Should be 0 |
| 187 | Reported_Uncorrect | Uncorrectable error count | Should be 0 |
| 188 | Command_Timeout | Command timeout count | Should be 0 |
| 197 | Current_Pending_Sector | Pending sector count | Should be 0 |
| 198 | Offline_Uncorrectable | Offline uncorrectable | Should be 0 |
| 199 | UDMA_CRC_Error_Count | CRC error count | Should be 0 |
If ID 5 (Reallocated_Sector_Ct), 197 (Current_Pending_Sector), or 198 (Offline_Uncorrectable) values are greater than 0, the disk may be near failure. Back up your data immediately!
NVMe Disk Checks
# NVMe disk information
sudo smartctl -i /dev/nvme0
# NVMe SMART data
sudo smartctl -a /dev/nvme0
# NVMe health status
sudo smartctl -H /dev/nvme0
Automated Monitoring with smartd
smartd runs in the background, continuously monitoring disk health and sending notifications when issues are detected.
Configuring smartd
# Edit configuration file
sudo nano /etc/smartd.conf
# Monitor all disks, send email on issues
DEFAULTS -a -o on -S on -n standby,q -s (S/../.././02|L/../../6/03) -m admin@rexe.tr -M exec /usr/share/smartmontools/smartd-runner
# Monitor specific disks
/dev/sda -a -o on -S on -m admin@rexe.tr
/dev/sdb -a -o on -S on -m admin@rexe.tr
# Auto-detect all disks
DEVICESCAN -a -o on -S on -m admin@rexe.tr
# Enable smartd service
sudo systemctl enable --now smartd
# Check status
sudo systemctl status smartd
# Test configuration
sudo smartd -q onecheck
smartd Options
| Option | Description |
|---|---|
-a | Monitor all SMART attributes |
-o on | Enable offline tests |
-S on | Enable attribute saving |
-s S/../.././02 | Run short test daily at 02:00 |
-s L/../../6/03 | Run long test every Saturday at 03:00 |
-m email | Notification email |
-n standby,q | Don't wake standby disks |
Disk Health Monitoring Commands
# Quick health check for all disks
for disk in /dev/sd[a-z]; do
echo "=== $disk ==="
sudo smartctl -H $disk 2>/dev/null | grep -E "PASSED|FAILED|result"
done
# Check disk temperature
sudo smartctl -A /dev/sda | grep -i temperature
# Check disk operating hours
sudo smartctl -A /dev/sda | grep Power_On_Hours
# View error logs
sudo smartctl -l error /dev/sda
# Get disk info in JSON format
sudo smartctl -j -a /dev/sda
RAID + SMART Integration
# Check SMART status of disks in RAID array
sudo mdadm --detail /dev/md0 | grep -E "State|Active|Failed"
# Check health of each disk in RAID
for disk in /dev/sdb /dev/sdc /dev/sdd; do
echo "=== $disk ==="
sudo smartctl -H $disk
done
# Monitor RAID events
sudo mdadm --monitor --scan --daemonise
# RAID email notification
sudo nano /etc/mdadm/mdadm.conf
# Add line: MAILADDR admin@rexe.tr
Use RAID and SMART monitoring together. SMART predicts disk failure in advance while RAID prevents data loss when failure occurs. Together they form a comprehensive disk safety strategy.
Conclusion
RAID and disk health monitoring are fundamental components of data safety on REXE servers. RAID 1 or RAID 10 provides high reliability for critical data, while smartctl and smartd let you detect disk failures before they happen. Regular SMART tests and RAID status checks are the most effective way to prevent unexpected data loss.
Related Articles
How to Connect to Your VDS Server via SSH (Complete Guide)
Step-by-step SSH connection guide for Linux VDS: PuTTY, Terminal, key-based authentication, Path Panel firewall rules, and security best practices.
How to Connect to Windows VDS via RDP: Complete Guide
Complete guide to connecting to Windows Server VDS via Remote Desktop (RDP): setup steps, NLA security, Path Panel firewall rule, and troubleshooting tips.
How to Change VDS Server OS: Step-by-Step Reinstall Guide
Step-by-step guide to changing your VDS server OS via REXE panel: backup tips, supported Linux distributions and Windows Server versions explained.