4

When I was installing Mint Debian edition unlike the classic edition, the installation automatically formated my home partition when I did not specify to format.

So the formatting previously was ext4 as is now. I believe the data is still there as it was a quick format.

I have now booted the computer up on a live USB to prevent writing on it. Ran testDisk. Is there anyway to recover to a previous superblock so i can recover my data?

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
Neovatar
  • 43
  • 1
  • 6

3 Answers3

5

Take a look at the e2fsprogs package. It seems that you can get all your backup superblocks from dumpe2fs /dev/sd<partition-id> | grep -i superblock and then have e2fsck check the FS for you, or just try to do mount -o sb=<output-of-dumpe2fs> /dev/sd<partition-id> /your/mountpoint with a backup superblock. See this for reference: http://www.cyberciti.biz/faq/linux-find-alternative-superblocks/.

testdisk works well to recover partition tables, not clobbered file systems. Photorec is a last resort when you have really messed things up and can't get any of the filesystem structure recovered.

Mad Physicist
  • 168
  • 1
  • 7
4

You will need to use TestDisk's sister program PhotoRec to recover your files. It's been a couple of years since I last used these programs, but IIRC you won't be able to recover them in-place, so I hope you have enough spare HD space to recover your files to.

It's a good idea to read through the relevant TestDisk & PhotoRec docs before you attempt to actually do the recovery work - using these programs when you don't know what you're doing can be a nerve-wracking experience...

If you have lots of spare storage, I suggest cloning the nuked partitions to image files, eg using dd. Both TestDisk & PhotoRec happily operate on such image files. That way, if you do make a mistake you'll only mess up your image files.

PM 2Ring
  • 6,553
  • 2
  • 27
  • 32
  • thanks for the reply. I'm a total noob at data recovery, It is possible to restore a previous superblock through TestDisk. Can I get my data back. – Neovatar Nov 20 '14 at 21:52
  • 1
    @user1976545: It's worth trying. As I said earlier, it's been a few years since I last used TestDisk and PhotoRec, so I'm certainly not an expert. But [this](http://www.cgsecurity.org/wiki/Data_Recovery_Examples#Recovery_of_reformatted_partition) might be helpful. But if you have the space I urge you to first clone the partition to an image file on another disk & work on the clone. If you need help making a partition image file, please ask another question. – PM 2Ring Nov 21 '14 at 07:55
2

I accidentally formatted an ext4 partition to NTFS in my Ubuntu 16.04 recently and was able to recover the full partition successfully by running a file system check.

sudo fsck.ext4 -v /dev/sda10

I recorded the steps in this blog post.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227