CentOS system recovers deleted files by mistake

Source: Internet
Author: User

In a CentOS system, when files are deleted by mistake, the following steps are performed to recover the files.

1. Turn off all services

When the deletion of files by mistake, in order to recover the data as much as possible, first to shut down all the services in progress, do not write the data, or the probability of recovery is low. We can directly

# Killall Process Name

Or

# kill-9 PID

And then put the deleted files in the partition, re-mount the read-only

# Mount-o ro/dev/sdb/data/

2. Installing Extundelete Tools

# yum Install-y e2fsprogs*//Install dependency pack

# wget http://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2

# TAR-JXVF EXTUNDELETE-0.2.4.TAR.BZ2

# CD extundelete-0.2.4

#./configure--prefix=/usr/local/extundelete
# Make && make install

3. Verify that the installation is successful

# Cd/usr/local/extundelete/bin
#./extundelete-v
---------------------
Extundelete version 0.2.4
LIBEXT2FS version 1.41.12
Processor is little endian.
---------------------

4. Recovering data

Example: If we mistakenly delete the file as Test.txt, the partition is/DEV/SDB.
1) Scan files
#/USR/LOCAL/EXTUNDELETE/BIN/EXTUNDELETE/DEV/SDB--inode 2//scan which files have been deleted
2) Recover files

#/usr/local/extundelete/bin/extundelete--restore-file Test.txt/dev/sdb

3) View Files
The recovered files are in the recovered_files/directory under the current directory
# ls ./recovered_files/

You can see the Test.txt file.

Note :

If you want to recover files on an entire partition, you can execute the following command
#/usr/local/extundelete/bin/extundelete--restore-all/dev/sdb
The recovered files are also under the./recovered_files/directory.

5. Follow-up work

1) re-mount the partition as writable.
2) Back up important data.
3) Overwrite the data we recovered.
4) Restart the server and restore the various services that were shut down before.

This article is from the "M April Days" blog, please be sure to keep this source http://msiyuetian.blog.51cto.com/8637744/1707646

CentOS system recovers deleted files by mistake

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.