请问:如何取消硬盘挂载30次强行检查?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
tonytam
帖子: 485
注册时间: 2006-09-23 12:28

请问:如何取消硬盘挂载30次强行检查?

#1

帖子 tonytam » 2007-05-22 15:36

对于笔记本来说,开关机是家常菜,这30次也太强硬了吧?
_____
帖子: 207
注册时间: 2007-05-21 11:30

#2

帖子 _____ » 2007-05-22 15:37

把/etc/fstab每一行的最后两个数字都改成0就可以了

P.S. 强硬也是为了你好
头像
tonytam
帖子: 485
注册时间: 2006-09-23 12:28

#3

帖子 tonytam » 2007-05-22 15:49

谢谢,指导飞速。
jimmin
帖子: 2138
注册时间: 2006-09-24 4:37

#4

帖子 jimmin » 2007-05-22 17:03

如果嫌30次太频繁了,可以改大一点,比如100次。

代码: 全选

sudo tune2fs -c 100
不推荐关掉检查。
_____
帖子: 207
注册时间: 2007-05-21 11:30

#5

帖子 _____ » 2007-05-22 17:08

jimmin 写了:如果嫌30次太频繁了,可以改大一点,比如100次。

代码: 全选

sudo tune2fs -c 100
不推荐关掉检查。
:em25
jimmin
帖子: 2138
注册时间: 2006-09-24 4:37

#6

帖子 jimmin » 2007-05-22 17:27

详细的用法如下:

代码: 全选

tune2fs--调整ext2/ext3文件系统特性的工具。
-l <device> 查看文件系统信息
-c <count> 设置强制自检的挂载次数
-i <nday> 设置强制自检的时间间隔
-m <percentage> 保留块的百分比
-j 将ext2文件系统转换为ext3类型的文件系统

ext2文件系统不具备日志功能。将ext3文件系统转换为ext3类型就能为服务器增加日志功能,对于老的服务器,用了很久的服务器来说,这是一个非常有用的功能。它可以防止因为断电,异常关机,数据丢失;或者是长时间的自检。

# tune2fs -l /dev/sdb1
# mount /dev/sdb1 /mnt/d1
# tune2fs -l /dev/sdb1
查看 mount count 挂载次数
Maximum mount count 最大挂载次数。达到最大挂载次数后,再次开机时就会强制自检。

使用tune2fs -c 参数修改强制自检次数
# tune2fs -c 2 /dev/sdb1
# tune2fs -l /dev/sdb1 |grep -i "mount count"
# tune2fs -l /dev/sdb1 |grep -i "mount count"
# umount /mnt/d1
# mount /dev/sdb1 /mnt/d1
# tune2fs -l /dev/sdb1 |grep -i "mount count"
此时这个 sdb1 已经达到了最大挂载次数2。此时,如果重启计算机,这个设备肯定会强制自检的。
# umount /mnt/d1
# mount /dev/sdb1 /mnt/d1
# tune2fs -l /dev/sdb1 |grep -i "mount count"
# tune2fs -c -1 /dev/sdb1 #使用负值设置某一设备永远不要自检。

-i check interval 系统自检间隔时间
默认系统自检时间为6个月。如果不希望它自检。可以改为0或-1,如果想每天自检一次,可以改为2 。
# tune2fs -c -1 -i -1 /dev/sdb1

如果需要自检可以使用手动的自检。fsck工具。

>居中<文件系统检查工具

fsck--检查文件系统数据完整性的工具。
用法一:fsck -t ext2 /dev/sdb1
用法二:fsck.ext2 /dev/sdb1
e2fsck:检查ext2/ext3文件系统的工具
(注意:这个e2fsck有很多的危险性。有不少同学反映使用这个工具会对文件系统造成一定的破坏。特别是同时使用ext2和ext3文件系统时。它在自动识别的时候会产生一定的误差,所以它非常的危险。不要使用.)
以后使用fsck工具。fsck工具有两种用法,类似于mkfs。一种是fsck -t 后面跟一个类型。还有一种就是fsck后用.连接文件系统类型,后面跟一个设备。它主要是检查文件是否有错误,是否有数据不完整的错误节点。它会帮你自动修复文件系统上的错误。
<注意:fsck不要用错参数>
# fsck.ext2 /dev/sdb1
# fsck.ext3 /dev/sdb4
/etc/fstab文件中,在挂载选项后面的最后 一位有1或者2都是开机自检的。一些设备长期不自检也是不好的。根分区是第一个被自检的,所以标为1。
# df
# mkfs.ext2 /dev/sdb1 使用ext2文件系统格式化/dev/sdb1
# mkfs -t ext3 /dev/sdb4
# fsck -t ext3 /dev/sdb1
# fsck.ext3 -y /dev/sdb4 自动修复sdb4上的文件系统错误。-y表示yes的意思。
dajian0509
帖子: 397
注册时间: 2006-10-13 18:53
来自: 湖南农业大学

#7

帖子 dajian0509 » 2007-05-22 17:49

楼上的解释正解啊
点子上了 !
头像
ipv6now
帖子: 759
注册时间: 2006-09-30 1:08
来自: QingDao
联系:

#8

帖子 ipv6now » 2007-05-22 18:10

Ubuntu forces drives to be checked once for every 30 times the filesystem is mounted. This means that on an average, once every 30 times you bootup your computer, the filesystem integrity is checked. This is very reasonable for a desktop, which is seldom rebooted. However, for a laptop, this means pain, since you may be planning on making a presentation, and Ubuntu may start a filesystem check just when you hook up your laptop to the projector and bootup! Today we will see how to disable (or force) the checking temporarily, and also how to adjust the period and frequency of the check.

To disable filesystem integrity check for the next bootup, create a file called /fastboot. So a
$sudo touch /fastboot
will disable filesystem check for the next time you bootup. Since the /fastboot file is removed during bootup, this will disable filesystem check only once - for the one time you bootup after you create the /fastboot file (which need not have anything in it — hence the touch, which only creates the file)
On the contrary to force a filesystem check the next time you bootup, create a file called /forcefsck by doing
$sudo touch /forcefsck

Now, on to the more interesting business of how to change the number of bootups between filesystem checks, and modifying the period with which the filesystem is checked. The following applies to ext2 and ext3 filesystems.

tune2fs is an utility that you can use to change both the number of bootups between filesystem checks, and the number of days/weeks/months between filesystem checks.

For example to have the filesystem checked once every 60 bootups use
$sudo tune2fs -c 60

To have the filesystem check run periodically, say once a week, use
$sudo tune2fs -i 1w
changing the “w” to “d” or “m” will have the check run once daily and once monthly - you get the idea.

As always, you can read
$man tune2fs
for more detailed information and examples.
头像
PL7s
帖子: 377
注册时间: 2007-03-15 23:44

#9

帖子 PL7s » 2007-05-22 18:14

其他分区建议改成0,系统分区还是保留检查比较好。
For the love of PL7s
图片
图片
头像
ipv6now
帖子: 759
注册时间: 2006-09-30 1:08
来自: QingDao
联系:

#10

帖子 ipv6now » 2007-05-22 18:19

reiser的怎么让它隔一段时间检查一次?
头像
forrid
帖子: 659
注册时间: 2007-04-23 17:40

#11

帖子 forrid » 2007-05-22 19:37

reiser的不用检查?
头像
tommy007
帖子: 1352
注册时间: 2007-02-18 0:42

#12

帖子 tommy007 » 2007-05-22 20:34

貌似只检查ext3
xfs也不检查
头像
stlxv
论坛版主
帖子: 8275
注册时间: 2006-05-03 0:39
来自: المريخ

#13

帖子 stlxv » 2007-05-22 22:17

:shock:
PHP是最好的语言!不服来战!
头像
ipv6now
帖子: 759
注册时间: 2006-09-30 1:08
来自: QingDao
联系:

#14

帖子 ipv6now » 2007-05-22 22:23

我的reiser是检查的啊,不过检查比较快.前天改了一下fstab,不让它检查了,后来断了几次电,变得启动超慢,就又改回来了,查出来一堆错误
回复