Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had an ext3 partition. I ran a dd command like this:

dd if=/dev/urandom of=/dev/part2 bs=1024 count=15000 seek="various values"

Where various values are basically 0, 15000K, 30000K etc.

The point is I ran the dd command on the entire partition.

Now the partition won't mount. I get an error "Can't find ext3 partition on ..."


  1. What exactly happened to the partition? I know it got corrupted, but what exactly happened? As a clue fsck /dev/part2 gives "The superblock could not be read or does not describe a correct ext2 filesystem."

  2. How do I format it back to ext3?

share|improve this question
up vote 4 down vote accepted

You overwrote and/or corrupted superblock(s), and likely other data, with the data from /dev/urandom. Superblocks are important; they contain filesystem metadata.

You can format it back to ext3 by issuing mkfs.ext3 /dev/part2.

share|improve this answer
thanks, that worked. Appreciate it. So what I was trying to do is basically write data to filesystem at various offsets. I think I should not have written directly to the device file. Can you please check a question I have posted here at Stackoverflow. stackoverflow.com/questions/9594073/… – abc Mar 7 '12 at 1:11
@abc - I agree with everything Perry said, don't do it. – Chris Down Mar 7 '12 at 1:38

If you are desperate about getting back the ext3 filesystem, you can run e2fsck with the -b NUM parameter, where NUM is the alternate superblock. Read the man page for e2fsck to get that number. Depending on the blocksize of the partition, you might have not overwritten it.

share|improve this answer
I wouldn't recommend even trying this once data has been written directly to the device. More than likely even if it initially appears to work, all hell will break loose. – Chris Down Mar 7 '12 at 1:44
It'll be a data recovery mission at best, since a lot must have been overwritten. It won't become a usable filesystem. – XTL Mar 7 '12 at 8:24

Another thing one could try in this situation is the program gpart. It attempts to guess missing partition (and filesystem) information - so, it might be able to recover that partition well enough to pull data off of it.

As the comments to jsbillings answer suggest, do not rely on the partition after this; this is recovery - pull off your data and make a new partition. (Other standard recovery tips/rules apply, too - like, "make an image, and work on that, not the original.")

(And yes, I realize this is too late to help the OP. Might help others, though.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.