[SLL] I can't find the start of my ext3 FS
Darius Medhora
dmedhora at yahoo.com
Fri Nov 30 13:25:18 PST 2007
Hi,
I have a situation where my 50G partition just refuses to mount or fsck.
I really don't want to loose the files on it so let me start by explaining
what happened.
I wiped out the first 512 bytes of the disk by mistake and therefore I
lost the partition table of my disk.
I ran testdisk from knoppix to recreate the partitions however, testdisk
could not recreate 1 of them. This is the partition thats giving me
problems. Can any one give me any solution to this please? Details of
disk follow:-
The partition I cannot mount or fsck is /dev/sda12
bash-3.00# fdisk -ls /dev/sda
Disk /dev/sda: 122.9 GB, 122942324736 bytes
16 heads, 63 sectors/track, 238216 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 20318 10240240+ 83 Linux
/dev/sda2 20319 30477 5120136 83 Linux
/dev/sda3 30478 40636 5120136 83 Linux
/dev/sda4 40637 196784 78698592 f W95 Ext'd (LBA)
/dev/sda5 40637 44700 2048224+ 83 Linux
/dev/sda6 44701 54388 4882720+ 83 Linux
/dev/sda7 54389 56326 976720+ 83 Linux
/dev/sda8 56327 57295 488344+ 83 Linux
/dev/sda9 57296 61170 1952968+ 82 Linux swap
/dev/sda10 61171 80546 9765472+ 83 Linux
/dev/sda11 80547 99903 9755896+ 83 Linux
/dev/sda12 99904 196784 48827992+ 83 Linux
bash-3.00# fdisk -lu /dev/sda
Disk /dev/sda: 122.9 GB, 122942324736 bytes
16 heads, 63 sectors/track, 238216 cylinders, total 240121728 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 63 20480543 10240240+ 83 Linux
/dev/sda2 20480544 30720815 5120136 83 Linux
/dev/sda3 30720816 40961087 5120136 83 Linux
/dev/sda4 40961088 198358271 78698592 f W95 Ext'd (LBA)
/dev/sda5 40961151 45057599 2048224+ 83 Linux
/dev/sda6 45057663 54823103 4882720+ 83 Linux
/dev/sda7 54823167 56776607 976720+ 83 Linux
/dev/sda8 56776671 57753359 488344+ 83 Linux
/dev/sda9 57753423 61659359 1952968+ 82 Linux swap
/dev/sda10 61659423 81190367 9765472+ 83 Linux
/dev/sda11 81190431 100702223 9755896+ 83 Linux
/dev/sda12 100702287 198358271 48827992+ 83 Linux
bash-3.00#
bash-3.00# e2fsck /dev/sda12
e2fsck 1.38 (30-Jun-2005)
Couldn't find ext2 superblock, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sda12
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>
bash-3.00#
bash-3.00# mount /dev/sda12 /mnt
mount: you must specify the filesystem type
bash-3.00#
A program i got from this great mailing list which displays the
blocks in the disk where superblocks may be found is as follows:
#!/usr/bin/python
'''
find_superblock.py
Finds possible superblocks in a drive, to aid with data recovery.
Usage: find_superblock.py /dev/hda
NOTE: USE THIS AT YOUR OWN RISK! NO WARRANTIES EXPRESSED OR IMPLIED.
Yada yada. IANAL. find_superblock.py must be run as root. It does not
modify the contents of the drive in any way; but the information provided
by this program is not tested and may be very unreliable.
'''
import os, sys, struct
if len(sys.argv) != 2:
print __doc__
sys.exit()
f = open(sys.argv[1],'rb')
n = 1
while True:
blk = f.read(512)
if len(blk) == 0: break
magic, volname = struct.unpack('56xH62x16s376x',blk)
if magic == 0xef53:
print '%d\t%s' % (n, volname)
n += 1
However, I'm not sure if I should change the f.read to 4096 because
the block size of the filesystem could be 4096. If so, how do i do
that since I don't know python?
But a run of the same script gives this output:
bash-3.00# ./fsb.py /dev/sda12
19093
34549
34613
34725
40141
40245
40397
40629
40781
41037
41205
41429
42885
43021
43885
46901
etc etc etc etc...
BUT, if I try 19093
bash-3.00# e2fsck -b 19093 /dev/sda12
e2fsck 1.38 (30-Jun-2005)
e2fsck: Bad magic number in super-block while trying to open /dev/sda12
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>
bash-3.00#
Can anyone please help me to fix this filesystem/partition?
I can do without all the other partitions/filesystems.
thanks!
d
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
More information about the linux-list
mailing list