我有一个 2TB 的西数外置硬盘。
它的原始文件系统是NTFS,但我将其格式化为EXT4。
我在 Linux 下没有遇到任何问题;但是今天我在 Windows 机器中安装它后ext2fsd
,我无法再在 Linux 中安装它了!
该驱动器没有分区,但在 Windows 挂载后,Disk utility
显示它有 1KB 分区和 2TB 未分配空间!
我的数据没有损坏(我仍然可以ext2fsd
在 Windows 中查看我的文件)。
尝试使用安装mount -t ext4
失败并dmesg
显示:
EXT4-fs (sdb): VFS: Can't find ext4 filesystem
还fsck
给出:
e2fsck 1.41.11 (14-Mar-2010)
e2fsck: Bad magic number in super-block while trying to open /dev/sdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
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>
我认为西部数据的内部应用程序是在Windows中启动的,并通过为自己创建分区来损坏文件系统。
我该如何修复它?
我也尝试过e2fsck -b 8193 /dev/sdb
并得到相同的结果:
e2fsck 1.41.11 (14-Mar-2010)
e2fsck: Bad magic number in super-block while trying to open /dev/sdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
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>
所以我尝试使用 查找超级备份超级块testdisk
,它给出了:
superblock 0, blocksize=4096 [Ariyan2T]
superblock 32768, blocksize=4096 [Ariyan2T]
superblock 98304, blocksize=4096 [Ariyan2T]
superblock 163840, blocksize=4096 [Ariyan2T]
superblock 229376, blocksize=4096 [Ariyan2T]
superblock 294912, blocksize=4096 [Ariyan2T]
superblock 819200, blocksize=4096 [Ariyan2T]
superblock 884736, blocksize=4096 [Ariyan2T]
superblock 1605632, blocksize=4096 [Ariyan2T]
superblock 2654208, blocksize=4096 [Ariyan2T]
我尝试使用修复它fsck.ext4 -b 32768 -B 4096 /dev/sdb
,结果是:
e2fsck 1.41.11 (14-Mar-2010)
fsck.ext4: Bad magic number in super-block while trying to open /dev/sdb
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
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>
fdisk -l /dev/sdb
返回:
Warning: invalid flag 0x0000 of partition table 5 will be corrected by w(rite)
Disk /dev/sdb: 2000.4 GB, 2000365289472 bytes
255 heads, 63 sectors/track, 243197 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00021365
Device Boot Start End Blocks Id System
/dev/sdb1 1 243198 1953480704 85 Linux extended
sudo dd if=/dev/sdb bs=512 count=1 skip=262144 | xxd -a
:
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.42691 s, 1.2 kB/s
0000000: ae61 5cc1 3be6 6d8d ceed 0cc8 293b fa1b .a\.;.m.....);..
0000010: 5931 fa58 7420 550a b40e 7b1c b0a6 ad60 Y1.Xt U...{....`
0000020: 1f29 dcae af2a a935 7185 f1d9 6b64 7f29 .)...*.5q...kd.)
0000030: fed0 4c79 fc3b 1544 becd bda0 e7a4 836b ..Ly.;.D.......k
0000040: ea50 1800 0868 89ac 592d 63a2 05e5 116d .P...h..Y-c....m
0000050: 4654 9870 671a e11d 7ae0 6bdd dd23 bf5a FT.pg...z.k..#.Z
0000060: 94ac a20d 695b d010 d8f2 4620 5930 561b ....i[....F Y0V.
0000070: af93 7d8c 06c3 72c7 3757 7815 e955 3278 ..}...r.7Wx..U2x
0000080: 5773 22b3 2908 52b5 f7e9 59ea b618 5830 Ws".).R...Y...X0
0000090: b29f d244 9a72 ead9 5a77 d3ce e83a 8c44 ...D.r..Zw...:.D
00000a0: 96d9 a89f dd82 b72a f624 10a8 0f44 31a5 .......*.$...D1.
00000b0: 29b6 811a f9cd 175a c00b 670a 5051 ce87 )......Z..g.PQ..
00000c0: 5b00 bd80 20d5 c6e5 f0d0 593e f923 005d [... .....Y>.#.]
00000d0: 1a6f 83ea 7f28 3305 dc72 7d92 4258 cb4e .o...(3..r}.BX.N
00000e0: 00de 6a6c 4575 d355 3682 28dd f765 e099 ..jlEu.U6.(..e..
00000f0: 1193 d0cc 64ad a841 ecd7 2c24 08e2 96f5 ....d..A..,$....
0000100: 0fb2 e4fd ef04 1914 f63c 30ce 0df9 3470 .........<0...4p
0000110: 166f 080d 7872 dfce a854 ef20 a237 447a .o..xr...T. .7Dz
0000120: 05b1 653f 109b 52c3 553b 966c 9733 838e ..e?..R.U;.l.3..
0000130: c2c9 52cd 4b8f 1e85 cd70 abf4 f9b6 c0c5 ..R.K....p......
0000140: 1412 0f2f 8389 9f4b 94af a523 c6c5 6e04 .../...K...#..n.
0000150: 25d4 d049 fde8 cd9d 94bd 608e e08a f6c6 %..I......`.....
0000160: 389a 5571 9182 d642 7680 f905 9fb6 179a 8.Uq...Bv.......
0000170: 9c6c 5290 ec62 a44f 3f05 fa39 f2a1 18c7 .lR..b.O?..9....
0000180: ba96 297f 2d04 a646 8cc8 e50c ee90 76c0 ..).-..F......v.
0000190: f9ae e586 0f89 6227 35bb b390 9477 8720 ......b'5....w.
00001a0: 2a6c c2b1 9f15 ecdd 8216 523c 2b61 731e *l........R<+as.
00001b0: 1b1f 0d24 5914 7e8a 7c32 957b 4f24 a464 ...$Y.~.|2.{O$.d
00001c0: ccb4 ecd9 7d1e 967d 9d6b ee20 fa02 9e65 ....}..}.k. ...e
00001d0: 593c 640e fbd2 4f6e e0f8 53b8 4b4a b3fa Y<d...On..S.KJ..
00001e0: a630 30f1 8170 55a4 dd91 805c d522 9412 .00..pU....\."..
00001f0: 7c0f 1afa ff47 ab23 9721 5a3d f87a 181f |....G.#.!Z=.z..
和sudo dd if=/dev/sdb bs=512 count=1 skip=2 | xxd -a
:
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000880215 s, 582 kB/s
0000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
*
00001f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
一个问题:我可以在mkfs.ext4 -S /dev/sdb
不丢失数据的情况下修复它吗?
在位置 0x38 ( )skip=2050
处有一个 :53ef
sudo dd if=/dev/sdb bs=512 count=1 skip=2050 | xxd -a
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000688801 s, 743 kB/s
0000000: 0000 4707 00f0 1b1d cc98 7401 769e 2a1a ..G.......t.v.*.
0000010: 9df7 4607 0000 0000 0200 0000 0200 0000 ..F.............
0000020: 0080 0000 0080 0000 0020 0000 ce17 0750 ......... .....P
0000030: ce17 0750 1a00 2600 53ef 0100 0100 0000 ...P..&.S.......
0000040: a26d 9d4f 004e ed00 0000 0000 0100 0000 .m.O.N..........
0000050: 0000 0000 0b00 0000 0001 0000 3c00 0000 ............<...
0000060: 4202 0000 7b00 0000 8160 9a1f f334 4827 B...{....`...4H'
0000070: b6df 00c2 8981 7b36 4172 6979 616e 3254 ......{6Ariyan2T
0000080: 0000 0000 0000 0000 2f6d 6564 6961 2f41 ......../media/A
0000090: 7269 7961 6e32 5400 4bb7 7001 80fd 39e9 riyan2T.K.p...9.
00000a0: 607c e2c0 8098 6ced 94be 7fed 1529 21c0 `|....l......)!.
00000b0: 6026 a0c5 c280 0000 6026 a0c5 2042 b0c5 `&......`&.. B..
00000c0: 0000 0000 2042 b0c5 0000 0000 0000 8b03 .... B..........
00000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000e0: 0800 0000 0000 0000 0000 0000 b536 a950 .............6.P
00000f0: 02a9 455e 9fa8 b9a3 0f2b 61b1 0101 0000 ..E^.....+a.....
0000100: 0000 0000 0000 0000 a26d 9d4f 0af3 0200 .........m.O....
0000110: 0400 0000 0000 0000 0000 0000 ff7f 0000 ................
0000120: 0080 880e ff7f 0000 0100 0000 ffff 880e ................
0000130: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000140: 0000 0000 0000 0000 0000 0000 0000 0008 ................
0000150: 0000 0000 0000 0000 0000 0000 1c00 1c00 ................
0000160: 0100 0000 0000 0000 0000 0000 0000 0000 ................
0000170: 0000 0000 0400 0000 5962 660c 0000 0000 ........Ybf.....
0000180: 0000 0000 0000 0000 0000 0000 0000 0000 ................
*
00001f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
mount -t ext4 /dev/sdb1 /media/tmpmp/
返回:
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
file -s /dev/sdb1
返回:
/dev/sdb1: data
答案1
在没有分区表的情况下格式化硬盘上的文件系统是很不寻常的。看来您之前确实有一个分区表,并且分区从扇区 2048 开始,这是当今磁盘上第一个分区的通常起始位置。如果您运行fdisk
并使用该u
命令将其单位更改为扇区,然后使用该n
命令创建一个新分区,并将起始扇区设置为2048,然后w
保存并退出,那么一切都应该是干净的。确保e2fsck -f
分区上有 。
答案2
问题解决了。
看来分区表已损坏。
正如普苏西的评论:
那么是的,在从扇区 2048 的常用位置开始之前,您在磁盘上已有一个分区。重新创建该分区,一切都应该没问题。
我不知道如何重新创建分区。所以我这样做并解决了问题(数据在那里并且磁盘再次正确安装):
我运行了sudo testdisk
.
选择我的磁盘后,我选择Analyse
并选择,Quick Search
然后在不更改找到的分区的情况下,我继续到下一个屏幕(按 Enter 键),在此屏幕中我选择Write
将分区结构写入磁盘。然后我拔掉磁盘并重新插入系统,现在一切正常了。
谢谢大家的帮助,特别是“psusi”