I have an external HD formatted to ext4. Somehow a directory is now showing up as a file (i.e. it is missing the 'd' in the attributes). fsck does not show any errors. I don't believe that the directory was overwritten by a file, but rather something has been corrupted. How can I change the file back into a directory?

  • Run file DIRNAME when you're in the folder for the external HD. See if it says if it's a file or directory. If it says "File" then it was overwritten somehow and the directory is likely 'gone'. if it says "Directory" then there's something weird going on, though you should still be able to cd into the directory. – Thomas Ward Jan 18 '16 at 19:11
  • 1
    It returns "ISO-8859 text, with no line terminators" so that directory is gone. However I have found most of my files in the lost+found. Now to figure out how to get them out of there... – Nathan Peacock Jan 18 '16 at 19:18
  • Read man mv, man sudo. You have missed the fsck output that would have explained. – waltinator Jan 19 '16 at 0:41

Your Answer

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

Browse other questions tagged or ask your own question.