# Read-only file system (EROFS) — cannot write to disk

**Code:** `Read-only file system` · **Category:** Linux · **Seen on:** Linux

The filesystem is mounted read-only — often because the kernel remounted it after detecting disk errors.

## Meaning

ext4 and others are mounted with errors=remount-ro: on I/O errors or corruption the kernel flips the disk to read-only to protect data. It can also be intentional (container readOnlyRootFilesystem, snap/squashfs, a read-only bind mount, or macOS system volume).

## Common causes

- Disk errors or filesystem corruption (kernel remounted ro)
- Failing disk or cloud volume detached
- Mounted ro on purpose (fstab, container, live USB)
- Writing into a read-only path (snap, /usr on immutable distros)

## Quick fix

1. Check the kernel log: dmesg | grep -i 'remount\|I/O error'
2. Back up data, then fsck the volume and remount rw
3. If intentional, write to a writable path (volume, /tmp)

## Detailed fix by platform

### Linux

1. 

```bash
dmesg -T | grep -iE 'remount|I/O error|EXT4-fs error' | tail
mount | grep ' ro,'
sudo mount -o remount,rw /
```


## How to diagnose

1. **Kernel log** — Errors before the remount?
2. **Disk health** — smartctl -a /dev/sda
3. **Intentional** — fstab/container settings

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/linux/read-only-file-system)
