My disk was dos labelled (MBR). So I ‘fdisk’-ed my disk and entered ‘o’ to convert it to GPT and wrote it to the disk. Now all the partitions are gone. I want those back. I care about the data rather than the partitions

Edit 0:

Solution:

  • install testdisk
  • run testdisk
  • choose “Create” log
  • choose target disk. Eg: /dev/sda
  • Choose appropriate partition type. Mine was MBR and I chose “Intel” and select “analyze”
  • Now you’ll see deleted partitions. Giveem appropriate flags like “*” for boot (efi partition) and “P” any other using space or arrow keys and press enter
  • choose “write” and press y on the prompt to write those found partitions to the disk.

Thanks guys for the help

  • orsetto@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    9
    ·
    1 day ago

    Unfortunately changing from MBR to GPT also deletes existing partitions and partition table, because the two are not compatible.

    Luckily, testdisk should be able to recover the old partition table without much fuss, if you didn’t write other data to the disk.

    I don’t have a manual handy but the man page from what i remember is pretty clear, and there’s also an online documentation.

    • ReversalHatchery@beehaw.org
      link
      fedilink
      arrow-up
      1
      ·
      20 hours ago

      MBR can be converted to GPT. gdisk can do it, in fact if you run it for an MBR structured disk it will automatically do the conversion in memory, and you can check the results before writing it out. windows also has a tool for that.

      • orsetto@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        2
        ·
        3 hours ago

        Oh yeah i figured there were some tools able to do that, i meant to say that you can’t substitute one with the other in place without doing some sort of conversion.

      • orsetto@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        2
        ·
        3 hours ago

        sorry for the late reply. I honestly do not remember what the procedure is. The best thing you can do is look on the internet for a easy to follow guide, or wait for someone else’s response