0

I had my GRUB partition of 1 MB starting at block 2049. My BIOS did not recognize it, so I decided to move it to the beginning of the disk using the command

dd if=/dev/sda5 of=/dev/sda bs=512 count=2048

Now I cannot see the partitions at all. Before the operation the first 2048 segments( 1MB) had not format at all and where unrecognized by parted.

I made an image in other disk, dev/sdc, and running gdisk on the image got

sudo gdisk -l /dev/sdc
GPT fdisk (gdisk) version 0.8.8

Caution: invalid main GPT header, but valid backup; regenerating main header from backup!

Caution! After loading partitions, the CRC doesn't check out!
Warning! Main partition table CRC mismatch! Loaded backup partition table instead of main partition table!

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: damaged

Found invalid MBR and corrupt GPT. What do you want to do? (Using the GPT MAY permit recovery of GPT data.)
 1 - Use current GPT
 2 - Create blank GPT

Your answer: 1
Disk /dev/sdc: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 6FEB1F15-70D6-42F9-A4B8-6E960B8C65F5
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3437 sectors (1.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            4096      1887105023   899.8 GiB   8300  
   2      1887105024      1920333823   15.8 GiB    8300  
   3      1920333824      1944627199   11.6 GiB    8300  
   4      1944627200      1953523711   4.2 GiB     8200  
   5            2048            4095   1024.0 KiB  EF02

sfdisk -l /dev/sdc output still is

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util sfdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 121601 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature /dev/sdc: unrecognized partition table type

No partitions found

fsck -y /dev/sdc says

sudo fsck -y /dev/sdc
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superbloque es inválido, intentando los bloques de respaldo...
fsck.ext2: Bad magic number in super-block mientras se intentaba abrir /dev/sdc

 The superbloque could not be read or does not describe a valid ext2/ext3/ext4
 sistema de ficheros.  If the dispositivo is valid and it really contains an ext2/ext3/ext4
 sistema de ficheros (and not swap or ufs or something else), then the superbloque
 is corrupt, and you might try running e2fsck with an alternate superbloque:
     e2fsck -b 8193 <dispositivo>
 or
     e2fsck -b 32768 <dispositivo>

Is there is a way to recover my partitions or at least my data? I guess writing something else in these first segments should work.

Best,

Julian

  • 1
    Your sda starts at sector 0, which is the partition table. so your wrote sda5 to the entire drive. The dd nickname of data destroyer is for a reason. Your partitions are supposed to start at sector 2048. Was drive gpt? if so post this: sudo gdisk -l /dev/sda. – oldfred Feb 24 at 14:46
  • It is( still) supposed to bet GPT. Here is the paste – JDaich Feb 24 at 19:34
  • sudo gdisk -l /dev/sda GPT fdisk (gdisk) version 0.8.8 Caution: invalid main GPT header, but valid backup; regenerating main header from backup! Caution! After loading partitions, the CRC doesn't check out! Warning! Main partition table CRC mismatch! Loaded backup partition table instead of main partition table! Warning! One or more CRCs don't match. You should repair the disk! Partition table scan: MBR: not present BSD: not present APM: not present GPT: damaged – JDaich Feb 24 at 19:35
  • Found invalid MBR and corrupt GPT. What do you want to do? (Using the GPT MAY permit recovery of GPT data.) 1 - Use current GPT 2 - Create blank GPT – JDaich Feb 24 at 19:35
  • I guess have to use the first option. Finished the command with Ctr+ c however. – JDaich Feb 24 at 20:48
0

Solved with gdisk from live USB

sudo gdisk /dev/sda

1 Option b to save partition table at USB disk as sda.gpt file

2 Option r

3 Option l to load the save sda.gpt file from USB drive

3 Option w to finish

And voile!

Previous to that I made a backup with gddrescue

sudo apt-get install gddrescue
sudo ddrescue -f -r3 /dev/sda /dev/sdc PATH$/mapfile

and performed as trials the above steps at /dev/sdc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.