怎样让linux(redhat)的机器启动的时候强制查盘

linux机器非正常关机后重起的时候
都会自动修一下盘
当让严重的错误(serious problems)的时候
系统会挂起
等你手工修盘
这时我们多是
fsck -y /
……
这种系统挂起对于机器大多是托管在idc的公司来说
是无法忍受的
因为他们根本就没有人守在idc
其实,redhat的机器有些特殊的启动开关可以解决这个问题
linux2.4的机器(redhat7.x、redhat8.0、redhat9、as3)
系统里有个开关/fsckoptions
启动的时候会读这里面的内容当作参数传给命令fsck
这样我们就可以通过
echo “-y” > /fsckoptions
chattr +i /fsckoptions

这样的话
重起及其时系统就会自动fsck -y /dev/xxx
这相当于我们收容输入fsck /dev/xxx
然后当系统保有问题时,输入”y”
也就是自动查盘
考虑到每次当机、启动时候都会删掉文件/fsckoptions
所以需要用chattr +i将其变成不能被删除的

此法不能用在linux2.6(fedora 2、fedora 3、fedora 4、as4等)环境下
因为linux2.6下的fsck程序不支持同时用参数-p -a
跟上面的道理相同
linux2.6下可以用另一个开关/forcefsck
touch /forcefsck
chattr +i /forcefsck

这样启动的时候就会fsck -f /dev/xxxx

这两个开关不影响在/etc/fstab里定义为启动时不fsck的分区

Discussion Area - Leave a Comment




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word