Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Recover HDD overridden with dd

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Pybash
Posts: 8
Joined: 2018-02-10 12:04

Recover HDD overridden with dd

#1 Post by Pybash »

Hi, I idiotically overrode my harddisk with dd

Code: Select all

dd if=mini.iso of=/dev/sdc bs=1M conv=sync
not interrupted or something, but
and choosed the wrong device(sdc instead of sdd).
I wanted to install a mini debian on my USB pen drive which is ~40 MB (compressed) and installed it on my 500GB USB-HDD.
I hope not everything is overridden.

So I probably wrote an
ext4 filesystem over a ntfs filesystem with 1 partition and a MS-Dos partition table
I guess.
(As these are the defaults)

Could I recover the data? And how exactly should I do this?

Im a little bit afraid, I could make it even more worse..
Last edited by Pybash on 2018-02-21 22:41, edited 3 times in total.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Recover HDD overridden with dd

#2 Post by GarryRicketson »

Could I recover the data? And how exactly should I do this?
Well you could just use the backup you made before you started messing with things, restore from the backup.
I hope not everything is overridden.

So I probably wrote an ext4 filesystem over a ntfs filesystem with 1 partition and a MS-Dos partition table I guess.

You hope, and probably, and you guess, but you do not show us anything, (use code boxes),
How ,exactly did you wrote the 'dd' command, ? What did it say when it finished ? or if you aborted it, how long did you let it run ? No details = no answers.
Ever wonder why your post isn't getting answered?
The third most likely reason is that you have not provided enough information on your problem for someone to help you. Try adding as much detailed information on the problem as you can along with what machine you have and it's specifications as well as specifically stating which version of Debian you are using.
============================================
What does it show, on the drive you wrote too ? You can use 'du' and 'df' to get information,

Code: Select all

man du
or 'man df'.

Did you try this, ?
Recover HDD overwritten with dd command

Pybash
Posts: 8
Joined: 2018-02-10 12:04

Re: Recover HDD overridden with dd

#3 Post by Pybash »

Well I have backup but not here at the moment,

and yes I havé read a lot things about recovering data
testdisk, photorec, ddrescue, scounge-ntfs
or with Windows
chkdsk, file inspector
and so on

And, well, there are at least 3 folders I would need to recover. which are all not bigger than 1Mb.

Pybash
Posts: 8
Joined: 2018-02-10 12:04

Re: Recover HDD overridden with dd

#4 Post by Pybash »

Code: Select all

df -hva /dev/sdc

/dev/sdc         34M   34M     0 100% /media/x/ISOIMAGE
 
And, ok making a backup or image of the disk, and hacking around until something works..

But maybe someone has experience how it would work?

Regards Pb

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1398
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 78 times
Been thanked: 173 times

Re: Recover HDD overridden with dd

#5 Post by steve_v »

The first ~40MB of that disk is gone. Testdisk may be able to reconstruct the partition table, but the filesystem will almost certainly be corrupted.
Restore from backup, that's what they're for.

FWIW, I use the long /dev/disk/by-id/ paths when doing destructive things, it makes it a lot harder to nuke the wrong drive by mistake.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Pybash
Posts: 8
Joined: 2018-02-10 12:04

Re: Recover HDD overridden with dd

#6 Post by Pybash »

Will have access to my backup in 10 days, but would like to get my working files to keep on working in between

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1398
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 78 times
Been thanked: 173 times

Re: Recover HDD overridden with dd

#7 Post by steve_v »

Testdisk + luck. If those files were not at the start of the disk, you might recover them.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

TonyT
Posts: 575
Joined: 2006-09-04 11:57

Re: Recover HDD overridden with dd

#8 Post by TonyT »

I used testdisk many times to recover previous partitions and files. Try it.

Post Reply