尝试修复 ext4“组描述符损坏!”时丢失数据

尝试修复 ext4“组描述符损坏!”时丢失数据

当我尝试安装现有磁盘时,我收到消息

sudo mount -t ext4  /dev/sdc1 /data
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

dmesg当我看到

[  707.504050] EXT4-fs (sdc1): group descriptors corrupted!

然后我运行命令

sudo e2fsck -p /dev/sdc1


cloudimg-rootfs: Superblock has an invalid journal (inode 8).
CLEARED.
*** ext3 journal has been deleted - filesystem is now ext2 only ***

cloudimg-rootfs: One or more block group descriptor checksums are invalid.  FIXED.
cloudimg-rootfs: Group descriptor 0 checksum is invalid.  

cloudimg-rootfs: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    (i.e., without -a or -p options)

sudo fsck.ext4 -v /dev/sdc1

One or more block group descriptor checksums are invalid.  Fix<y>? yes

Group descriptor 0 checksum is invalid.  FIXED.
Group descriptor 1 checksum is invalid.  FIXED.
Group descriptor 2 checksum is invalid.  FIXED.
Group descriptor 3 checksum is invalid.  FIXED.
Group descriptor 4 checksum is invalid.  FIXED.
Group descriptor 5 checksum is invalid.  FIXED.
Group descriptor 6 checksum is invalid.  FIXED.
Group descriptor 7 checksum is invalid.  FIXED.
Group descriptor 8 checksum is invalid.  FIXED.
Group descriptor 9 checksum is invalid.  FIXED.
Group descriptor 10 checksum is invalid.  FIXED.
Group descriptor 11 checksum is invalid.  FIXED.
Group descriptor 12 checksum is invalid.  FIXED.
Group descriptor 13 checksum is invalid.  FIXED.
Group descriptor 14 checksum is invalid.  FIXED.
Group descriptor 15 checksum is invalid.  FIXED.
Group descriptor 16 checksum is invalid.  FIXED.
Group descriptor 17 checksum is invalid.  FIXED.
..SKIPPED..

    cloudimg-rootfs contains a file system with errors, check forced.
Resize inode not valid.  Recreate<y>? yes

Pass 1: Checking inodes, blocks, and sizes
Journal inode is not in use, but contains data.  Clear<y>? yes

Pass 2: Checking directory structure
Entry 'backup' in / (2) has invalid inode #: 3932162.
Clear<y>? yes

Entry 'conf' in / (2) has invalid inode #: 3932163.
Clear<y>? yes

Entry 'data' in / (2) has invalid inode #: 3932164.
Clear<y>? yes

Entry 'init' in / (2) has invalid inode #: 3932165.
Clear<y>? yes

Entry 'lib' in / (2) has invalid inode #: 3932166.
Clear<y>? yes

Entry 'log' in / (2) has invalid inode #: 3932167.
Clear<y>? yes

Entry 'script' in / (2) has invalid inode #: 3932168.
Clear<y>? yes

Entry 'site' in / (2) has invalid inode #: 3932169.
Clear<y>? yes

Entry 'tmp' in / (2) has invalid inode #: 3932170.
Clear<y>? yes

Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Inode 2 ref count is 12, should be 3.  Fix<y>? yes

Pass 5: Checking group summary information
Block bitmap differences:  -(89--601) -(603--1024) -9254 -(32857--33792) -(34816--98303) -(98393--99328) -(100352--163839) -(163929--164864) -(165888--229375) -(229465--230400) -(231424--294911) -(295001--295936) -(296960--524287) -(557056--819199) -(819289--820224) -(821248--884735) -(884825--885760) -(886784--1048575) -(1081344--1572863) -(1605721--1606656) -(1607680--1641853) -(1641984--1658367) -(1658880--1702655) -(1702912--1726975) -(1727488--1738239) -(1738752--1991679) -(1992704--2055679) -(2056192--2061567) -(2062336--2082303) -(2082816--2097151) -(2129920--2452991) -(2453504--2480383) -(2482176--2517503) -(2519040--2580735) -(2580992--2581503) -(2582528--2621439) -(2654297--2655232) -(2656256--2713343) -(2713600--2723327) -(2723840--2735103) -(2736128--2743295) -(2744320--2745855) -(2746368--2760447) -(2760704--2765567) -(2766848--2804991) -(2805760--2837503) -(2838528--2842367) -(2842624--2893055) -(2893312--2909439) -(2910208--3013631) -(3014656--3145727) -(3178496--3417343) -(3417600--3437055) -(3438592--3442175) -(3442688--3454463) -(3454976--3670015) -(3702784--3775743) -(3776000--3897599) -(3899392--3902207) -(3902464--3922687) -(3923968--3937279) -(3938304--3993855) -(3995648--4011775) -(4012032--4043519) -(4043776--4044287) -(4044800--4065023) -(4065280--4068863) -(4069376--4074495) -(4075520--4089599) -(4089856--4095999) -(4096089--4099840) -(4100096--4119295) -(4120576--4124415) -(4124672--4179199) -(4179968--4185599) -(4186112--4192511) -(4193280--4194303) -(4227072--4229375) -(4230144--4273407) -(4274176--4301567) -(4301824--4318207) -(4319232--4380927) -(4381184--4381695) -(4382720--4426495) -(4426752--4460031) -(4460544--4563455) -(4563968--4625919) -(4626432--4718591) -(4751360--4840191) -(4841472--4862463) -(4862976--4878079) -(4878336--5086463) -(5086720--5110783) -(5111808--5158399) -(5158912--5204991) -(5206016--5218047) -(5218304--5231615) -(5232640--5242879) -(5275648--5383167) -(5384192--5451519) -(5451776--5457407) -(5457920--5471231) -(5472256--5474815) -(5476352--5484031) -(5484544--5512235) -(5513216--5583359) -(5583872--5670143) -(5670400--5685759) -(5686272--5703423) -(5703680--5750015) -(5750784--5767167) -(5799936--5892863) -(5893120--5906175) -(5906432--5946367) -(5947392--5964031) -(5965824--6018815) -(6019072--6034687) -(6035456--6093311) -(6094848--6097919) -(6098944--6291455) -(6324224--6378239) -(6379520--6409215) -(6410240--6429695) -(6430720--6558207) -(6559744--6702079) -(6703104--6740991) -(6742016--6815743) -(6848512--6929919) -(6930432--7140095) -(7141376--7144959) -(7145472--7149055) -(7149568--7156991) -(7157760--7161599) -(7161856--7171071) -(7172096--7185919) -(7186432--7195647) -(7196672--7224063) -(7225344--7340031) -(7340043--7340047) -(7340059--7340063) -(7345696--7348255) -(7372800--7463423) -(7464960--7491071) -(7491584--7502847) -(7503872--7523839) -(7524352--75315

Fix<y>? yes

Free blocks count wrong for group #0 (23512, counted=24449).
Fix<y>? yes

Free blocks count wrong for group #1 (1023, counted=32679).
Fix<y>? yes

Free blocks count wrong for group #2 (0, counted=32768).
Fix<y>? yes
..SKIPPED..

最后..

cloudimg-rootfs: ***** FILE SYSTEM WAS MODIFIED *****

      11 inodes used (0.00%)
       0 non-contiguous files (0.0%)
       0 non-contiguous directories (0.0%)
         # of inodes with ind/dind/tind blocks: 0/0/0
         Extent depth histogram: 2
  121775 blocks used (1.59%)
       0 bad blocks
       0 large files

       0 regular files
       2 directories
       0 character device files
       0 block device files
       0 fifos
       0 links
       0 symbolic links (0 fast symbolic links)
       0 sockets
--------
       2 files

问题:当我尝试再次挂载它时,这次成功了,但只显示只有lost+found文件夹的空分区,而我的 100GB 分区变成了 29GB。

任何想法?

答案1

您的文件系统已严重损坏,而且我们能做的很少,e2fsck无法挽救它。删除文件系统并从备份中恢复。我想补充一下“考虑更换硬件“除了您上面发布的内容表明这是一个虚拟服务器。

回答你上面的评论,你所做的几乎是我们所有人在 FS 午餐事件中都能做的(FS 内核黑客除外,他们可能会使用debugfs)。不要责怪自己——除非你没有任何备份,在这种情况下责怪自己,并吸取重要的教训。

相关内容