Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: recovering data from backup disk after using dd command

  1. #1
    Join Date
    Jul 2020
    Beans
    7

    Unhappy recovering data from backup disk after using dd command

    It was first time, I was using "dd" to clone my old hdd(sdc1-150gb partition) to one of my ntfs partition(sda5-762gb partition) using command below

    So sda5 already had aprrox 500gb data and was free 250gb+ aprrox, I did not know it would delete my important data

    This was the command which I did

    Code:
    sudo dd if=/dev/sdc1 of=/dev/sda5 bs=64k
    Now my old sda5 data is not not showing, didn't know that would happen tbh

    I immediately disconnect the drive as soon as I saw my partition is not there which is barely few seconds.
    I'm attaching the info here for you guys to see

    Code:
    /dev/sda2        96M   44M   53M  46% /boot/efi
    /dev/sda8       386G   24G  343G   7% /home
    /dev/sda5       150G   72G   78G  49% /media/kshmr/A4A27A23A279FA5E
    /dev/sda4       460M  398M   63M  87% /media/kshmr/CC2CD5D52CD5BAA2
    /dev/sda6       501G  282G  220G  57% /media/kshmr/One
    /dev/sda7       108G   12G   96G  11% /media/kshmr/Two
    
    Device          Start        End    Sectors  Size Type
    /dev/sda1      923648    1945599    1021952  499M Windows recovery environment
    /dev/sda2     1945600    2150399     204800  100M EFI System
    /dev/sda3     2150400    2183167      32768   16M Microsoft reserved
    /dev/sda4   208771072  209713151     942080  460M Microsoft basic data
    /dev/sda5   209715200 1807775743 1598060544  762G Microsoft basic data
    /dev/sda6  1807777792 2858448895 1050671104  501G Microsoft basic data
    /dev/sda7  2858450944 3082911743  224460800  107G Microsoft basic data
    /dev/sda8  3082911744 3907028991  824117248  393G Linux filesystem
    /dev/sda9     2183168  208771071  206587904 98.5G Linux swap
    So it seems my old data is still there but I'm not able to access it, anyone knows how can I recover or go back to previous state, any help would be appreciated, had really important data
    Last edited by wildmanne39; July 1st, 2020 at 03:45 AM. Reason: Reset fonts

  2. #2
    Join Date
    Apr 2008
    Location
    Southern California, USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: recovering data from backup disk after using dd command

    try running testdisk

  3. #3
    Join Date
    Jul 2020
    Beans
    7

    Re: recovering data from backup disk after using dd command

    seems like testdisk is searching for deleted data in new partiton that has been created and not the old partition

  4. #4
    Join Date
    Feb 2008
    Location
    Texas
    Beans
    28,840
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: recovering data from backup disk after using dd command

    Please use the default font color and properties unless you need to highlight or draw attention to a part of your post.

  5. #5
    Join Date
    Apr 2008
    Location
    Southern California, USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: recovering data from backup disk after using dd command

    Quote Originally Posted by kshmr2 View Post
    seems like testdisk is searching for deleted data in new partiton that has been created and not the old partition
    You have to direct testdisk what dev/drive to use.

  6. #6
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    5,295
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: recovering data from backup disk after using dd command

    You've overwritten the first 150GB of sda5, which is now a 762GB partition with a 150GB filesystem. 80% of your files (including partial files) may be recoverable using testdisk. They can be found between sector 509000000 and sector 1807775743. I've never needed testdisk myself; I prefer to rely on backups. The other 20% is gone.

    I guess you now understand why dd is nicknamed data destroyer.

  7. #7
    Join Date
    Oct 2005
    Location
    Al Ain
    Beans
    9,972

    Re: recovering data from backup disk after using dd command

    To be fair to the poor and frequently misunderstood dd - one can do the exact same destruction with several other utilities, for example cat.

  8. #8
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: recovering data from backup disk after using dd command

    Quote Originally Posted by HermanAB View Post
    To be fair to the poor and frequently misunderstood dd - one can do the exact same destruction with several other utilities, for example cat.
    This is true.

    But it is a problem that many people use dd for this purpose, to write to drives (block devices). I recommend to use tools with a final checkpoint, where the user gets information about the target device and can double-check that it is pointing to the correct drive before starting the cloning process.

    Disks (gnome-disks) and mkusb and the Ubuntu Startup Disk Creator are such tools for cloning. A more advanced tool is Clonezilla, which creates an image that consists of a set of compressed image files, and that is smart enough to only copy used blocks (and skip free blocks in the file systems).
    Last edited by ajgreeny; July 1st, 2020 at 10:55 AM. Reason: Corrected inaccurate bold/italic tags

  9. #9
    Join Date
    Jul 2020
    Beans
    7

    Re: recovering data from backup disk after using dd command

    Quote Originally Posted by VMC View Post
    You have to direct testdisk what dev/drive to use.
    Yes sir I did select the drive which I wanted to recover the data from and unfortunately testdisk did not help me much, I used few tools like photorec and few windows tools, I was able to recover 30-40% of my data

  10. #10
    Join Date
    Jul 2020
    Beans
    7

    Re: recovering data from backup disk after using dd command

    Quote Originally Posted by Impavidus View Post
    You've overwritten the first 150GB of sda5, which is now a 762GB partition with a 150GB filesystem. 80% of your files (including partial files) may be recoverable using testdisk. They can be found between sector 509000000 and sector 1807775743. I've never needed testdisk myself; I prefer to rely on backups. The other 20% is gone.

    I guess you now understand why dd is nicknamed data destroyer.
    Yeah now I very well understood dd and also I did cancel the operation as soon as I started with cause I've this habit to check that data is going in right partition. Learned a lesson well
    Last edited by kshmr2; July 1st, 2020 at 02:16 PM. Reason: spell correction

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •