• Linux学习-42-查看文件系统信息dumpe2fs命令用法


    10.9 dumpe2fs命令:查看文件系统信息
    • 了解文件系统之后,我们可以使用dumpe2fs 显示ext2、ext3、ext4文件系统的超级快和块组信息。此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、SUSE、openSUSE、Fedora。,此命令的基本格式如下:
    [root@CncLucZK ~]# dumpe2fs [ -bfhixV ]  [ -o superblock=superblock ]  [ -o blocksize=blocksize ]  device
    
    • 1
    • 选项列表
    选项说明
    -b显示文件系统中保留的损坏块
    -o superblock=superblock检查文件系统时,使用指定大小的超级块。此选项通常不需要,除非文件系统向导正在检查严重损坏的文件系统的剩余部分。
    -o blocksize=blocksize检查文件系统时,指定块大小。此选项通常不需要,除非文件系统向导正在检查严重损坏的文件系统的剩余部分。
    -f强制执行
    -h只显示superblock(超级块)信息,而不显示任何块组描述符详细信息
    -i显示从e2image获得的文件系统信息,使用设备作为image文件的路径名。
    -x以十六进制显示文件系统信息
    -V显示命令版本信息,并且退出
    • 例如,通过 df 命令找到根目录硬盘的文件名,然后使用 dump2fs 命令观察文件系统的详细信息,执行命令如下:
    [root@CncLucZK test]# df					#查看目前挂载的装置
    Filesystem     1K-blocks    Used Available Use% Mounted on
    devtmpfs          923060       0    923060   0% /dev
    tmpfs             936488      40    936448   1% /dev/shm
    tmpfs             936488     420    936068   1% /run
    tmpfs             936488       0    936488   0% /sys/fs/cgroup
    /dev/vda1       51539404 8826008  40516152  18% /
    tmpfs             187296       0    187296   0% /run/user/0
    
    #devtmpfs 、tmpfs 、这些是硬盘的驱动程序  , /dev/vdal 是第一个分区,它的后面放了一个/boot是Linux的启动文件 .
    
    [root@CncLucZK test]# dumpe2fs /dev/vda1
    dumpe2fs 1.45.6 (20-Mar-2020)
    Filesystem volume name:   					#文件系统的名称
    Last mounted on:          /
    Filesystem UUID:          659e6f89-71fa-463d-842e-ccdf2c06e0fe
    Filesystem magic number:  0xEF53
    Filesystem revision #:    1 (dynamic)
    Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
    Filesystem flags:         signed_directory_hash 
    Default mount options:    user_xattr acl			#默认挂载的参数
    Filesystem state:         clean						#系统状态,健康
    Errors behavior:          Continue
    Filesystem OS type:       Linux
    Inode count:              3276800					#Inode总数
    Block count:              13106939					#Block总数
    Reserved block count:     545215					#保留Block数
    Free blocks:              10697434					#剩余可用blocks数
    Free inodes:              3180547					#剩余可用inodes数
    First block:              0
    Block size:               4096						#Block大小
    Fragment size:            4096						#碎片大小
    Group descriptor size:    64						#组描述符大小
    Reserved GDT blocks:      1017
    Blocks per group:         32768
    Fragments per group:      32768
    Inodes per group:         8192
    Inode blocks per group:   512
    Flex block group size:    16
    Filesystem created:       Tue Nov 26 10:11:35 2019
    Last mount time:          Wed Oct 19 13:29:59 2022
    Last write time:          Wed Oct 19 13:29:56 2022
    Mount count:              35
    Maximum mount count:      -1
    Last checked:             Tue Nov 26 10:11:35 2019
    Check interval:           0 ()
    Lifetime writes:          1335 GB
    Reserved blocks uid:      0 (user root)
    Reserved blocks gid:      0 (group root)
    First inode:              11
    Inode size:	          256
    Required extra isize:     32
    Desired extra isize:      32
    Journal inode:            8
    First orphan inode:       398263
    Default directory hash:   half_md4
    Directory Hash Seed:      d8b26e9a-4700-4c2b-8265-e64b94a85bfe
    Journal backup:           inode blocks
    Checksum type:            crc32c
    Checksum:                 0x519e5865
    Journal features:         journal_incompat_revoke journal_64bit journal_checksum_v3
    Journal size:             64M
    Journal length:           16384
    Journal sequence:         0x00abc5b6
    Journal start:            2066
    Journal checksum type:    crc32c
    Journal checksum:         0xaa299391
    
    
    Group 0: (Blocks 0-32767) csum 0x925e [ITABLE_ZEROED]		#第一个 data group 内容, 包含 block 的启始/结束号码
      Primary superblock at 0, Group descriptors at 1-7			#超级区块在 0 号 block
      Reserved GDT blocks at 8-1024
      Block bitmap at 1025 (+1025), csum 0x0aff0158
      Inode bitmap at 1041 (+1041), csum 0xd8b64b84
      Inode table at 1057-1568 (+1057)							#inode table 所在的 block
      20474 free blocks, 259 free inodes, 1889 directories		
      Free blocks: 10960-11035, 12362-12511, 12520-32767		#剩余未使用的 block 号码
      #剩余未使用的 inode 号码
      Free inodes: 1645, 5456-5664, 7507, 7509-7510, 7512, 7514, 7516-7554, 8062, 8080-8083
    Group 1: (Blocks 32768-65535) csum 0xe744 [ITABLE_ZEROED]	
      Backup superblock at 32768, Group descriptors at 32769-32775
      Reserved GDT blocks at 32776-33792
      Block bitmap at 1026 (bg #0 + 1026), csum 0xc9157de1
      Inode bitmap at 1042 (bg #0 + 1042), csum 0x6cc48e9f
      Inode table at 1569-2080 (bg #0 + 1569)
      1 free blocks, 2825 free inodes, 1121 directories, 842 unused inodes
      Free blocks: 60080
      Free inodes: 8361-8368, 13523, 13528-13529, 13531, 13559-13908, 13911-14889, 14891-14902, 14907, 14910, 14912-14919, 14923-16384
    ...剩余输出信息都是data group 内容
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90

    使用 dumpe2fs 命令可以查询到非常多的信息,以上信息大致可分为 2 部分。前半部分显示的是超级块的信息,包括文件系统名称、已使用以及未使用的 inode 和 block 的数量、每个 block 和 inode 的大小,文件系统的挂载时间等。

    • 另外,Linux 文件系统(EXT 系列)在格式化的时候,会分为多个区块群组(block group),每 个区块群组都有独立的 inode/block/superblock 系统。此命令输出结果的后半部分,就是每个区块群组的详细信息(如 Group0、Group1)。

    参考文献:
    Linux dumpe2fs命令:查看文件系统信息
    Linux 磁盘管理

    下一篇:Linux学习-43-挂载Linux系统外的文件mount和卸载文件系统umount命令用法
  • 相关阅读:
    【2023年新版】40套BIM+GIS项目案例合集,中建中铁中交企业内部学习资源免费领取
    【ArcGIS Pro二次开发】(66):三调规程_土地利用现状分类面积汇总表
    【车载开发系列】UDS诊断服务入门知识
    SpringBoot OAuth2.0认证管理流程详解
    激活函数曲线图
    面试经典150题——Day6
    知识图谱(5)知识表示
    ubuntu2204任务栏显示cpu 网速信息
    流量再利用!佳信客服准备的企微拉新复购攻略来袭!
    此次519暴跌的几点感触 2021-05-21
  • 原文地址:https://blog.csdn.net/weixin_42045639/article/details/127895803