Can't mount EXT4 hard drive after mounting it in windows
Solution 1
It is quite unusual to format a filesystem on a hard disk without a partition table. It appears that you did in fact, have a partition table before, and the partition started at sector 2048, which is the usual starting location for the first partition on a disk these days. If you run fdisk
and use the u
command to change its units to sectors, then create a new partition with the n
command, and set the starting sector to 2048, then w
to save and exit, then everything should be kosher. Make sure with e2fsck -f
on the partition.
Solution 2
Problem solved.
It seemed partition table was corrupted.
As psusi's comment:
Then yes, you had a partition on the disk before starting at the usual location of sector 2048. Recreate the partition and everything should be fine.
I didn't know how to re-create the partition. so I did this and problem solved (data are there and disk mounts again correctly):
I ran sudo testdisk
.
After selecting my disk I selected Analyse
and selected Quick Search
then without changing the found partition I continued to next screen (Hit Enter) in this screen I selected Write
for writing partition structure to disk. then I unplugged and re-plugged disk to system and now its fine.
Thank you all for your help specially "psusi"
Related videos on Youtube
Ariyan
Updated on September 18, 2022Comments
-
Ariyan over 1 year
I have a 2TB Western external hard disk.
Its original filesystem was NTFS but I formatted it to EXT4.
I had no problem in Linux; but today after I mounted it usingext2fsd
in a windows box, I can't mount it in Linux anymore!
The drive had no partition but after that windows mountDisk Utility
Shows it has a 1KB partition and 2TB unallocated space!!!
My Data are not corrupted (I still can view my files usingext2fsd
in Windows!)
Trying to mount usingmount -t ext4
fails and dmesg says:EXT4-fs (sdb): VFS: Can't find ext4 filesystem
also
fsck
gives: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>
I think that Western's internal application is started in Windows and corrupted FS by creating a partition for itself.
How can I Fix it?
I also tried
e2fsck -b 8193 /dev/sdb
and got same result: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>
So I tried to find super backup superblocks using
testdisk
, it gave: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]
I tried to repair it using
fsck.ext4 -b 32768 -B 4096 /dev/sdb
and the result was: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
returns: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..
and
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 ................
a question: Can I repair it with
mkfs.ext4 -S /dev/sdb
without losing data?
At
skip=2050
there is a53ef
at position 0x38 (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/
returns: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
returns:/dev/sdb1: data
-
Kyle Jones almost 12 yearsDid you try running
e2fsck -b 8193
? -
Ariyan almost 12 years@KyleJones: Yes; Please read my edit on the question.
-
psusi almost 12 yearsWhat does
fdisk -l /dev/sdb
show? -
Ariyan almost 12 years@psusi: I added
fdisk -l /dev/sdb
result at the end of question. -
psusi almost 12 yearsCan you run
sudo dd if=/dev/sdb bs=512 count=1 skip=262144 | xxd -a
and add the results to your question? Also with skip=2. -
Ariyan almost 12 years@psusi: I added results at the end of question.
-
Ariyan almost 12 years@psusi: I adjusted skip value for 0,1,2,3,4,262141,262142,262143,262144,262145 and there where no
53ef
!! I selectedsdb
in testdisk but in another page I think it detected a partition; this shows it: i.imgur.com/HwQz1.png -
Ariyan almost 12 years@psusi: this is the page testdisk shows after selecting
Advanced
: i.imgur.com/fZGcG.png -
psusi almost 12 yearsYou must have had it in a partition then rather than on the raw disk. I'm having trouble interpreting what testdisk is saying because it is listing 3 different numbers under the start column. Check around skip=32 +/- 2.
-
psusi almost 12 yearsThen yes, you had a partition on the disk before starting at the usual location of sector 2048. Recreate the partition and everything should be fine.
-
Ariyan almost 12 years@psusi: hi; thanks; But How? you mean using this:
mkfs.ext4 -S /dev/sdb
? or something else? -
Gilles 'SO- stop being evil' almost 12 yearsWhat happens if you try
mount /dev/sdb1
? What doesfile -s /dev/sdb1
show? It's normal not to find a filesystem at the start of the disk/dev/sdb
if it's on the partition/dev/sdb1
instead. -
Ariyan almost 12 years@Gilles: I added the output of
mount
andfile
to the end of question. -
Ariyan almost 12 years@psusi: If you make an answer from all of your comments . I'll select that as accepted answer; thank you.
-
psusi almost 12 yearsSorry for the late reply, I was on vacation. You need to recreate the partition, with a partitioning tool such as
fdisk
orparted
.mkfs
creates a filesystem. Your filesystem is still there, you are just missing the partition table.
-
-
Ariyan almost 12 yearsThanks, I fixed it using
testdisk