The other day I deleted by mistake all files in a NTFS basic data partition using rm -rf. This partition is separated from Microsoft reserved partition, and EFI system partition among others, so I can boot my PC normally and select different OS at the GRUB2 menu. However, if I select to boot Windows 8.1 (stored in that partition) nothing happens, and the PC reboots.

I guess that partition table is OK, and I presume that it's possible to recover all files and the structure of directories they belonged to, so I would be able to restore and use that NTFS partition with Windows.

I think I can achieve this using a debugfs-like tool, but since file system is NTFS it seems to not work (I get Bad magic number in superior-block while opening filesystem error).

I also have read about other tools to recover files in NTFS such as photorec, but for what I've seen in some tutorials, it justs recovers files, and does not organise them as they were in their original state.

So the first question is: is it possible to recover not only the deleted files, but the structure of directories they had using Linux from a separated partition/disk? If affirmative, how?

Thank you.

  • So is for programming questions, not computer technical support.
    – Barmar
    Aug 29, 2016 at 18:28
  • You might find this article of help : askubuntu.com/questions/59968/… . Good luck.
    – shellter
    Aug 29, 2016 at 19:14
  • 2
    Have you already checked with Testdisk? Aug 31, 2016 at 9:48
  • By the way, see the related answer here for the general case (both damaged and working NTFS): unix.stackexchange.com/a/283009/84179 Aug 31, 2016 at 11:56
  • Using TestDisk, click through device and type to Advanced.. in partition selection, pay attention to the bottom for Undelete. Then select a different drive to save to. I believe its possible to write a script using fls from TestDisk to recover from a single directory if that is needed or when the TD single selection is tedious.. see this answer here: unix.stackexchange.com/a/390174/346155
    – alchemy
    Apr 30, 2020 at 18:08

1 Answer 1


No, there is no way to get back the file system structure.

Recovery software typically gets the files from low level information on the hard disk. At that level, the data doesn't have the same structure like the common structure which we see in a file explorer.

  • 4
    This is totally not true. There are multiple ways to accomplish the desired result. Aug 31, 2016 at 9:47
  • @AndreaLazzarotto Such as?
    – ojchase
    Apr 5, 2021 at 15:13
  • @ojchase such as the options I linked under the comments of the question, above. For your convenience, here's a link: unix.stackexchange.com/a/283009/84179 Apr 5, 2021 at 22:00
  • @AndreaLazzarotto Heh. That was embarrassingly obvious wasn't it? Thanks!
    – ojchase
    Apr 9, 2021 at 7:18
  • @ojchase no worries. Apr 11, 2021 at 17:44

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.