Tuesday, July 9, 2019

linux - Accidentally overwrote wrong disk with dd, how to recover?

I wanted to dd an image from sdb to sdc, but because one hour before I had set up things differently, I just copied the same command:


dd if=/home/user/Downloads/ubuntu.iso  of=/dev/rsdb bs=2M; sync

sda = internal hard drive
sdb = USB hard drive (booted from right now)
sdc = USB stick


There are 3 partitions on the hard drive I've booted from, I guess the other 2 are in read only mode, and the error in shell as I tried two times:


568328192 bytes (568 MB) copied, 38,5818 s, 14,7 MB/s
dd: error writing ‘/dev/rsdb’: No space left on device
715128832 bytes (715 MB) copied, 17,1752 s, 41,6 MB/s

Now I realized I overwrote 1GB over the hard drive I'm booted from (using rsdb). I haven't turned off my computer. Will I loose all data on this drive? Can I recover anything now?


Here’s my /proc/partitions:


   8        0  156290904 sda
8 1 154218496 sda1
8 2 1 sda2
8 5 2069504 sda5
8 16 244198582 sdb
8 17 31457280 sdb1
8 18 20971520 sdb2
8 19 191768576 sdb3
8 32 2011136 sdc
8 33 2011135 sdc1

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...