EXT4文件系统学习(二)dumpe2fs查看ext4文件系统超级块信息数据

编译dumpe2fs工具

   Linux系统有此工具软件可直接使用, 如果没有可选择自己手动编译,下面介绍编译ARM开发板的dumpe2fs工具:

下载

    git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git

[wang@localhost tmp]$ git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
正克隆到 'e2fsprogs'...
remote: Counting objects: 51158, done.
remote: Compressing objects: 100% (277/277), done.
remote: Total 51158 (delta 142), reused 0 (delta 0)
接收对象中: 100% (51158/51158), 26.34 MiB | 349.00 KiB/s, done.
处理 delta 中: 100% (40835/40835), done.

编译

    配置为交叉工具链,编译为ARM目标平台,且链接静态库;

[wang@localhost tmp]$ cd e2fsprogs/
[wang@localhost e2fsprogs]$ mkdir build
[wang@localhost e2fsprogs]$ cd build/
[wang@localhost build]$ ../configure --host=arm-linux --prefix=$PWD CC=openwrt/staging_dir/toolchain-arm64_gcc-orionis/usr/bin/aarch64-buildroot-linux-gnu-gcc LDFLAGS=-static

    没有提示错误就运行命令make开始编译,编译完成后安装sudo make install,安装完成后可见工具如下:

[wang@localhost build]$ ls sbin/
badblocks  debugfs   e2freefrag  e2image  e2mmpstatus  e2scrub_all  e4crypt   filefrag  fsck       fsck.ext3  logsave  mkfs.ext2  mkfs.ext4     resize2fs  uuidd
blkid      dumpe2fs  e2fsck      e2label  e2scrub      e2undo       e4defrag  findfs    fsck.ext2  fsck.ext4  mke2fs   mkfs.ext3  mklost+found  tune2fs
[wang@localhost build]$ file sbin/dumpe2fs 
sbin/dumpe2fs: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, for GNU/Linux 3.7.0, not stripped

打印ext4文件系统信息

    刚格式化完没有写文件,使用命令dumpe2fs:

#dumpe2fs /dev/loop0 	【-h不打印Group信息】

dumpe2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   <none>
Last mounted on:          <not available>    最后挂载目录
Filesystem UUID:          cef5f647-058f-49bd-88c6-baf3ce2338a0
Filesystem magic number:  0xEF53    ext4文件系统标志
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit 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		文件系统inode号总数,由系统决定但可以指定比例
Block count:              102400	文件系统block总数,==容量/默认的1KB
Reserved block count:     5120		保留的block总数,默认比例为5%
Free blocks:              93504		空闲的block总数,
Free inodes:              25677		空闲的inode总数
First block:              1             第一个block号
Block size:               1024          block大小
Fragment size:            1024      
Group descriptor size:    64            块组描述大小
Reserved GDT blocks:      256           预留块组描述block数量
Blocks per group:         8192          块组中block数量
Fragments per group:      8192    
Inodes per group:         1976		块组中inode数量==25688/13
Inode blocks per group:   247		块组中inode占用block总数
Flex block group size:    16		inode表大小?
Filesystem created:       Tue Nov 27 13:26:27 2018
Last mount time:          Tue Nov 27 13:28:39 2018
Last write time:          Tue Nov 27 13:28:39 2018
Mount count:              1             挂载次数
Maximum mount count:      -1
Last checked:             Tue Nov 27 13:26:27 2018
Check interval:           0 (<none>)
Lifetime writes:          4447 kB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11            文件系统的第一个inode号
Inode size:	          	  128            inode大小
Journal inode:            8             日志文件inode号
Default directory hash:   half_md4
Directory Hash Seed:      45d2f9d4-714a-4ccf-9c9d-308d12552317
Journal backup:           inode blocks
Journal features:         journal_64bit
日志大小:             	  4096k
Journal length:           4096
Journal sequence:         0x00000002
Journal start:            1


Group 0: (Blocks 1-8192) [ITABLE_ZEROED]
  Checksum 0x0229, unused inodes 1965
  主 superblock at 1, Group descriptors at 2-2
  保留的GDT块位于 3-258
  Block bitmap at 259 (+258), Inode bitmap at 275 (+274)
  Inode表位于 291-537 (+290)
  4683 free blocks, 1965 free inodes, 2 directories, 1965个未使用的inodes
  可用块数: 3510-8192
  可用inode数: 12-1976

Group 1: (Blocks 8193-16384) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xe320, unused inodes 1976
  备份 superblock at 8193, Group descriptors at 8194-8194
  保留的GDT块位于 8195-8450
  Block bitmap at 260 (bg #0 + 259), Inode bitmap at 276 (bg #0 + 275)
  Inode表位于 538-784 (bg #0 + 537)
  7934 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 8451-16384
  可用inode数: 1977-3952
Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
  Checksum 0x5f58, unused inodes 1976
  Block bitmap at 261 (bg #0 + 260), Inode bitmap at 277 (bg #0 + 276)
  Inode表位于 785-1031 (bg #0 + 784)
  8192 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 16385-24576
  可用inode数: 3953-5928
Group 3: (Blocks 24577-32768) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xcbc0, unused inodes 1976
  备份 superblock at 24577, Group descriptors at 24578-24578
  保留的GDT块位于 24579-24834
  Block bitmap at 262 (bg #0 + 261), Inode bitmap at 278 (bg #0 + 277)
  Inode表位于 1032-1278 (bg #0 + 1031)
  7934 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 24835-32768
  可用inode数: 5929-7904
Group 4: (Blocks 32769-40960) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
  Checksum 0xf99a, unused inodes 1976
  Block bitmap at 263 (bg #0 + 262), Inode bitmap at 279 (bg #0 + 278)
  Inode表位于 1279-1525 (bg #0 + 1278)
  8192 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 32769-40960
  可用inode数: 7905-9880
Group 5: (Blocks 40961-49152) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xd61e, unused inodes 1976
  备份 superblock at 40961, Group descriptors at 40962-40962
  保留的GDT块位于 40963-41218
  Block bitmap at 264 (bg #0 + 263), Inode bitmap at 280 (bg #0 + 279)
  Inode表位于 1526-1772 (bg #0 + 1525)
  7934 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 41219-49152
  可用inode数: 9881-11856
Group 6: (Blocks 49153-57344) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x5ff4, unused inodes 1976
  Block bitmap at 265 (bg #0 + 264), Inode bitmap at 281 (bg #0 + 280)
  Inode表位于 1773-2019 (bg #0 + 1772)
  4096 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 53249-57344
  可用inode数: 11857-13832
Group 7: (Blocks 57345-65536) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xe898, unused inodes 1976
  备份 superblock at 57345, Group descriptors at 57346-57346
  保留的GDT块位于 57347-57602
  Block bitmap at 266 (bg #0 + 265), Inode bitmap at 282 (bg #0 + 281)
  Inode表位于 2020-2266 (bg #0 + 2019)
  7934 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 57603-65536
  可用inode数: 13833-15808
Group 8: (Blocks 65537-73728) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
  Checksum 0x02c4, unused inodes 1976
  Block bitmap at 267 (bg #0 + 266), Inode bitmap at 283 (bg #0 + 282)
  Inode表位于 2267-2513 (bg #0 + 2266)
  8192 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 65537-73728
  可用inode数: 15809-17784
Group 9: (Blocks 73729-81920) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xe55f, unused inodes 1976
  备份 superblock at 73729, Group descriptors at 73730-73730
  保留的GDT块位于 73731-73986
  Block bitmap at 268 (bg #0 + 267), Inode bitmap at 284 (bg #0 + 283)
  Inode表位于 2514-2760 (bg #0 + 2513)
  7934 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 73987-81920
  可用inode数: 17785-19760
Group 10: (Blocks 81921-90112) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
  Checksum 0xf84c, unused inodes 1976
  Block bitmap at 269 (bg #0 + 268), Inode bitmap at 285 (bg #0 + 284)
  Inode表位于 2761-3007 (bg #0 + 2760)
  8192 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 81921-90112
  可用inode数: 19761-21736
Group 11: (Blocks 90113-98304) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
  Checksum 0x8508, unused inodes 1976
  Block bitmap at 270 (bg #0 + 269), Inode bitmap at 286 (bg #0 + 285)
  Inode表位于 3008-3254 (bg #0 + 3007)
  8192 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 90113-98304
  可用inode数: 21737-23712
Group 12: (Blocks 98305-102399) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xff44, unused inodes 1976
  Block bitmap at 271 (bg #0 + 270), Inode bitmap at 287 (bg #0 + 286)
  Inode表位于 3255-3501 (bg #0 + 3254)
  4095 free blocks, 1976 free inodes, 0 directories, 1976个未使用的inodes
  可用块数: 98305-102399
  可用inode数: 23713-25688

下一篇介绍上面各个数据的含义;

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值