How I fixed read-only filesystem issue

1 min read

I met an unusual error after rebooting my VPS. I cannot do anything with editing files.

Read-only file system

Nginx does not start too because it need to write logs.

Found the answer on page How to fix "sudo: unable to open ... Read-only file system". This is the single one solution that helps to fix it temporary.

mount -o remount,rw /

But after reboot same issue is there.

Then we need to check /etc/fstab file to read the list of partitions to be mounted.

~# cat /etc/fstab /swapfile swap swap defaults 0 0

As you see there is only swap partition described. Need to add another one for the system root.

Use command blkid to get UUID of the root storage.

We need UUID for the /dev/sda1

And now you can add a new line to /etc/fstab file with target UUID.

# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=4f26e5a9-2966-4f08-8b4f-6872d5ee321f / ext4 errors=panic,barrier=1 0 1 /swapfile none swap sw 0 0

Save the file and reboot the system to check results.