tune2fs功能说明:调整ext2/ext3/ext4文件系统参数 tune2fs命令可以调整或查看ext2/ext3/ext4文件系统的参数,比如可以调整Linux文件系统开机自检的周期。 参数选项 -c 设置强制自检的挂载次数,每挂载一次计数就会加1,超过次数就会强制自检。设置为0或-1则此功能关闭 -C 设置文件系统已经被挂载的次数 -i 设置强制自检的时间间隔(天、周、月) -j 将ext2文件系统转换为ext3类型的文件系统 -l 查看文件系统信息 范例:查看文件系统挂载信息 [root@cs6 ~]# tune2fs -l /dev/sda1|grep -i Mount Last mounted on: /boot #<==查看sda1设备即/boot分区的挂载次数。 Default mount options: user_xattr acl Last mount time: Sat May 11 07:27:26 2019 #<=示上次挂载时间。 Mount count: 8 #<==挂载的次数。 Maximum mount count: -1 #<==强制自检的挂载次数为-1,关闭自检功能。 [root@cs6 ~]# tune2fs -l /dev/sdb1|grep -i Mount Last mounted on: <not available> Default mount options: (none) Last mount time: Sat May 11 07:55:48 2019 Mount count: 1 Maximum mount count: -1 范例:设置挂载次数 [root@cs6 ~]# tune2fs -C 30 /dev/sdb1 #<==参数 -C 设置文件系统已经被挂载的决数。 tune2fs 1.41.12 (17-May-2010) Setting current mount count to 30 [root@cs6 ~]# tune2fs -l /dev/sdb1 |grep -i Mount Last mounted on: <not available> Default mount options: (none) Last mount time: Sat May 11 07:55:48 2019 Mount count: 30 Maximum mount count: -1 范例:设置强制自检的挂载次数 [root@cs6 ~]# tune2fs -c 40 /dev/sda1 tune2fs 1.41.12 (17-May-2010) Setting maximal mount count to 40 [root@cs6 ~]# tune2fs -l /dev/sda1| grep -i Mount Last mounted on: /boot Default mount options: user_xattr acl Last mount time: Sat May 11 07:27:26 2019 Mount count: 8 Maximum mount count: 40 [root@cs6 ~]# tune2fs -c -1 /dev/sda1 tune2fs 1.41.12 (17-May-2010) Setting maximal mount count to -1 [root@cs6 ~]# tune2fs -l /dev/sda1| grep -i Mount Last mounted on: /boot Default mount options: user_xattr acl Last mount time: Sat May 11 07:27:26 2019 Mount count: 8 Maximum mount count: -1 范例:设置强制自检的时间间隔 [root@cs6 ~]# tune2fs -l /dev/sda1 |grep -i check #<==查看检查周期。 Last checked: Sun May 5 23:10:27 2019 Check interval: 0 (<none>) #<==系统分区默认不检查。 [root@cs6 ~]# tune2fs -i 10 /dev/sda1 #<==参数 -i 设置每10天检查一次。 tune2fs 1.41.12 (17-May-2010) Setting interval between checks to 864000 seconds [root@cs6 ~]# tune2fs -l /dev/sda1|grep -i check Last checked: Sun May 5 23:10:27 2019 Check interval: 864000 (1 week, 3 days) #<==这里变成10天,864000秒。 Next check after: Wed May 15 23:10:27 2019 [root@cs6 ~]# tune2fs -i 0 /dev/sda1 #还原正常状态 tune2fs 1.41.12 (17-May-2010) Setting interval between checks to 0 seconds [root@cs6 ~]# tune2fs -l /dev/sda1|grep -i check Last checked: Sun May 5 23:10:27 2019 Check interval: 0 (<none>)