呃,最近发现ubuntu每次开机特慢,然后看了下发现每次开机都会进行磁盘自检,那得想法解决啊
一、cat /etc/fstab的结果
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda8 during installation
UUID=72cb59c6-2fd9-4c92-aee9-4c10c18d6bec / ext2 errors=remount-ro 0 1
# swap was on /dev/sda7 during installation
UUID=dbc7ceea-29b6-46b7-85a3-de432f2db78c none swap sw 0 0
二、对上述结果的解释
上述结果中,ext2最后一列的1表示这个/dev/sda8会开机自检,如果想让ubuntu开机永不自检,那就直接把最后的1改为0就可以了。
三、想开机自检,但不要每次都开机自检
一般linux设置的是磁盘达到如下两个条件的任何一个条件就自检
1、条件1
磁盘挂载30次
2、条件2
磁盘自检间隔:默认好像是6个月
3、如何查看这两个条件
用命令tune2fs -l /dev/sda8
结果如下
tune2fs 1.42 (29-Nov-2011)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 72cb59c6-2fd9-4c92-aee9-4c10c18d6bec
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr filetype sparse_super
Default mount options: (none)
Filesystem state: not clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 3662848
Block count: 7323624
Reserved block count: 366181
Free blocks: 5061782
Free inodes: 3369973
First block: 0
Block size: 4096
Fragment size: 4096
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 16352
Inode blocks per group: 511
Last mount time: Thu Nov 21 20:21:18 2013
Last write time: Sun Nov 24 16:26:19 2013
Mount count: 2
Maximum mount count: 30
Last checked: Sun Nov 24 15:43:57 2013
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
在上述结果中可以看到,我的电脑的条件1(Maximum mount count)为30次,条件2(Check interval)为0
所以我的电脑每次都会开机自检,更改条件2为6个月自检一次,更改命令如下
tune2fs -i 6m /dev/sda8
更改后的结果
Check interval: 15552000 (6 months)
好了,ok