Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.