Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I am new user of Linux and i use Fedora 7 due to official needs. Recently i added a new hard disk and mounted as dev/sdb1 and updated my fstab file too. I stored some important data in this drive.Last week i tried writing an .img to a compact flash card connected as dev/sdc1 but ended up in specifying the destination as /dev/sdb1. Now all my data that was present in /dev/sdb1 has gone.
Try to find if this can help you out. (...)R-Linux.html
Not to smack you down for your reply and posting that link but how would that help him? If you must post links on this subject I would suggest next time you search Linuxquestions for terms like "file recovery" "undelete" and such and read a few of those threads because there's a huge difference between deleting files (unlink, journalling), reformatting a partition (filesystem structure change) and overwriting the filesystem structure and contents (equivalent to sort of uncontrolled, sloppy "wiping"). Much has been written about it to the point that you don't have to "try to find if it can help" but can say that overwriting a large chunk of diskspace means that items previously occupying that space are lost (partially if on the boundary of the write), that making a backup would be the first thing to do next, that recovering the partition table can be attempted with Testdisk and that for recovering the partial filesystem and files beyond the overwritten area often-used applications are Photorec and Foremost.
'dd' has overwritten your partition for the length of the '.img' file. All content beyond that length is still valid, but not accessible. You will need to set up all meta-information (nodes, etc) again, somehow masking out the over-written part. This needs an amount of skills and time that is usually out of question, unless your data is extremely important and worth a few thousand USD.
As an alternative you could write the hard-disk contents to an image file with dd, then browse that (large) file with a hex-editor or rather a custom program to search for a few specified file-types that you need. Some files like JPEG, TIFF, etc have easy to trace file headers and predictable file-endings, so these can be relatively easily extracted from that image file. You need to know what you are looking for.
Either way - there is no easy solution. For fast results you should consider a professional service provider for data recovery, and prepare for relevant costs. On the long term regular backups are the cheapest solution.
I would suggest that you give photorec a try, it's free and it works great in many cases. It has helped me out in one or two cases where I accidentally formatted the wrong partition. Now your situation is rather different since you also overwrote at least part of the data but, who knows, maybe they were written to a location that wasn't used yet.
In order to use photorec you'll need a back-up partition or drive that is at the very least the size of the one you are trying to recover (should be larger, actually, as photorec will also turn up things that you thought you deleted a long time ago). Bear in mind your files will be restored using numbers for names so you'll have to sort and rename them manually. Also it obviously will not be any good to restore system data. And the larger the file, the more likely it is to fail. For example, I have found that movie files in particular tend to be irrecoverable. It's still very much worth a try, though.
The situation got more worse. When i restarted the system, it was not able to boot in Fedora reporting that the file system is corrupted and forced to use fsck from the shell. When i issued the command with default byte sizes, the problem was resolved but my drive shows only 10MB of disk space against 80 GB.
Is there a way to connect this Hard disk to a different linux machine and try out something to get the data?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.