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.

  • sun_is_ra
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    this clones one parition to another which is fine if you have free partition with enough space lying around. My code was for taking compressed backup of the partition to be restored later if needed. Its less convenient but doesnt require as much space nor does it require an entire partition

    • aodhsishaj@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Don’t you have to read the partition to compress it, which is fine on a healthy partition but can further damage a broken one?

      • sun_is_ra
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        1 year ago

        depends on what you mean by “broken”. If broken means has bad sector or other hardware issue, then yes OP should transfer data to healthy partition and work from there. though it certainly won’t hurt if he attempted to recover data from broken partition (worst the HD dies and OP restore the backup on healthy HD) However he said “i broke my partition” which make me think its software issue, not hardware. in which case, would be faster to recover data directly after taking backup