Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to recover mistakenly deleted files in CentOS system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to restore mistakenly deleted files in the CentOS system, many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

1. Turn off all services

When it is found that files have been mistakenly deleted, in order to recover the data as much as possible, it is necessary to turn off all ongoing services and stop writing data, otherwise the probability of recovery will be low. We can just go straight

# killall process name

Or

# kill-9 pid

Then the partition of the mistakenly deleted file is remounted as read-only.

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

2. Install extundelete tools

# yum install-y e2fsprogs * / / install dependency package

# 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. Restore 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) restore 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 restore files on the entire partition, you can execute the following command

# / usr/local/extundelete/bin/extundelete-- restore-all / dev/sdb

The restored files are also in the. / RECOVERED_FILES/ directory.

After reading the above, do you have any further understanding of how to recover mistakenly deleted files in the CentOS system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report