Linux – How to recover a directory and all its contents from an XFS File System on Centos 7

linux

This post has been modified as I have now found out that the file system on our Centos Boxes use XFS.

I have been reading about debugfs and how it can be used to recover deleted files. However, I have not been able to find or see an example where it be used to recover a directory containing sub directories and its contents to a new directory on the file system.

Or is there a simple way of recovering directories and files on an XFS file system. I am looking for a solution for a Live mounted server

Does anyone know I can do this?

Best Answer

debugfs isn't automated, so you'd have to do it one by one - first undel the top level deleted directory, then you can cd into it and list deleted files in it (if the directory content was not lost yet), then recover the underlying directories one by one.

You can identify directories in deleted inode lists by looking at the first digit on the second column - if it is 4, then you are looking at a directory.

BTW - a better alternative would be to use TestDisk. See this article for example.

Related Topic