There are different ways to mount / remount the file system as readonly. Here are few simple steps which might be helpful if you want to remount your filesystem/partition as readonly. This is especially useful if you want to run fsck on a selective partition for example /home , /var etc from init 3 runlevel.
- # mount -o remount,ro /
- # mount -o remount,ro /dev/sdaX /
The above command will remount the / root file system as read-only where sdaX is the partiton number. If you want to remount only your /home or /var mounted on a seperate partion. Just use
- # mount -o remount,ro /home
- # mount -o remount,ro /dev/sdaX /home
To remount it back to read-write. Try
- # mount -o remount,rw /
You can also use the sysrq-trigger magic key under /proc to remount all the mounted filesystems as readonly. To do that, just use
- # echo u > /proc/sysrq-trigger
This will remount all the mounted filesystem in your system to read-only.