大网数据广告活动
服务器运维问答

fsck raid10 ext4 partition currupted, restore data

· 52CE 我爱测

there is a volume in raid10 /dev/md3 it has a GPT partition /dev/md3p1 in ext4 with a size of 16TB. I accidentally ran fsck -y /dev/md3 causing the filesystem in /dev/md3p1 to get corrupted. fsck -b superblock_number /dev/md3p1 w…

问题原文

原帖链接 · user607743 · CC BY-SA 4.0

there is a volume in raid10 /dev/md3 it has a GPT partition /dev/md3p1 in ext4 with a size of 16TB.

I accidentally ran

fsck -y /dev/md3

causing the filesystem in /dev/md3p1 to get corrupted.

fsck -b superblock_number /dev/md3p1 with any superblock from mkfs -n /dev/md3p1 returns an error.

testdisk in /dev/md3 sees ext4 partition, but in /dev/md3p1 sees nothing.

How to recover data or partition?

sudo parted -l /dev/md3

Model: ATA WDC WD8003FFBX-6 (scsi)
Disk /dev/sda: 8002G
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB
 3      1612MB  55.3GB  53.7GB
 4      55.3GB  66.0GB  10.7GB
 5      66.0GB  8002GB  7936GB


Model: ATA WDC WD8003FFBX-6 (scsi)
Disk /dev/sdb: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB
 3      1612MB  55.3GB  53.7GB
 4      55.3GB  66.0GB  10.7GB
 5      66.0GB  8002GB  7936GB


Model: ATA WDC WD8003FFBX-6 (scsi)
Disk /dev/sdc: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB
 3      1612MB  55.3GB  53.7GB
 4      55.3GB  66.0GB  10.7GB
 5      66.0GB  8002GB  7936GB


Model: ATA WDC WD8003FFBX-6 (scsi)
Disk /dev/sdd: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB
 3      1612MB  55.3GB  53.7GB
 4      55.3GB  66.0GB  10.7GB
 5      66.0GB  8002GB  7936GB

sudo mount /dev/md3p1 /1

mount: /1: wrong fs type, bad option, bad superblock on /dev/md3p1, missing codepage or helper program, or other error.

sudo mkfs -n /dev/md3p1



mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 3874701824 4k blocks and 484339712 inodes
Filesystem UUID: dc34be44-6f5a-47ac-a841-cbb75625b9b0
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, 1934917632, 
    2560000000, 3855122432

sudo fsck -b 32768 /dev/md3p1

fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
fsck.ext2: Bad magic number in super-block while trying to open /dev/md3p1

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>

cat /proc/mdstat


Personalities : [raid1] [raid10] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] 
md0 : active raid1 sdc2[6] sdb2[5] sda2[4] sdd2[0]
      1046528 blocks super 1.2 [4/4] [UUUU]
      
md1 : active raid1 sdb3[6] sdc3[5] sdd3[0] sda3[4]
      52395008 blocks super 1.2 [4/4] [UUUU]
      
md2 : active raid10 sdb4[5] sda4[4] sdc4[3] sdd4[0]
      20953088 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]
      
md3 : active raid10 sda5[1] sdd5[0] sdc5[3] sdb5[2]
      15498811392 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]
      bitmap: 0/116 pages [0KB], 65536KB chunk

已采纳解答

原帖链接 · JRM. · CC BY-SA 4.0

if you have tried with all superblocks, you may want to check out mke2fs' man mage, and maybe try it with the -S to re-init superblock and group descriptors (first, see the man page for warnings).

... you need to run fsck immediately afterwards, and have the right block size in hand.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-12-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。