IOChaos allows you to simulate I/O failures, delays, and attribute modifications to test how your application handles file system issues and storage failures.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/chaos-mesh/chaos-mesh/llms.txt
Use this file to discover all available pages before exploring further.
Supported Actions
IOChaos supports four types of I/O chaos:- latency: Add delay to I/O operations
- fault: Return error codes from I/O operations
- attrOverride: Override file attributes (permissions, timestamps, size, etc.)
- mistake: Inject incorrect data into read/write operations
Configuration
Basic Example
Spec Fields
The I/O chaos action to perform. Must be one of:
latency: Add delay to I/O operationsfault: Return errno from I/O operationsattrOverride: Override file attributesmistake: Inject incorrect data
Specifies the target pods for the chaos experiment. See PodChaos documentation for selector details.
Selection mode:
one, all, fixed, fixed-percent, or random-max-percentThe mount path of the volume to inject I/O chaos. Must be a root of a mount path.
The path of files for injecting I/O chaos action. Supports glob patterns (e.g.,
/var/run/etcd/**/*)Percentage of I/O operations to affect (0-100)
Duration of the chaos action. Format: “300ms”, “1.5h”, “2h45m”
List of container names to inject chaos into. If not set, the first container will be injected.
Action-Specific Fields
Amount of delay to add (required when action is
latency). Format: “300ms”, “10ms”, “1s”. Valid units: ns, us, ms, s, m, h.Error code to return from I/O operations (required when action is
fault). See Linux error codesFile attributes to override (required when action is
attrOverride)Mistake injection configuration (required when action is
mistake)I/O methods to inject chaos into. If not specified, all methods are affected. Available methods:
lookup, forget, getattr, setattr, readlink, mknod, mkdir, unlink, rmdir, symlink, rename, link, open, read, write, flush, release, fsync, opendir, readdir, releasedir, fsyncdir, statfs, setxattr, getxattr, listxattr, removexattr, access, create, getlk, setlk, bmapRemote cluster where chaos will be deployed
Examples
I/O Latency
Add 10ms delay to 10% of I/O operations:I/O Errors
Return errno 5 (EIO - I/O error) for 50% of I/O operations:Attribute Override
Override file permissions:Use Cases
Testing Disk Latency
Use thelatency action to simulate slow storage devices or network-attached storage delays.
Simulating Disk Failures
Use thefault action with appropriate error codes to test how your application handles I/O errors, disk failures, or quota exceeded scenarios.
Permission Testing
UseattrOverride to modify file permissions and test your application’s error handling for permission denied scenarios.
Data Corruption Testing
Use themistake action to inject random or zero data to test data validation and corruption detection mechanisms.
Best Practices
- Volume Path Selection: Ensure
volumePathpoints to a mount point root, not a subdirectory - Path Patterns: Use glob patterns to target specific files or directories (e.g.,
*.dbfor database files) - Percentage Control: Start with low percentages (10-20%) to avoid completely blocking I/O
- Method Filtering: Use the
methodsfield to target specific I/O operations (e.g., onlyreadorwrite) - Error Code Selection: Choose appropriate errno values that match real-world failure scenarios:
- errno 5 (EIO): I/O error
- errno 28 (ENOSPC): No space left on device
- errno 13 (EACCES): Permission denied
- Monitor Application: Watch application logs and metrics to understand I/O chaos impact
- Container Selection: Specify
containerNameswhen working with multi-container pods
Notes
- IOChaos is implemented using FUSE (Filesystem in Userspace) and requires the volume to be remounted
- The chaos daemon intercepts I/O operations at the file system level
- Path supports glob patterns for flexible file matching
- All file times in
attrOverrideuse Unix timestamp format - File permissions in
permshould be specified as octal values (e.g., 72 decimal = 0110 octal) - The
mistakeaction can help test data validation and checksumming mechanisms - IOChaos requires the target pod to use a volume mount (not hostPath or emptyDir in some cases)