The ext4 file system can be configured to be remounted as read-only after encountering an error. For reference, see ext4's manual: https://man7.org/linux/man-pages/man5/ext4.5.html
The relevant part of this documentation is this:
errors={continue|remount-ro|panic}
Define the behavior when an error is encountered. (Either
ignore errors and just mark the file system erroneous and
continue, or remount the file system read-only, or panic
and halt the system.) The default is set in the file
system superblock, and can be changed using tune2fs(8).
According to Ubuntu's documentation: https://manpages.ubuntu.com/manpages/xenial/en/man8/mount.8.html, this is the default option for mounting ext4 file systems on Ubuntu.
To prevent a file system from remounting itself as read-only, change its mounting option to not use errors=remount-ro
. One alternative is to use errors=continue
, which will allow the volume to still be used after encountering an error.
See this documentation for instructions on how to mount an EBS volume: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
If you have configured an entry in /etc/fstab
for this volume, you can change the option in there. It will prevent the volume from being remounted as read-only.
Relevant content
- asked 9 months ago
- asked 3 years ago
- asked 2 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thank you for the answer, that makes sense. One question, though. I understand that some data might be lost following this error. If so, can I just ignore that? I mean how can I be sure that the volume is consistent afterwards?
This documentation provides guidance for handling I/O errors on EBS volumes: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstances.html#DeviceBlock. Taking frequent snapshots can substantially reduce the risk of data loss due to failure. Note that newer kernels (5.10 and later) provide more options to help reduce the risk of data loss. See: https://lwn.net/Articles/842385/