While I was switching distros, I accidentally broke a partition. I’m almost certain that all the data is there, but it doesn’t have a filesystem (I used ext4). Is there anything I can do to fix it, similar to changing the file extension without changing the contents. PS: It’s a data partition. I was trying to resize it, accidentally also moved it to the left, found out that it was taking forever to move it, so I cancelled it. Finished the move to the left operation (I think), but it threw up an error about the filesystem. I don’t remember what it was, though.

Thanks to everyone who suggested Testdisk. It worked almost perfectly.

  • lurch@sh.itjust.works
    link
    fedilink
    arrow-up
    39
    ·
    edit-2
    7 months ago

    before you change anything it would be good to use dd and save the whole drive to a bigger drive or maybe compress it with gzip while using dd to save it to a slightly smaller one. That takes a very long time, but gives you the ability to start over with your recovery. Only do that if it’s worth to wait several hours.

    photorec can also recover some files by looking at the raw data still there, if all else fails.

    • vzq@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      25
      ·
      edit-2
      7 months ago

      That’s what people always underestimate about data recovery jobs: you need lots of space. One copy for safekeeping. One to work on. One disk of the same size you store recovered files on.

      Whenever friends or family ask me to look at a disk I always tell them to give me the disk and two new ones of the same or greater capacity and I’ll give it a shot. Usually they discover the data isn’t that important after all. If it is I have all I need.

    • sun_is_ra@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      8
      ·
      7 months ago

      use dd and save the whole drive to a bigger drive or maybe compress it with gzip while using dd to save it to a slightly smaller one

      command would be something like this:

      dd if=/dev/…/myparition|gzip status=progress > /mnt/external_hd/mypartition.gzip