How can I check a bunch of systems to find any filesystem that are mounted read-only? Possibly via a script?
|
|
An approach that works even for remote file systems (which can be mounted rw even if they're exported ro, resulting in a read only file system) is to simply create a test file on each file system and test the return code of that command. But if this is something that happens regularly you need to look into the cause rather than trying to keep up fixing the symptoms. |
|||
|
|
|
If you intent is to find filesystems with problems (i.e. the mounting status has been changed to READ-ONLY due to a filesystem error), then I'd do the following (assumming ext* filesystems):
EX:
What this does is panic the system, thus rebooting the server, possibly invoking a fsck on the problem filesystem to fix it. Thus a serious filesystem problem is handled by having the system fix it automatically, instead of dumping it into Read-ONLY mode which I have not found very helpful. Besides I'd rather panic a problem filesystem, fixing it than attempting to run with it damaged which as time goes on might cause more damage. |
||||
|
|
|
Just look for the |
|||||||
|
|
I've used the following in the past
In some instances you may want to skip any remote mounts which may be RO by design
You also may want to skip things that are mounted via automount
|
|||
|
|
|
||||