[CentOS] how to restore deleted directory/files

Wed Sep 16 14:00:05 UTC 2020
qw <applemax82 at 163.com>

Hi,


>>
>> Thanks for your reply. The file system type is xfs. And I found
>> xfsdump/xfsrestore can undo the remove.
>
>Hm, are you sure you can use xfsdump/xfsrestore for this?
>

xfsdump/xfsrestore can't do the recovery.




>> 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.
>
>Mount the image with the option '-o ro' as read-only.
>
>Depending on the kind of data you removed you could use 'testdisk' or
>'photorec' to recover. Make sure to only use a copied image to test.

Thanks for your advice. I will try the tools.


I also found the article about how to create and mount image.

https://midnightprogrammer.net/post/create-mount-and-unmount-img-files-in-ubuntu/


The article says, the image file created by dd should formated in ubuntu.


For Centos, should I format the image file before mounting it as virtual read-only disk?


Thanks!


Regards


andrew



At 2020-09-16 21:32:49, "Simon Matter" <simon.matter at invoca.ch> wrote:
>> Hi,
>>
>>
>> Thanks for your reply. The file system type is xfs. And I found
>> xfsdump/xfsrestore can undo the remove.
>
>Hm, are you sure you can use xfsdump/xfsrestore for this?
>
>>
>>
>> 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.
>
>Mount the image with the option '-o ro' as read-only.
>
>Depending on the kind of data you removed you could use 'testdisk' or
>'photorec' to recover. Make sure to only use a copied image to test.
>
>Regards,
>Simon
>
>_______________________________________________
>CentOS mailing list
>CentOS at centos.org
>https://lists.centos.org/mailman/listinfo/centos