linux tune2fs命令详解

一.简介:

tune2fs是调整和查看ext2/ext3文件系统的文件系统参数,Windows下面如果出现意外断电死机情况,下次开机一般都会出现系统自检。Linux系统下面也有文件系统自检,而且是可以通过tune2fs命令,自行定义自检周期及方式。

二.用法:

Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-g group]

        [-i interval[d|m|w]] [-j] [-J journal_options] [-l]

        [-m reserved_blocks_percent] [-o [^]mount_options[,...]] 

        [-r reserved_blocks_count] [-u user] [-C mount_count] [-L volume_label]

        [-M last_mounted_dir] [-O [^]feature[,...]]

        [-E extended-option[,...]] [-T last_check_time] [-U UUID]

        [ -I new_inode_size ] device

 

常用选项说明:
-l 查看文件系统信息
-c max-mount-counts 设置强制自检的挂载次数,如果开启,每挂载一次mount conut就会加1,超过次数就会强制自检
-i interval-between-checks[d|m|w] 设置强制自检的时间间隔[d天m月w周]
-m reserved-blocks-percentage 保留块的百分比
-j 将ext2文件系统转换为ext3类型的文件系统
-L volume-label 类似e2label的功能,可以修改文件系统的标签
-r reserved-blocks-count 调整系统保留空间
-o [^]mount-option[,...] Set or clear the indicated default mount options in the filesystem. 设置或清除默认挂载的文件系统选项

三.例如:

tune2fs -c 30 /dev/hda1 设置强制检查前文件系统可以挂载的次数
tune2fs -c -l /dev/hda1 关闭强制检查挂载次数限制。
tune2fs -i 10 /dev/hda1 10天后检查
tune2fs -i 1d /dev/hda1 1天后检查
tune2fs -i 3w /dev/hda1 3周后检查
tune2fs -i 6m /dev/hda1 半年后检查
tune2fs -i 0 /dev/hda1 禁用时间检查

tune2fs -j /dev/hda1 添加日志功能,将ext2转换成ext3文件系统

tune2fs -r 40000 /dev/hda1 调整/dev/hda1分区的保留空间为40000个磁盘块

tune2fs -o acl,user_xattr /dev/hda1 设置/dev/hda1挂载选项,启用Posix Access Control Lists和用户指定的扩展属性

开机取消自检:

tune2fs -l /dev/sdb1 | grep -E ‘Maximum mount count:|Check interval’
tune2fs -i 0 -c 0 /dev/sdb1

 

[email protected]:~$ tune2fs -l /dev/sda4

tune2fs 1.41.12 (17-May-2010)

Filesystem volume name:   <none>

Last mounted on:          <not available>

Filesystem UUID:          0db8fb3c-b919-4438-81ea-3b82aa9b1ef3

Filesystem magic number:  0xEF53

Filesystem revision #:    1 (dynamic)

Filesystem features:      has_journal filetype needs_recovery sparse_super

Filesystem flags:         signed_directory_hash 

Default mount options:    (none)

Filesystem state:         clean

Errors behavior:          Continue

Filesystem OS type:       Linux

Inode count:              32358400

Block count:              64713472

Reserved block count:     3235673

Free blocks:              63665256

Free inodes:              32358385

First block:              0

Block size:               4096(单位为byte)

Fragment size:            4096

Blocks per group:         32768

Fragments per group:      32768

Inodes per group:         16384

Inode blocks per group:   512

Filesystem created:       Fri Aug 29 21:29:02 2014

Last mount time:          Fri Aug 29 13:58:48 2014

Last write time:          Fri Aug 29 13:58:48 2014

Mount count:              3

Maximum mount count:      32

Last checked:             Fri Aug 29 21:29:02 2014

Check interval:           15552000 (6 months)

Next check after:         Wed Feb 25 21:29:02 2015

Reserved blocks uid:      0 (user root)

Reserved blocks gid:      0 (group root)

First inode:              11

Inode size:               128

Journal inode:            8

First orphan inode:       9912479

Default directory hash:   tea

Directory Hash Seed:      93afb278-d55c-4b62-814c-7908c3264b55

Journal backup:           inode blocks 

 

转载:http://blog.chinaunix.net/uid-7530389-id-2050094.html

猜你喜欢

转载自daizj.iteye.com/blog/2203097