1

good day to all!

I goofed.

In prepping for a migration .. I DD'ed a drive to another spare to have a backup of the files.

Then I booted next weekend not knowing that I mounted the 2nd DD'ed backup drive (due to duplicate UUID's ... dummy me).

I did some small work thinking it was on the primary drive not the backup.

I then did RM-rf on one drive ... removed what I thought was the good drive ... rebooted ... and deleted the partition on the second drive thinking it was the 1st.

I have since learned not to DD a drive and leave it in there for the next boot.

Trouble is: ... I have one drive with the partition but RM-rf all files of my /home ... ... and another drive with the files intact but the partition deleted.

I would be happy with either due to the small amount of work done.

How do I get the partition data from the drive that was only RM -rf ... and restore it to the other drive that only had the partition deleted?

... or should I try to un-delete the data one the drive that was RM-rf?

18.04.1 Ubuntu.

Thanks!

  • Does testdisk show and allow you to restore missing partition? Or parted rescue? And deeper search in testdisk show files? Not sure any way to recover rm's files other than photorec which does not restore file names, just extensions. http://www.cgsecurity.org/wiki/TestDisk & https://help.ubuntu.com/community/DataRecovery#Lost_Partition – oldfred Nov 18 '18 at 20:45
  • but isn't there a way to backup the GPT partition info from the one disk that still has the partition intact ... then restore to the other disk that just had the partition deleted? ... after all I did dd if=/dev/sda of=/dev/sdb – DurararaC Nov 18 '18 at 21:00
  • Run this on both disks and compare file: sudo sfdisk -d /dev/sda > PT_sda.txt & sudo sfdisk -d /dev/sdb > PT_sdb.txt But since gpt you have to use a newer sfdisk like in 18.04. Old versions like in 16.04 do not support gpt disks. You might be able to combine them and restore to one drive or other. – oldfred Nov 18 '18 at 21:09
  • label: gpt label-id: F3441B35-CE83-460E-958B-AA79936F4EC9 device: /dev/sda unit: sectors first-lba: 34 last-lba: 9767541134

    /dev/sda1 : start= 2048, size= 15998976, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=EB748AF4-96D9-4A62-9EF3-B6A3A542AE93 /dev/sda3 : start= 16001024, size= 16001024, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=17773877-1FF8-42C4-ADAA-AE01DB9DB6E8

    – DurararaC Nov 18 '18 at 21:16
  • label: gpt label-id: F3441B35-CE83-460E-958B-AA79936F4EC9 device: /dev/sdb unit: sectors first-lba: 34 last-lba: 9767541134

    /dev/sdb4 : start= 32002048, size= 9467791360, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=115ADD15-1962-48F8-B3CE-42C32B6C2369

    – DurararaC Nov 18 '18 at 21:17
  • /dev/sda1 and /dev/sda3 are not related to this issue ... old tmp and var which also existed on the other drive at one point. – DurararaC Nov 18 '18 at 21:19
  • so given the info on partition # 4 (my /home I care about) ... is the start and end all I need? ... how do I restore? ... Thanks! – DurararaC Nov 18 '18 at 21:41
  • If you know start & end, probably better to use parted rescue. Or testdisk. You can manually edit the text file and use sfdisk to restore, but edit has to be precise or you create bigger issues. Parted rescue seems easier than testdisk https://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition & http://ubuntuforums.org/showthread.php?t=1775331 & https://www.gnu.org/software/parted/manual/parted.html#rescue – oldfred Nov 18 '18 at 23:16
  • when I run sudo parted /dev/sda ... then rescue 32002048 9499793407 ... it scans with a percent for a while then comes back with nothing but the (parted) prompt. – DurararaC Nov 22 '18 at 18:54

0 Answers0