Results 1 to 4 of 4
Hi,
I am pretty new to linux and have been asked to write a script that will check all filesystems to see if they are read-only.
I have come up ...
- 07-06-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 3
Help with script to check if a filesystem is read-only
Hi,
I am pretty new to linux and have been asked to write a script that will check all filesystems to see if they are read-only.
I have come up with ...
df -h > /tmp/mount.lst
awk '{print $6}' /tmp/mount.lst > /tmp/mounted_systems.lst
This gives me ..
Mounted
/
/boot
/dev/shm
/proc
So now I have ..
How do I automatically get rid of the 'Mounted' header in my /tmp/mounted_systems.lst file ?
Also, I don't want to check the /proc filesystem, so how do I remove that within the script too.
Then I will run ...
while read dir
do
touch $dir/read_only_test
done < /tmp/mounted_systems.lst
If the filesystem is read only, I want that filesystem name to be listed into another file.
Apologies if I am asking too much !
Cheers
- 07-06-2010 #2
instead of creating a test file, the information you are looking for would be found in just mount command
- 07-06-2010 #3Just Joined!
- Join Date
- Jul 2010
- Posts
- 3
Ahh, better !
What error would the mount command give if a file system was read only ?
Cheers
- 07-06-2010 #4
mount command shouldn't throw error, it should only list information about mounted filesystems, I believe the keys you would be looking for would be rw, for writeable, and ro for readonly


Reply With Quote