ext4 - 超级块中的错误幻数

ext4 - 超级块中的错误幻数

ext4 又让我失望了!最不稳定的FS

尝试通过从备份恢复块来修复它,但没有运气..

↪ sudo fsck.ext4 -v /dev/sdd
e2fsck 1.45.6 (20-Mar-2020)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sdd

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>

/dev/sdd contains DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 4294967295 sectors, extended partition table (last) data


↪ sudo mke2fs -n /dev/sdd
mke2fs 1.45.6 (20-Mar-2020)
/dev/sdd contains DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 4294967295 sectors, extended partition table (last) data
Proceed anyway? (y,N) y
Creating filesystem with 976754646 4k blocks and 244195328 inodes
Filesystem UUID: 0e4124ad-a390-4c60-bb4a-4f7c48dac23b
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
102400000, 214990848, 512000000, 550731776, 644972544


↪ sudo e2fsck -b 32768 /dev/sdd
e2fsck 1.45.6 (20-Mar-2020)
e2fsck: Bad magic number in super-block while trying to open /dev/sdd

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>

/dev/sdd contains DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 429496725 sectors, extended partition table (last) data

我已经尝试过最大 11239424 的块


↪ sudo fdisk -l /dev/sdd
The primary GPT table is corrupt, but the backup appears OK, so that will be used.
Disk /dev/sdd: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: TOSHIBA MD04ABA4
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 7D5C7ECA-C305-3C44-AA4F-8503EB53A54F

Device     Start        End    Sectors  Size Type
/dev/sdd1   2048 7814031359 7814029312  3.7T Linux filesystem


↪ sudo e2fsck -b 32768 /dev/sdd1
e2fsck 1.45.6 (20-Mar-2020)
e2fsck: No such file or directory while trying to open /dev/sdd1
Possibly non-existent device?

答案1

因为您已经在硬盘内的备份中的某个地方工作了分区

↪ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The primary GPT table is corrupt, but the backup appears OK, so that will be used.

您可以简单地转储它并在转储后立即恢复

sudo sfdisk -d /dev/sdb > sdb.dump
sudo sfdisk /dev/sdb < sdb.dump

和瓦阿利亚 =)

The primary GPT table is corrupt, but the backup appears OK, so that will be used.
Checking that no-one is using this disk right now ... OK

Disk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: TOSHIBA MD04ABA4
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 7D5C7ECA-C305-3C44-AA4F-8503EB53A54F

Old situation:

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048 7814031359 7814029312  3.6T Linux filesystem

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 7D5C7ECA-C305-3C44-AA4F-8503EB53A54F).
/dev/sdb1: Created a new partition 1 of type 'Linux filesystem' and of size 3.6 TiB.
Partition #1 contains a ext4 signature.
/dev/sdb2: Done.

New situation:
Disklabel type: gpt
Disk identifier: 7D5C7ECA-C305-3C44-AA4F-8503EB53A54F

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048 7814031359 7814029312  3.6T Linux filesystem

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

终端中只有 2 个命令

只需几秒钟

这很简单,不必浪费时间和金钱来进行新的硬盘和 rstudio 备份;)

答案2

我猜想对比fdisk内核没有使用分区表备份。所以你首先必须修复它。只需打开驱动器fdisk /dev/sdd并写入分区表就足够了。

答案3

如果您从 github 下载 e2fsprogs 源代码,您可以构建该findsuper工具来扫描设备以获取 ext2/3/4 超级块魔法值。这应该告诉您文件系统在磁盘上的位置,并将帮助您修复分区表。

相关内容