> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Fix "Read-only file system" Errors on Linux

> Fix "Read-only file system" on Linux: check dmesg for disk errors, back up, run fsck from rescue mode, or remount with mount -o remount,rw / if set on purpose.

"Read-only file system" means Linux refuses to write to that filesystem. Usually the kernel switched it to read-only after detecting disk or filesystem errors, to stop further damage. Check with `findmnt -no OPTIONS /` and `sudo dmesg | grep -iE 'error|read-only'`. If errors show, back up first, then repair with `fsck` from rescue mode. If it was mounted read-only on purpose, `sudo mount -o remount,rw /` makes it writable again.

```text theme={null}
touch: cannot touch 'test.txt': Read-only file system
EXT4-fs (vda1): Remounting filesystem read-only
```

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 10 to 30 minutes | Ubuntu 22.04 / 24.04, Debian 12 / 13, AlmaLinux and Rocky Linux 9 / 10 | Root or sudo, rescue mode for repairs |

## Before you start

* While the filesystem is read-only, logs, databases and package updates can't write. Don't keep restarting services: find the cause first.
* If the cause is disk errors, copy important data off **before** you try any fix. A read-only filesystem can still be read.
* Commands use `sudo`. As root, leave it out.

## Step 1: Confirm which filesystem is read-only

```bash theme={null}
findmnt -no TARGET,SOURCE,OPTIONS /
```

```text theme={null}
/  /dev/vda1  ro,relatime,errors=remount-ro
```

`ro` at the start of the options confirms it. Replace `/` with the folder that fails (for example `/var` or `/data`) if it's a separate mount.

## Cause 1: The kernel found errors and protected the disk

On Ubuntu and Debian, the root filesystem is usually mounted with `errors=remount-ro`: when ext4 finds an inconsistency, it switches to read-only instead of carrying on. A crash, a forced power-off or a failing disk can trigger it.

**Check:**

```bash theme={null}
sudo dmesg -T | grep -iE 'ext4-fs error|i/o error|remounting|xfs'
```

Lines such as `EXT4-fs error (device vda1)` or `I/O error, dev vda` confirm it. On XFS (AlmaLinux and Rocky), the filesystem shuts down instead, and writes fail with `Input/output error`.

**Fix:**

**1. Back up what you need**

Copy databases and files to another machine while you still can read them, for example with [rsync](https://help.freakhosting.com/portals/other/how-to-copy-files-with-scp-and-rsync.md). Nothing can be saved on the read-only disk itself, so send copies straight to the other machine.

**2. Repair from rescue mode**

Start [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md), find the disk with `lsblk -f`, and repair it **without mounting it**:

> [tab] ext4 (Ubuntu / Debian)
>
> ```bash theme={null}
> e2fsck -f -y /dev/vda1
> ```

> [tab] XFS (AlmaLinux / Rocky)
>
> ```bash theme={null}
> xfs_repair /dev/vda1
> ```

Use the device name from `lsblk`.

**3. Boot normally**

End the rescue session and check the options again with `findmnt -no OPTIONS /`.

> [!WARNING]
>
> Don't run `e2fsck` or `xfs_repair` on a mounted filesystem, and don't force it writable with `mount -o remount,rw` while disk errors are still appearing. Both can turn a repairable fault into lost data.

If the errors come back after a repair, the storage itself may be failing. On a VPS, [open a ticket](https://freakhosting.com/clientarea/submitticket.php) with the `dmesg` lines. On a dedicated server, check the drives with [smartctl](https://help.freakhosting.com/portals/other/how-to-check-disk-health-with-smartctl.md) and open a ticket.

## Cause 2: It was mounted read-only on purpose

Someone (or a script) mounted it with `ro`, or `/etc/fstab` says so. `dmesg` then shows no errors.

**Check:**

```bash theme={null}
grep -v '^#' /etc/fstab
```

Look for `ro` in the options column of the affected mount.

**Fix:** remount it writable now:

```bash theme={null}
sudo mount -o remount,rw /
```

To make it permanent, change `ro` to `defaults` (or remove `ro`) in `/etc/fstab`, then run `sudo findmnt --verify`.

## Cause 3: Only one service sees it read-only

If the shell can write but a service logs `Read-only file system`, systemd's sandboxing is the likely reason. Units with `ProtectSystem=strict` (or `full`) see `/usr`, `/etc` or the whole system as read-only.

**Check:**

```bash theme={null}
systemctl show myapp -p ProtectSystem -p ReadWritePaths
```

**Fix:** allow the folders the service really needs:

```bash theme={null}
sudo systemctl edit myapp
```

```ini theme={null}
[Service]
ReadWritePaths=/var/lib/myapp /var/log/myapp
```

Then run `sudo systemctl restart myapp`. In Docker, the same error means a volume is mounted with `:ro` or the container uses `--read-only`.

## How to check it worked

```bash theme={null}
touch /tmp/rw-test && sudo touch /rw-test && sudo rm /rw-test && echo writable
```

```text theme={null}
writable
```

## Frequently asked questions

### Will a reboot fix it?

A reboot runs the automatic check, which fixes small problems, so the server may come back writable. If the errors were serious, it can stop at boot instead: see [Linux server won't boot](https://help.freakhosting.com/portals/other/how-to-fix-a-linux-server-that-wont-boot.md). Back up before you reboot.

### Is "Read-only file system" the same as "Permission denied"?

No. "Permission denied" is about your user's rights on one file. "Read-only file system" blocks everyone, root included.

### Can a full disk cause this?

No. A full disk gives [No space left on device](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md). Read-only is a mount state.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Linux server won't boot](https://help.freakhosting.com/portals/other/how-to-fix-a-linux-server-that-wont-boot.md)
>
> Emergency mode and fsck at boot.

> [card] [Check disk health](https://help.freakhosting.com/portals/other/how-to-check-disk-health-with-smartctl.md)
>
> SMART checks on dedicated servers.

> [card] [Back up a Linux server](https://help.freakhosting.com/portals/other/how-to-back-up-a-linux-server.md)
>
> Get your data off safely.

> [card] [No space left on device](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md)
>
> The other common write error.

***

> [!NOTE]
>
> **Checked against the official [ext4 kernel documentation](https://docs.kernel.org/admin-guide/ext4.html) (`errors=` mount option), the [mount](https://man7.org/linux/man-pages/man8/mount.8.html), [e2fsck](https://man7.org/linux/man-pages/man8/e2fsck.8.html) and [xfs\_repair](https://man7.org/linux/man-pages/man8/xfs_repair.8.html) manuals and the systemd [systemd.exec manual](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html)** on 4 November 2026; the read-only error, `findmnt` output, `mount -o remount,rw` and offline `e2fsck` / `xfs_repair` runs were tested on loop-device filesystems on Ubuntu 24.04 LTS. The systemd sandbox fix was not tested.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.