Course contentsShow
← Linux
Lesson 785 of 1,8197. Storage Management and Logical VolumesFree lesson

Automated disaster recovery testing

Simulate catastrophic storage failure to validate restore time objectives.

In this lesson, you will learn how to simulate a catastrophic storage failure to empirically validate your Restore Time Objectives (RTO) without putting your actual production data at risk.

The Logic of Simulation

A "Restore Time Objective" is the maximum amount of time your business can tolerate a storage outage before critical operations must be restored. In a complex Linux environment, hoping your backup scripts work isn't enough; you must prove they work under pressure.

Automated disaster recovery (DR) testing involves creating a "chaos environment" where you intentionally induce a hardware-level failure, such as unmounting a primary logical volume or logically disconnecting a backend storage controller, to observe how your automated recovery scripts behave.

Simulating a Controller Failure

Rather than pulling physical cables, you can simulate a controller bus reset or storage unavailability to see if your system automatically transitions to a secondary or redundant volume. For example, you can use the sysfs interface to disable a device temporarily:

# Safely simulate a device failure
echo 1 | sudo tee /sys/block/sdX/device/delete

Once the device is "gone," your monitoring tools should trigger your automated recovery workflows. These workflows typically involve:

  1. Detection: The system identifies that the block device is no longer responding.
  2. Failover: Scripts re-mount the filesystem on a secondary, replicated logical volume.
  3. Verification: Integrity checks are run against the filesystem to ensure data consistency after the "crash."

Measuring the RTO

To validate your RTO, you should wrap your simulation in a simple timestamped test script:

start_time=$(date +%s)

# Trigger disaster simulation
echo 1 | sudo tee /sys/block/sdX/device/delete

# Monitor for successful mount of the backup volume
until mountpoint -q /mnt/production_data; do
    sleep 1
done

end_time=$(date +%s)
echo "Total Recovery Time: $((end_time - start_time)) seconds."

If the measured time exceeds your RTO, you know exactly where the bottleneck is—whether it’s in the script’s logic, the time taken for filesystem consistency checks, or the latency in mounting the secondary storage. By automating this, you turn disaster recovery from a theoretical document into a repeatable, audited process.

Key Takeaway: Automated disaster recovery testing turns "hope" into "certainty" by measuring the time from simulated failure to operational readiness, ensuring your recovery protocols strictly adhere to business objectives.