Is it possible to recover from a mke2fs -j /dev/hdxx?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
Is it possible to recover from a mke2fs -j /dev/hdxx?
I feel like such a noob. I went on vacation for about a week and came back and realized that my system had rebooted and was at the interactive boot (Probably a California brownout). My UPS is toast and I'm a little bit panicky at this point.
Here is the jist of what happened. It was complaing about the journal on my hdb1 and told me to run fsck.ext3 manually so I did. It started compaining about have a bad super block and all and suggested I use an alternate superblock.
I tried that and all of the other onse to no availe. Either it would compalian again about a bad super block or that the magic number block was incorrect. So I start looking thru man pages for fsck.xt3, e2fsck, and mke2fs.
Basically, since it would not mount as an ext3 fs because a bad journal and trying e2fsck to fix it, I tried to mount the drive as an ext2 thinking that it would ignore the borked journal, wrong. I could only see a lost and found folder with nothing in it. The drive reported that it had ~ 8gb free (which was right) but I could not see any of it.
So I thought I understood enough of what I was trying to do so I tried to research how to recreate the journal and I looked at a post that had the same issue as me. Well some smart people suggested to try mke2fs -j /dev/hdxx and that it would rebuild the journal and all should be well as long as data had not been written to the drive since the borked journal.
Well now, I have and hd that stated that it only has 137mb of data written to it and that it is 0.0% non contiguous (instead of 8.5% with 139 gb written to it.)
I just want to know if I can restore my data because this was my only backup/long term storage device. I cut and paste the things that I don't need on my everyday hd (Now I will use rsync).
In principle, at least some data is recoverable. When you format with a filesystem, it simply sets up the infrastructure on the disk--it does not overwrite every byte. The most often cited tool is "photorec"--available here: http://www.cgsecurity.org/wiki/PhotoRec
You will need to be running from a different partition--ideally from a different physical drive, and you will need space (not on the "problem" drive) to put whatever files are found. If nothing else, buy a large USB external drive--when it's all over, use the external for backups.
Thanks for the info. I have been looking into testdisk and photorec. I had no luck with testdisk but I have read that photorec has issues with files larger than 30-50mb. This is because it fragments files.
I will start freeing up space on one of my barrowed hds. Now would it be best to dd the formated hd to an image and work from the image or work directly from the srive. I am going to do a byte for byte copy of the drive before i work on it.
Work from an image - you can always recreate the image from the original again when you screw up the image.
Be aware that for uncommitted journal entries you have potentially partially updated files on disk. Interpret that as corrupt. Which you don't know about, and which you'll never be able to determine.
Which might not be a problem, or might bite you at some indeterminate time in the future.
When I had similar (lightning prone area) I threw *all* the data away as I couldn't trust it. Hard way to learn the value of backups.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.