In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "mistakenly deleted Linux system files how to deal with", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "mistakenly deleted Linux system files how to deal with" this article.
Say what you said before.
For daily maintenance operations, it is inevitable that files will be mistakenly deleted. We are familiar with the linux file system different win has a recycle bin, deleted files can be found in the trash can, you know, linux file repair is more difficult, the network above the document is also varied. Therefore, this study of a more reliable file and directory recovery method, but also leave a back way for maintenance personnel.
Analysis and comparison of debugfs. Testdisk 6.14. Extundelete, comparing the introduction and operation of their respective official websites, this decision is made to study the recovery operation of files and directories by extundelete.
Extundelete download official website address: https://pkgs.org/download/extundelete
The file under Linux is deleted incorrectly, and use extundelete to resume the test process.
Add a disk / dev/sdb to the virtual host as follows:
Format the disk and mount it:
# mkfs.ext4 / dev/sdb # mkdir / usr/local/dbdata/ # mount / dev/sdb / usr/local/dbdata/
Test misoperation to delete the following files:
/ usr/local/dbdata/gperftools-2.4.tar.gz # file / usr/local/dbdata/pcre-8.32 # directory
Perform a misoperation:
# rm-rf / usr/local/dbdata/gperftools-2.4.tar.gz / usr/local/dbdata/pcre-8.32
Apply read-only protection to the partition where the misoperation is located.
If it is determined that the file has been mistakenly deleted, immediately implement write protection on the partition without backup (to prevent new writes from overwriting mistakenly deleted block data, so permissions are given to read-only):
# mount-o remount,ro / dev/sdb # mount-o remount,ro / usr/local/dbdata/
Data recovery tool installation
Tool installation and deployment
The official website is http://extundelete.sourceforge.net/, and its current stable version is extundelete-0.2.4.
Tool download
# wget https://nchc.dl.sourceforge.net/project/extundelete/extundelete/0.2.4/extundelete-0.2.4.tar.bz2
Decompression and installation
Dependency package
# yum-y install gcc-c++ e2fsprogs.x86_64 e2fsprogs-devel.x86_64 # tar-jxvf extundelete-0.2.4.tar.bz2 # cd extundelete-0.2.4 #. / configure # make & & make install
Verify the installation result
# extundelete-v
File recovery process
Restore the specified file:
Principle: start with the root node (inode=2) to find the I node of the deleted file, and then recover the I node.
The following is a simulation to delete gperftools-2.4.tar.gz (file) and pcre-8.32 (directory).
First check which files have been deleted:
# extundelete / dev/sdb-- inode 2
As you can see from the circle, there are two:
Gperftools-2.4.tar.gz 15 Deleted pcre-8.32 655361 Deleted
Note: the recovery process should not be carried out in the mistakenly deleted partition, beware of inode. Block blocks cover each other
Restore the file first (can be restored according to the file name):
# extundelete / dev/sdb-- restore-file gperftools-2.4.tar.gz
Restore directory (restore based on directory name):
# extundelete / dev/sdb-- restore-directory pcre-8.32
* you will see a directory called RECOVERED_FILES under the current directory, and you can see the deleted files and directories in the directory:
Say the words in the back.
According to the above operation, it is proved that the extundelete tool can recover the mistakenly deleted data, and the operation is simple.
The above is all the contents of the article "how to deal with mistakenly deleting Linux system files". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.