-   Linux - General (
-   -   Reformatted ext3 filesystem - recover? (

addy86 01-06-2005 07:42 AM

Reformatted ext3 filesystem - recover?
I couldn't find this with Search, and I hope that this is the right forum.

I just executed
mke2fs -T largefile4 -j -F /dev/hdb6
ignoring all warnings (how can a single person be so stupid?!). Unfortunately, /dev/hdb6 is/was my home directory (ext3, with ~35 GiB of data), while I had intended to format /dev/hda6.
I immediately rebooted my computer (after mke2fs completed, but without shutdown), and didn't mount /dev/hdb6 since that accident (I'm currently using Knoppix).

Is there any chance to recover at least parts of my filesystem? grep won't help much since many (important) files are/were binary.

Please help me


oneandoneis2 01-06-2005 09:01 AM

As I recall, formatting erases data logically, but not physically. So most of the info IS still there.

But I'm damned if I can remember how to get hold of it again. . .

addy86 01-06-2005 11:32 AM

I just tried to mount the partition, but it tells me something about a bad superblock, so not everything has been overwritten (otherwise mounting should have been no problem).

Valindar 01-06-2005 01:05 PM

I have no experience in recovering data, however a quick google yielded some ext2 (ext2 tools work on ext3) recovery tools:
There are links to other programs on that site if those don't suit your needs.

A bad superblock shouldn't matter, as the data would still be there.

Good luck, and post your results, I'm interested in whether it works out or not!

oneandoneis2 01-06-2005 01:32 PM


I just tried to mount the partition, but it tells me something about a bad superblock, so not everything has been overwritten (otherwise mounting should have been no problem).
No, that's not the case.

A superblock is located at position 0 of every partition, contains vital information about the filesystem and is needed at a fielsystem check.
You didn't physically delete the information in the partition. You destroyed the information that allows you to mount it. That's very different.

Take a look at

addy86 01-08-2005 03:42 AM

I have recovered probably 100 % of my data, although there are a lot of directories and files I couldn't associate with their right name (all of them were configuration files of KDE programs).
For those who are interested:
I made a backup of the complete partition, then tried to repair as good as possible:
e2fsck -b 32768 -y backup.copy
mount -o loop backup.copy backup.fs

The file system couldn't be recovered, but all top-level files and directories under my home directory were in lost+found, plus those KDE configuration files.

Thanks for the information about the superblock; unfortunately I couldn't compile e2retrieve.

Valindar 01-08-2005 05:34 AM

Cool! Out of interest, what was the problem in compiling e2retrieve? ie. the errors you got, or missing dependancies? It's always good to know the reason why you can't compile something even if you decide not to bother, might help you in the future when you have trouble compiling something else.

addy86 01-09-2005 03:04 AM

'/usr/include/linux/bitmap.h' had undefined preprocessor macros, like BITS_PER_LONG, DECLARE_BITMAP and more. It turned out that these macros were only defined when __KERNEL__ was defined. However, when I defined __KERNEL__, other errors occured (as expected).
Btw. I am using Debian testing.

Valindar 01-09-2005 06:03 AM

No clue, I don't even *have* an /usr/include/linux/bitmap.h... ah well. Must be part of a package I don't have.

addy86 01-09-2005 09:14 AM

Maybe you have older (or newer) linux-kernel-headers (e.g. from 2.4).

Valindar 01-09-2005 11:18 AM

My kernel headers would be for my current kernel version, as I compile all my kernels myself.

addy86 01-10-2005 12:49 AM

So do I :) But I do not copy the headers from the Linux sources to my /usr/include.

All times are GMT -5. The time now is 07:07 AM.