Avoiding the read-only switch of your VM disk on Linux

Find out how to avoid read-only switching on your Linux VM disk

Last updated 25th June 2020


Occasionally, as a result of a storage-related event, some partitions on a Linux machine may become read-only.

This guide explains how to correct this status and reduce the risks of a switch.


When partitions are read-only, writing to the file system is no longer possible.

>     $ touch test
>     touch: cannot touch 'test': Read-only file system

The file system status can be confirmed using the mount command:

> $ mount
> **/dev/sda1 on / type ext3 (ro,errors=remount-ro)**
> tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
> proc on /proc type proc (rw,noexec,nosuid,nodev)
> sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
> procbususb on /proc/bus/usb type usbfs (rw)
> udev on /dev type tmpfs (rw,mode=0755)
> tmpfs on /dev/shm type tmpfs  (rw,nosuid,nodev)
> devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)

To restore / to read-write, the virtual machine must be restarted.

Workaround solution

By default, the timeout of SCSI devices is 30 seconds on Linux.

VMware Tools can increase this time to 180 seconds.

It is recommended to set the timeout to 3600 seconds. Using the following command will execute this for the current session.

>     $ echo 3600 > /sys/block/`basename /dev/sda`/device/timeout

To set this value at the VM's start-up:

>   $ nano /etc/rc.local 

    #!/bin/sh -e
    # rc.local
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other value on error.
    # In order to enable or disable this script just change the execution
    # bits.
    # By default this script does nothing.

    echo 3600 > /sys/block/`basename /dev/sda`/device/timeout
    exit 0

Go further

Join our community of users on https://community.ovh.com/en/.

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices exclude VAT. VAT may vary according to the customer's country of residence.