修复EXT4-fs几何形状错误(块数超过设备大小)


23

我有一个具有FAT32分区和EXT4分区的微型SD卡。EXT4分区将不再挂载。dmesg显示以下错误:

EXT4-fs (sdb2): bad geometry: block count 2199023779840 exceeds size of device (524288 blocks)

我已经用Google搜索过,但仍然不完全了解问题出在哪里(在分区表中?文件系统?),也没有如何解决它。我尝试了多种解决方案:

  • 用testdisk写分区表
  • 使用fsck从备份中还原超级块(我已经尝试了所有备份)。例如fsck.ext4 -b 163840 -B 4096 /dev/sdb2
  • 使用fsck -cc检查坏块
  • 使用resize2fs设置分区的大小。输出:The combination of flex_bg and !resize_inode features is not supported by resize2fs.

当我运行fsck时,它提出了很多错误(下面的完整输出),据称可以修复。但是,如果再次运行它,每次都会再次显示相同的错误。

如何解决不良的几何问题并重新安装文件系统?这怎么发生的?

fsck输出:

e2fsck 1.42 (29-Nov-2011)
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.
/dev/sdb2 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #0 (24465, counted=24466).
Fix<y>? yes

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

Free blocks count wrong for group #3 (8710, counted=8881).
Fix<y>? yes

Free blocks count wrong for group #8 (5682, counted=22066).
Fix<y>? yes

Free blocks count wrong (299742, counted=317322).
Fix<y>? yes

Inode bitmap differences:  -(8193--8194) -8197 -8208 -(8225--8226) -8229 -(8240--8241) -(8257--8258) -8261 -8272 -8274 -(8289--8290) -8293 -(8304--8306) -(8321--8322) -8325 -8336 -8339 -16387 -16389 -16400 -16419 -16421 -(16432--16433) -16451 -16453 -16464 -16466 -16483 -16485 -(16496--16498) -16515 -16517 -16528 -16531 -24577 -24579 -24581 -24592 -24609 -24611 -24613 -(24624--24625) -24641 -24643 -24645 -24656 -24658 -24673 -24675 -24677 -(24688--24690) -24705 -24707 -24709 -24720 -24723 -(32770--32771) -32773 -32784 -(32802--32803) -32805 -(32816--32817) -(32834--32835) -32837 -32848 -32850 -(32866--32867) -32869 -(32880--32882) -(32898--32899) -32901 -32912 -32915 -(40961--40963) -40965 -40976 -(40993--40995) -40997 -(41008--41009) -(41025--41027) -41029 -41040 -41042 -(41057--41059) -41061 -(41072--41074) -(41089--41091) -41093 -41104 -41107 -(49156--49157) -49168 -(49188--49189) -(49200--49201) -(49220--49221) -49232 -49234 -(49252--49253) -(49264--49266) -(49284--49285) -49296 -49299 -57345 -(57348--57349) -57360 -57377 -(57380--57381) -(57392--57393) -57409 -(57412--57413) -57424 -57426 -57441 -(57444--57445) -(57456--57458) -57473 -(57476--57477) -57488 -57491 -65538 -(65540--65541) -65552 -65570 -(65572--65573) -(65584--65585) -65602 -(65604--65605) -65616 -65618 -65634 -(65636--65637) -(65648--65650) -65666 -(65668--65669) -65680 -65683 -(73729--73730) -(73732--73733) -73744 -(73761--73762) -(73764--73765) -(73776--73777) -(73793--73794) -(73796--73797) -73808 -73810 -(73825--73826) -(73828--73829) -(73840--73842) -(73857--73858) -(73860--73861) -73872 -73875 -(81923--81925) -81936 -(81955--81957) -(81968--81969) -(81987--81989) -82000 -82002 -(82019--82021) -(82032--82034) -(82051--82053) -82064 -82067 -90113 -(90115--90117) -90128 -90145 -(90147--90149) -(90160--90161) -90177 -(90179--90181) -90192 -90194 -90209 -(90211--90213) -(90224--90226) -90241 -(90243--90245) -90256 -90259 -(98306--98309) -98320 -(98338--98341) -(98352--98353) -(98370--98373) -98384 -98386 -(98402--98405) -(98416--98418) -(98434--98437) -98448 -98451 -(106497--106501) -106512 -(106529--106533) -(106544--106545) -(106561--106565) -106576 -106578 -(106593--106597) -(106608--106610) -(106625--106629) -106640 -106643 -114694 -114704 -114726 -(114736--114737) -114758 -114768 -114770 -114790 -(114800--114802) -114822 -114832 -114835 -122881 -122886 -122896 -122913 -122918 -(122928--122929) -122945 -122950 -122960 -122962 -122977 -122982 -(122992--122994) -123009 -123014 -123024 -123027
Fix<y>? yes

Free inodes count wrong for group #0 (7803, counted=7804).
Fix<y>? yes

Free inodes count wrong (130683, counted=130684).
Fix<y>? yes


/dev/sdb2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb2: 388/131072 files (22.7% non-contiguous), 206966/524288 blocks

fdisk -l 输出:

Disk /dev/sdb: 16.0 GB, 16012804096 bytes
64 heads, 32 sectors/track, 15271 cylinders, total 31275008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005ce93

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    27080703    13539328    c  W95 FAT32 (LBA)
/dev/sdb2        27080704    31275007     2097152   83  Linux

您可以包括fdisk -l此卡的输出吗?
2014年

@Timo对不起,忘了回答你。我已经用fdisk输出更新了这个问题
Michael

Answers:



3

文件系统不在乎磁盘的几何形状。这是一个分区表问题。

我建议您转储分区表,检查结果并用此转储覆盖分区表。那应该更正CHS条目。

sfdisk -d /dev/sdx >sdx.txt
cat sdx.txt
sfdisk /dev/sdx <sdx.txt

1
如果您不知道这些,则需要以root用户身份运行这些命令。
slm

1
感谢您的回答。sfdisk应该工作以将testdisk不在的分区表写入分区表吗?我尝试过,并且sfdisk声称它已成功写入分区表,但是仍然出现几何错误。sfdisk -d写入之前和之后的输出相同。我错过了什么吗?还有其他想法吗?
2014年

@Michael实话实说:我既没有注意到,也不知道是什么testdisk。互联网告诉我:“检查并恢复丢失的分区”。如果那只是为了丢失的分区,为什么要修复现有分区?
Hauke Laging

我只是问@HaukeLaging,因为它说它也重写了分区表。无论如何,对sfdisk结果有任何想法吗?
迈克尔

3

我几乎遇到了相同的问题,尝试挂载给:

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

我尝试了上述重写零件表,但没有成功。

因此,终于可以通过fdisk重新分区驱动器来解决此问题。我删除了第二个分区,然后重新创建了它。

$fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 31.4 GB, 31440502784 bytes
64 heads, 32 sectors/track, 29984 cylinders, total 61407232 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ecdca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    20447231    10222592   83  Linux
/dev/sda2        20447232    61406208    20479488+  83  Linux

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (1-4, default 2): 
Using default value 2
First sector (20447232-61407231, default 20447232): 
Using default value 20447232
Last sector, +sectors or +size{K,M,G} (20447232-61407231, default 61407231): 
Using default value 61407231

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

工作完美,这很荒谬,但是嘿。
mgjk 2015年

没为我工作。
戴维·肯尼迪

2

对于图像文件,我也有同样的问题,即没有任何分区表,因此问题出在文件系统本身之内。我只需要resize2fs对图像文件进行修复即可。


我在预格式化的eMMC卡上遇到了问题。发生故障的ext4分区上的resize2fs解决了该问题。
Peter Gloor

0

由于找不到其他解决方案,因此重新格式化了EXT4分区。这样消除了不良的几何误差。希望我知道为什么。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.