[CentOS] how to restore deleted directory/files

Wed Sep 16 13:14:06 UTC 2020
qw <applemax82 at 163.com>


Thanks for your reply. The file system type is xfs. And I found xfsdump/xfsrestore can undo the remove.

I use dd to copy the partition as one image file. How do I mount the image as read-only device? Then I can try to recover the deleted files/directory anytime.




At 2020-09-16 20:36:44, "Jonathan Billings" <billings at negate.org> wrote:
>On Wed, Sep 16, 2020 at 07:21:08PM +0800, qw wrote:
>> I remove one directory by running rm -fr ./some-dir. How to restore
>> the directory and its files in the directory? 
>If you don't have backups, then you're pretty much out of luck.  Don't
>forget to back up any data that is important, and test your backups
>Depending on the filesystem, there might be ways to recover it, but
>the first thing you need to do is stop using the disk the files were
>on.  Power it off.  There are some tools that you can use to recover
>it, but it's not 100% effective.
>If it's very important and you are willing to spend money, there are
>data recovery services that might be able to extract the data.
>Jonathan Billings <billings at negate.org>
>CentOS mailing list
>CentOS at centos.org