How to resolve file-system read-only error in Linux

A filesystem turns read-only when it encounters errors in the storage subsystem, or a code path which the filesystem code base should not have taken. Making the filesystem read-only is a safeguard feature that filesystems implement to avoid further damage because of the errors encountered.

This article explains the steps to resolve filesystem read-only issue in Linux.

Step1: Check the disk space usage.

Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       61796348 44194416  14439820  76% /

If the disk is running out of space, clear unwanted items and make free space. If there is enoguh space in the disk, proceed to the next step.

Step2: Run filesystem check.

#fsck /dev/vda1
fsck from util-linux 2.27.1
e2fsck 1.42.13 (17-May-2015)
DOROOT: clean, 289048/3932160 files, 11328157/15728640 blocks

If its showing any error, repair it fsck itself. If its showing no errors, proceed to the next step.

Step3: Check the disk UUID in mount configuration.

#ls -l /dev/disk/by-uuid/ | grep vda1
lrwxrwxrwx 1 root root 10 Oct 24 04:26 88f2ec31-89b7-4164-8fb8-c7736b549505 -> ../../vda1

#cat /etc/fstab
UUID=88f2ec31-89b7-4164-8fb8-c7736b549505 /  ext4  errors=remount-ro  0  1

If the UUID is not correct in the mount configuration, correct it and mount again. If the mount configuration is fine proceed to the next step.

Step4: If all the above things are showing fine, try remounting the drive using a correct identifier.

#mount -o remount,rw /dev/vda1 /

This should be worked and we need to update the same in mount configuration /etc/fstab.

/dev/vda1 /  ext4  errors=remount-ro  0  1

Step5: Reboot the server.

That's all…

Leave a Reply

Your email address will not be published. Required fields are marked *