[SOLVED] Restoring data after a dd command on wrong drive but this drive was previously mounted
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.
Restoring data after a dd command on wrong drive but this drive was previously mounted
I searched a lot on internet but I didn't managed to get a single thing which could help me. I am totally panicked right now. I am new to Linux and wanted to try out Kali to learn things.
So I was on a LiveCD of Kali trying to install it on a USB Key. The .iso file was on my Windows so I mounted the partition So my sdb1 data was mounted to /root/mnt At this point I used dd to create a bootable USB but I typed sdb instead of sdc...
So what can I do to back up my data I just wiped, if it is even possible?
TLDR I have access to files on a mounted point but the disk that contains them has been wiped up. What can I do to get back the normal partition with the backed up files?
What filesystem was on sdb1? If it was an NTFS Windows partition, you're going to have to use Windows tools to attempt repair.
How large was that partition? (If it was using the whole device, just the size of the device.)
What was the size of the ISO that you copied there?
All of the data that was overwritten by that ISO is forever lost. Depending on the filesystem type and the relative sizes, much of the rest might be recoverable.
Don't do anything that writes to that device without first saving a complete image of, preferably, the complete device, or at least the space occupied by the partitions (the entire partitions) that were touched by that dd operation. When initial attempts at repair do not succeed, they can make matters much worse.
Hi,
Thanks for your response.
1. It was in NTFS. It was the secondary drive of my Windows installation (128 Go SSD - which is intact - and 1 To HDD).
2. It was the while thing, 1 To.
3. The ISO was 2.8 Go I think.
I have no external drive, but I'll manage to find one; also, how do I save a complete image of my drive?
Even before I read your answer, I started a tool named EaseUS data recovery. It looks like it found my lost data - I see my whole file hierarchy.
What should I do now?
Also, thanks for your answer and help. It is much appreciated in such panick circumstances...
You were fortunate that only about 0.3% of that filesystem was overwritten, and the major index structure is apparently intact. The obvious next step is to copy the data you want to save somewhere else. Then, you can repartition and reformat with a new filesystem. Since it appears that you can recover the data without having to write to this drive, there is no need for a backup image, just somewhere to hold your data while you reformat.
I managed to have some drive to restore data on, but I can't find any reliable software which can help me recover my data. The one I mentionned before scanned it well but refused to let me recover anything. May you help me on this point? Thank you.
Apparently you are using the "Free Trial" version of EaseUS, and just shows you what it found without letting you recover anything. This is a Windows NTFS problem, not a Linux problem. You can buy the paid version of EaseUS, look around for other, free NTFS recovery tools, or ask in a Windows support group for advice. I'm at the limit of what I can offer.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.