How to make root filesystem readonly ?

General support questions
Post Reply
ranshalit
Posts: 49
Joined: 2015/12/28 17:01:59

How to make root filesystem readonly ?

Post by ranshalit » 2019/08/19 10:41:28

Hello,

I hope someone will have suggestion about the following issue:

I've been struggling for the last days in making centOS root filesystem read-only.
The solution I am familiar with for such requirement, is to use overlay with the root filesystem.
The thing is that I am not familiar with any centOS/dracut specific for the purpose.
The closest thing I got to is finding the following git:
https://github.com/gfleury/overlayroot
But although I gave it a lot of shots, it always gets me into emergency mode... :(

Does anyone have some idea about how to make rootfs readonly with CentOS 7 ?

Thank you very much!

Thraex
Posts: 51
Joined: 2019/05/14 19:50:28

Re: How to make root filesystem readonly ?

Post by Thraex » 2019/08/19 12:46:31

I did this by marking / as ro in /etc/fstab. Then in /etc/sysconfig/readonly-root, change READONLY=yes. Finally, if you have services that need to write to /var/log/servicename and are failing to start because they can't, add an entry for them in /etc/rwtab. The system I did this on was a minimal install with two services so it didn't need much more than that.

Post Reply