LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 02-14-2007, 03:48 PM   #1
jagot
LQ Newbie
 
Registered: Jun 2005
Location: Malmoe, Sweden
Distribution: OpenSUSE 11.0
Posts: 28

Rep: Reputation: 15
Exclamation 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
 
Old 02-14-2007, 05:44 PM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 46
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.
 
Old 02-14-2007, 06:35 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,504

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
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).
 
Old 02-14-2007, 06:39 PM   #4
dracolich
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 1,173

Rep: Reputation: 47
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.
 
Old 02-15-2007, 03:37 AM   #5
jagot
LQ Newbie
 
Registered: Jun 2005
Location: Malmoe, Sweden
Distribution: OpenSUSE 11.0
Posts: 28

Original Poster
Rep: Reputation: 15
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
 
Old 02-15-2007, 04:01 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,504

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
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.
 
Old 02-15-2007, 01:54 PM   #7
jagot
LQ Newbie
 
Registered: Jun 2005
Location: Malmoe, Sweden
Distribution: OpenSUSE 11.0
Posts: 28

Original Poster
Rep: Reputation: 15
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.
 
Old 02-15-2007, 02:41 PM   #8
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
thinks that partition table is saved on several places on HDD as backup
 
Old 02-15-2007, 04:03 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,504

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
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.
 
Old 02-16-2007, 04:51 AM   #10
jagot
LQ Newbie
 
Registered: Jun 2005
Location: Malmoe, Sweden
Distribution: OpenSUSE 11.0
Posts: 28

Original Poster
Rep: Reputation: 15
Cool

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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are ext2 files lost after mkfs??? atesz Linux - General 4 08-31-2004 02:52 AM
How To Format A Partition Into Ext2 ? Help lemon_hou Linux - Hardware 1 04-27-2004 05:30 AM
ext2 partition screwed? LGBR Linux - General 4 08-03-2003 09:27 PM
how to resize a ext2 partition? Thievery Linux - Newbie 3 03-21-2002 06:19 AM
Resizing an Ext2 partition PuterFreaK Linux - General 8 03-15-2002 01:21 AM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration