How to recover files that were mistakenly deleted under Linux and how to prevent files from being deleted

Source: Internet
Author: User

"Unmount the partition where the file was mistakenly deleted, or mount as read-only"

When you find that you have deleted the file by mistake, the first thing to do is to immediately unload the partition where the file was mistakenly deleted, or to hang it in a read-only manner. If the root partition is deleted by mistake, it is best to power down directly, go to single user mode, hang the partition in a read-only manner, and then restore

Mount-o ro,remount/dev/sdb/mnt

If you are not deleting the root partition, use Umount to uninstall the partition UMOUNT/DEV/SDB3

"Installing the Ext3grep Tool"

Download Ext3grep tool, Http://code.google.com/p/Ext3grep/downloads/list

Tar zxf ext3grep-0.10.1.tar.gz

cd/home/easwy/ext3grep-0.10.1

./configure

Make

Make install

"Recover Files"

The EXT3GREP program creates a directory named Restored_files in the current directory to hold the recovered files

If you remember the deleted file name and its path, you can use the following command to restore it:

Ex3grep/dev/your-device--restore-file Path/to/your/file/filename

Suppose the file you want to recover is/home/easwy/vi/tips.xml

EX3GREP/DEV/SDS3--restore-file Easywy/vi/tips/xml

If you forget the file name, you can use the following command to query:

Ext3grep/dev/sda3--dump-names | Tee filename.txt

And then you can use the above command to restore the line.

This article is from the "Paraquat Susan" blog, so be sure to keep this source http://suxin.blog.51cto.com/535505/1677708

How to recover files that were mistakenly deleted under Linux and how to prevent files from being deleted

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.