如何查看linux super block
发布网友
发布时间:2022-05-01 11:10
我来回答
共1个回答
热心网友
时间:2023-10-09 14:53
想要一看linux的超级块全貌,首先你必须得知道超级块(superblock)寄宿在哪个设备上。
先查看一下我们的设备:
root@xiahuixia-Inspiron-3437:/home/xiahuixia/tmp# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 476559384 13315584 439012940 3% /
none 4 0 4 0% /sys/fs/cgroup
udev 1964312 4 1964308 1% /dev
tmpfs 395000 1360 393640 1% /run
none 5120 0 5120 0% /run/lock
none 1974984 17240 1957744 1% /run/shm
none 102400 36 102364 1% /run/user
root@xiahuixia-Inspiron-3437:/home/xiahuixia/tmp#
ok, 有一个设备叫做/dev/sda1,是的,它就是我的硬盘了,我没有把我的硬盘分区,所以只有一个/dev/sda1 ,没有/dev/sda2 、/dev/sda3….
然后查看一下这个命令“mpe2fs”(mp ext2 file system , ext2文件系统是linux的正规文件系统)
DUMPE2FS(8) System Manager's Manual DUMPE2FS(8)
NAME
mpe2fs - mp ext2/ext3/ext4 filesystem information
SYNOPSIS
mpe2fs [ -bfhixV ] [ -o superblock=superblock ] [ -o blocksize=block‐ size ] device
DESCRIPTION
mpe2fs prints the super block and blocks group information for the filesystem present on device.
Note: When used with a mounted filesystem, the printed information may be old or inconsistent.
OPTIONS
-b print the blocks which are reserved as bad in the filesystem.
-o superblock=superblock
use the block superblock when examining the filesystem.This option is not usually needed except by a filesystem wizard who is examining the remains of a very badly corrupted filesystem.
至于man手册开头的DUMPE2FS(8), 8是什么意思呢?
再执行man man 看一下:
The table below shows the section numbers of the manual followed by the types of pages they contain.
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
A manual page consists of several sections.
看到了吗? 8 System administration commands (usually only for root)
好了,回到命令mpe2fs来,mpe2fs dev, 那么,这个dev该用什么来代替呢?就是我们的设备/dev/sda1了。
好了,看一下我们超级块的样子:
mpe2fs /dev/sda1, oop!内容太多了,将内容重定向到文件里吧:
mpe2fs /dev/sda1 > input
vi input
let us have a look at the content of input:
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: 83a4e993-4703-42ac-88ce-81f7b8c5ae35
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 large_file 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: 30269440
Block count: 121072384
Reserved block count: 6053619
Free blocks: 115812611
Free inodes: 30026282
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 995
Blocks per group: 32768