LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Ext2 partition lost upon frozen computer (https://www.linuxquestions.org/questions/linux-general-1/ext2-partition-lost-upon-frozen-computer-529074/)

jagot 02-14-2007 02:48 PM

Ext2 partition lost upon frozen computer
 
I booted into Knoppix and had just mounted an ext2 partition on my second harddrive (a Maxtor ~200GB, the partition occupying the last 45 GB or so), when the system froze (did not respond to mouse/keyboard) and I had to reboot with the reset button. Nota bene that I hadn't changed read/write mode to writeable yet! When Knoppix had started once more, the swap partition occured on the desktop (which it doesn't do normally) and when trying to mount it I got this error:

Could not mount device.
The reported error was:
mount: I could not determine the filesystem type, and none was specified
Trying to mount it manually returns:

#mount -t ext2 /dev/hdb1 /mnt/hdb1
mount: wrong fs type, bad option, bad superblock on /dev/hdb1
or to many mounted file systems
Testdisk doesn't find anything (says structure is OK) and neither does Acronis Disc Director.

I have lots of files that I was going to burn onto DVD next week, and I don't want to lose them. What should I do? I can't see that they have been overwritten as the partition was only mounted for a few seconds and then Knoppix froze, almost 100% because of my motherboard which freezes every once in a while when the CPU is in a specific temperature interval (a bug, to say the least). This thing has happened hundreds of times before, but I have never lost anything when running Linux from the harddrive, only when running Knoppix from LiveCD.

Cheers,
Stefanos

jonaskoelker 02-14-2007 04:44 PM

Quote:

Originally Posted by jagot
the swap partition ... when trying to mount it I got this error:

If you really mean that you are trying to mount a swap partition, the "-t ext2" is wrong, you want "-t swap" (I'd think) or something similar; see mount(8). If that doesn't work, just recreate the swap file system: `mkfs.swap /dev/hdb1' should do it. But for teh l0ve of g@wd don't do this if the partition in question is not a swap partition.

syg00 02-14-2007 05:35 PM

Yep, I'd be checking an "fdisk -l" *real* closely.
Try this to check if a particular partition has been formatted as swap
Code:

dd if=/dev/hdb1 count=1 skip=7 | strings
Amend the partition as required. This should give the SWAPSPACE2 (or SWAPSPACE if really old - reformat in this case).

dracolich 02-14-2007 05:39 PM

Quote:

mount -t ext2 /dev/hdb1 /mnt/hdb1
You might try expanding on this one. I've found that manually mounting ext2 doesn't like to work with the above syntax. Either use auto as the fs or add -o defaults at the end.

jagot 02-15-2007 02:37 AM

No, I did not try to mount the swap. What bugged me was the fact that the swap partition suddenly appeared as a normal partition on the Knoppix desktop, ie as hdb2. But neither hdb1 (an ext2) or hdb2 was mountable. I'll check fdisk -l when I get home.
But the thing is, I can't see that the partition should disappear just because the partition table is corrupt. There must be some way to scan for "partition headers" or something if I know where the partition is supposed to start. 200 GB disk, swap partition last (~1 GB), before that an ext2 partition (~45 GB). That partition must begin somewhere in the interval 150-160 GB from the beginning of the disk (200-45-1=154).

Hope you can come up with something

syg00 02-15-2007 03:01 AM

Quote:

Originally Posted by jagot
But the thing is, I can't see that the partition should disappear just because the partition table is corrupt.

Huh ???.
The partition table defines the partitions - the start and size. If you no longer have a pointer to the data, why wouldn't it disappear ???.
Quote:

There must be some way to scan for "partition headers" or something if I know where the partition is supposed to start.
There is, testdisk. It's on Knoppix. From a terminal, su to root (no password), and try running it - it won't actually update anything until you tell it to.

jagot 02-15-2007 12:54 PM

Quote:

Originally Posted by syg00
Huh ???.
The partition table defines the partitions - the start and size. If you no longer have a pointer to the data, why wouldn't it disappear ???

The data on the partitions, and the partitions themselves wouldn't disappear, would they? It isn't likely that 45 GB's worth of data can be erased and actually overwritten in a matter of a few seconds, is it?

Quote:

Originally Posted by syg00
There is, testdisk. It's on Knoppix. From a terminal, su to root (no password), and try running it - it won't actually update anything until you tell it to.

Quote:

Originally Posted by jagot
Testdisk doesn't find anything (says structure is OK) and neither does Acronis Disc Director.

Note: I've tried with testdisk 6.5 (latest stable).

Anyway, this is the output from fdisk -l regarding the harddisk in question:

Disk /dev/hdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 237274 235710 2134919109 0 Empty
Partition 1 does not end on cylinder boundary.
/dev/hdb2 ? 42814 40726 2130707177 ff BBT
Partition 2 does not end on cylinder boundary.
/dev/hdb3 ? 121600 121600 13+ ff BBT
Partition 3 does not end on cylinder boundary.
Is it possible to create a partition table manually from this data and place it on the harddisk?
Note that my harddisk was divided like this:

+-------------+-----------------+----------------+
|Empty ~154GB | hdb1 ext2 ~45GB | hdb2 swap ~1GB |
+-------------+-----------------+----------------+
Thus, there was no hdb3, as fdisk states.

ygloo 02-15-2007 01:41 PM

thinks that partition table is saved on several places on HDD as backup

syg00 02-15-2007 03:03 PM

Missed the note about testdisk - that's a worry.
I am not aware of any backup partition table(s).

You can always update the partition table with [c]fdisk. The problem is to get the start of the partition correct so the filesystem metadata can be found, and the partition mounted. With your guesstimate of your old layout I'd create say a 150 Gig dummy to cover most of the previously "empty" then give the rest to a "real" partition, and start recovery on that. Making it bigger (both ends) makes sure you get all the relevant data.

Then try something like photorec or foremost. Will take days, weeks maybe, to sort out probably.
Good luck.

Note: I never said your data was erased, merely "disappeared" - if you can't see/find something, it has disappeared. Regardless of whether it is still there or not.
Same as turning the light off at night - everything disappears.

jagot 02-16-2007 03:51 AM

My friend recommended a program he had called Partition Table Doctor. I tried it and it worked. The whole partition was found. No more worries.

Thanks for concern anyway.


All times are GMT -5. The time now is 06:33 PM.