For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt, and this page is available as Markdown at https://docs.us.ovhcloud.com/en/hosted-private-cloud/vmware/how-avoid-disk-read-only-switch-linux.md.
  • English

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

View as Markdown

Occasionally, as a result of a storage-related event, some partitions on a Linux machine may become read-only. In this article, we will explain how to correct this status and reduce the risks of a switch.

 

Instructions

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 VM 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. 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 startup, you can put this command in the following file:

$ 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

Browse all the VMware on OVHcloud guides.

Browse the rest of the OVHcloud US documentation for guides on our other products and services.

Learn more about VMware on OVHcloud on the OVHcloud US website.