linux超级块 超级块是什么

大家好,关于linux超级块很多朋友都还不太明白,不过没关系,因为今天小编就来为大家分享关于超级块是什么的知识点,相信应该可以解决大家的一些困惑和问题,如果碰巧可以解决您的问题,还望关注下本站哦,希望对各位有所帮助!

Linux Ext3文件系统超级块损坏后怎么修复

这个错误标识/dev/sde1设备上的 ext3文件系统的超级块损坏了,ext3文件系统的元数据保存在超级块中。

ext3文件系统还有一些备份的超级块,可以尝试用备份的超级块加载 ext3文件系统和修复 ext3文件系统。

备份的超级块可以通过以下命令获得,这个命令模拟 ext3文件系统创建时的动作并打印出备份超级块的位置,给出的位置缺省是以4k为单位的,mount在使用时需要为它提供以1k为单位的偏移,需要乘4:

注意!一定要使用‘-n‘作为参数模拟 ext3文件系统的创建而不是真的创建 ext3文件系统

# mkfs.ext3-n/dev/hda7

mke2fs 1.38

Filesystem label=

OS type: Linux

Block size=4096

Fragment size=4096

2198880 inodes, 4393738 blocks

219686 blocks reserved for the super user

First data block=0

135 block groups

32768 blocks per group, 32768 fragments per group

16288 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000

使用备份的超级块来加载 ext3文件系统的命令:

语法: mount.ext3-o sb=n

# mount.ext3-o sb=131072/dev/hda7/media/hda7

使用备份的超级块来修复 ext3文件系统的命令

语法:fsck.ext3-b superblock

# fsck.ext3-b 32768/dev/hda7

如何查看linux上一个文件系统的超级块superblock的信息

要查看Linux上文件系统的超级块信息,可以通过命令行方式进行。首先,使用“df”命令查看各个分区的挂载情况,找到属于Linux的ext*文件系统的设备名,例如:/dev/*。确保该分区是Linux文件系统,否则使用dumpe2fs命令时会报错。

接下来,使用命令“sudo dumpe2fs/dev/*”即可查看超级块的具体内容。请注意,输出结果可能非常长。

为了更精确地获取所需信息,可以结合使用“grep”命令进行检索。例如,使用命令“sudo dumpe2fs/dev/sda1| grep-i"Block size"”,可以快速查找与“Block size”相关的具体信息。这将帮助您更直观地了解文件系统中关键参数的详细情况。

如何查看linux super block

想要一看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….

然后查看一下这个命令“dumpe2fs”(dump ext2 file system, ext2文件系统是linux的正规文件系统)

DUMPE2FS(8) System Manager's Manual DUMPE2FS(8)

NAME

dumpe2fs- dump ext2/ext3/ext4 filesystem information

SYNOPSIS

dumpe2fs [-bfhixV ] [-o superblock=superblock ] [-o blocksize=block‐ size ] device

DESCRIPTION

dumpe2fs 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)

好了,回到命令dumpe2fs来,dumpe2fs dev,那么,这个dev该用什么来代替呢?就是我们的设备/dev/sda1了。

好了,看一下我们超级块的样子:

dumpe2fs/dev/sda1, oop!内容太多了,将内容重定向到文件里吧:

dumpe2fs/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

阅读剩余
THE END