Linux tune2fs命令:显示和调整文件系统参数。
Linux tune2fs命令 功能描述
使用tune2fs命令可以查看和调整文件系统的参数。
Linux tune2fs命令 语法
tune2fs [选项] [设备]
命令中各选项的含义如表所示。
Linux tune2fs命令 示例
查看/dev/sda1设备的文件系统信息
[root@rhel ~]# tune2fs -l /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name: <none>
Last mounted on: /boot
Filesystem UUID: bec50cdd-090c-47ad-83d5-25328b4ab8ec
Filesystem magic number: 0xEF53
Filesystem revision#: 1(dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 25688
Block count: 102400
Reserved block count: 5120
Free blocks: 70259
Free inodes: 25650
First block: 1
Block size: 1024
Fragment size: 1024
Reserved GDT blocks: 256
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 1976
Inode blocks per group: 247
Flex block group size: 16
Filesystem created: Sun Aug 18 21:25:032013
Last mount time: Mon Aug 19 00:45:082013
Last write time: Mon Aug 19 00:45:082013
Mount count: 2
Maximum mount count: -1
Last checked: Sun Aug 18 21:25:032013
Check interval: 0(<none>)
Lifetime writes: 30 MB
Reserved blocks uid: 0(user root)
Reserved blocks gid: 0(group root)
First inode: 11
Inode size: 128
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: d66696fd-086f-4beb-87f0-924ac63fd65d
Journal backup: inode blocks
设置系统在达到时间间隔3天时自动检查磁盘分区/dev/sda1文件系统
[root@rhel ~]# tune2fs -i 3d /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting interval between checks to 259200 seconds
禁用按时间间隔自动检查磁盘分区/dev/sda1文件系统
[root@rhel ~]# tune2fs -i 0 /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting interval between checks to 0 seconds
设置强制检查磁盘分区/dev/sda1文件系统前文件系统可挂载的次数为100次
[root@rhel ~]# tune2fs -c 100 /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to 100
关闭磁盘分区/dev/sda1文件系统检查前的挂载次数限制
[root@rhel ~]# tune2fs -c 0 /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1
设置/dev/sda1设备保留块的百分比为15%
[root@rhel ~]# tune2fs -m 15 /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting reserved blocks percentage to 15% (15360 blocks)
设置/dev/sda1设备的卷标为boot
[root@rhel ~]# tune2fs -L boot /dev/sda1
tune2fs 1.41.12 (17-May-2010)
查看/dev/sda1分区的块大小
[root@rhel ~]# tune2fs -l /dev/sda1|grep ''Block size''
Block size: 1024
//可以看到/dev/sda1分区的块大小(Block size)为1024字节,也就是1KB
查看/dev/sda1分区的UUID
[root@rhel ~]# tune2fs -l /dev/sda1 |grep 'UUID'
Filesystem UUID: bec50cdd-090c-47ad-83d5-25328b4ab8ec