Arch-Linux

ext4 - 超級塊中的錯誤幻數

  • December 20, 2020

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?

我猜對比fdisk核心不使用分區表備份。所以你首先要修復它。fdisk /dev/sdd只需打開驅動器並寫入分區表就足夠了。

如果您從 github 下載 e2fsprogs 源,您可以建構該findsuper工具來掃描設備以獲取 ext2/3/4 超級塊魔法值。這應該會告訴您文件系統在磁碟上的位置,並將幫助您修復分區表。

引用自:https://unix.stackexchange.com/questions/598087