Ubuntu – How to recover lost partitions data


I have a 2TB SATA drive that was being used as file storage on my UBUNTU computer. I was re-imaging my windows box so I used that drive to back up some files to it. I did this by taking the drive from my windows PC and putting it in my UBUNTU PC, mounted it and copied the files over.

After the windows refresh I thought it would be easier to take the 2 TB drive and dock it in the external dock my Windows case has built in. Anyway it would recognize in BIOS but windows would not see it (because it was EXT3 or EXT4) so when I went into the disk manager it advised me the drive needed to be initialized. Me not thinking I initialized it as a GUID Partition table. Now it sees it as a blank drive, even in UBUNTU.

I have done nothing else to write or change the drive. I was wondering if there is a qay to repair the old partitioning and get access to my files back?

many thanks!

EDIT: I followed the instructions in the link @kniwor sent me. I used the command

sudo gpart -W /dev/sda /dev/sda

and here was the result:

Guessed primary partition table:
Primary partition(1)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 0mb #s(1) s(2861671176-2861671176)
   chs:  (1023/254/63)-(1023/254/63)d (178130/202/1)-(178130/202/1)r

Primary partition(2)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 0mb #s(1) s(3484550160-3484550160)
   chs:  (1023/254/63)-(1023/254/63)d (216903/55/1)-(216903/55/1)r

Primary partition(3)
   type: 000(0x00)(unused)
   size: 0mb #s(0) s(0-0)
   chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Primary partition(4)
   type: 000(0x00)(unused)
   size: 0mb #s(0) s(0-0)
   chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r

Not sure it found what I wanted. suggestions?

Best Answer

As long as you have not written any data on the file, you can try recreating the old partition table and everything should be fine. This guide here has some tools that can help you do that


Related Question