czfcentos |
Subversion Repositories: |
Compare with Previous - Blame - Download
#!/bin/bash
echo -n "Re-mounting root ... "
if mount / -noremount,ro; then
echo "done."
echo Root is now read-only.
exit 0
else
if [[ "$1" == "-f" ]]; then
echo Filesystem busy, forcing remount.
echo -n Locating data partitions ...
NODEV=`echo -v \`grep < /proc/filesystems nodev | awk '{print "^" $2 "|"}'\` | sed -e "s/ //g" -e "s/|$//g"`
RWFS=`awk < /proc/mounts "\\$4 ~ \"^rw\" { if (\\$1!=\"none\" && \\$2!=\"/\" && \\$3 !~ /$NODEV/) print \\$2}"`
echo " done."
echo -n Syncing filesystems ...
sync
echo " done."
echo $NODEV
echo $RWFS
echo "ahoj \n"
exit 0
echo -n Re-mounting everything read-only ...
echo u > /proc/sysrq-trigger
echo " done."
if [[ $RWFS ]]; then
echo -n Re-mounting data partitions read-write:
for FS in $RWFS; do
echo -n " [$FS]"
mount $FS -noremount,rw
done
echo " done."
fi
echo Root is now read-only.
exit 0
fi
echo Failed. If you\'re sure you know what are you doing, try \"mro -f\".
exit 1
fi