LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Recover Formatted Partition (https://www.linuxquestions.org/questions/linux-software-2/recover-formatted-partition-4175470168/)

astro.alireza 07-19-2013 02:42 AM

Recover Formatted Partition
 
Hi Friends
My VPS powers off without shutdown and after booting, it can't mount root partition because of file system errors.
I try to check file system with this command:
e2fsck -b <superblock> /dev/sda1
That I can find alternative "superblocks" with this command:
mke2fs -n /dev/sda1
But I made a mistake and run this:
mke2fs /dev/sda1
So my partition formatted and I lost my data.
Is there any solution for recovering partition with all of its directory and file names?

TobiSGD 07-19-2013 05:43 AM

It may be possible to find that data using Testdisk, if not you will have to go the Photorec route, which means recovering without directory structure and filenames.

syg00 07-19-2013 06:25 AM

I've had some success with "mke2fs -S ..." (capital S, read the manpage) after testing with mkfs.ntfs over a newly created ext3 filesystem. Had some test files in it, and all were recovered but it was a test system only - no fragmented files, nothing I cared about.

Take a backup, and try it

goumba 07-19-2013 06:58 AM

The bad thing about e*fs is the superblocks always end up int he same place fior a same sized partition.

Make a backup of that partition if you have the space elsewhere, using dd or the like, and work off of that backup image. Try not to mess with the original partition too much or you decrease your chances of successful recovery.

As stated you can use photorec as a last resort. You'll lose all filename information, and your best results will come from known file types (those with metadata with specific headers, size information, etc). If you have any file types unknown to photorec, it won't do such a good job (although I think you can add file information via metadata, I've never tried it).


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