Restore of the "Linux" MV root directory

Source: Internet
Author: User
Tags rsync

One error MV/*/path/to Recovery of operation

Description: The implementation of the MV command did not pay attention to the path, the result is that most of the directory under the root directory is moved to a new path, and then immediately

Error command can not continue, because/lib has been removed,/lib under the most basic System runtime library, modern Linux system mostly

Several commands have been dynamically connected, and when the/lib path changes, you can use it to create a directory, or any command used to copy a file,

Bad use, will report the following error:

/lib/ld-linux.so.2:bad ELF interpreter:no such file or directory

That means I can't find the ld-linux.so.2 file.

As the files have been removed, the tools we usually rely on are not good. Even if you typed the absolute path, you will also be prompted:

/lib/ld-linux.so.2:bad ELF interpreter:no Such file or directory this error

Tried the following command

/WWW/USERS/ABCDEFG.NET/{LS,LN,MKDIR,MKTEMP,FTP,RSYNC,MV,CP,RM,LDCONFIG,SCP,SFTP,PERL,ASH,ZSH,CSH} All of the above errors are reported,

Regular creation of files, creation of directory and directory file transfer operations, and remote or local copy file operations are not possible.

Then try to find the useful commands:

CD Export declare echo > These built-in commands are handy.

We looked at the scene, because LS has not been used. Then use Bash's AutoComplete feature (tab) to see what directories and files

First check which directories have been removed, execute the following command:

/www/users/abcdefg.net [Press TAB]

The output is as follows:

Backup bin boot Dev ecshop etc home lib Lost+found media misc mnt opt proc Www_logs ucenter

It can be seen that both bin and Lib have been moved, then we can not directly execute the program under the bin, and can not perform any dependent/lib under the program, and etc has been MV here to

So we didn't even have the opportunity to modify the ld.so.conf and generate a new ld.so.cache because we couldn't execute the command that created the/etc directory.

Start recovering.

The process is not complicated and we also have ld-linux.so.2 available, although it has changed position.

Ld-linux.so.2 is a dynamic connector for a Linux system that we can use to execute commands, and we use its--library-path parameter to reassign the location of the Ld_library_path.

And see what's in the root directory.

/www/users/abcdefg.net/lib/ld-linux.so.2--library-path/www/users/abcdefg.net/lib/www/users/abcdefg.net/bin/ls/ -F

Output is normal,

Recovery/lib

/www/users/abcdefg.net/lib/ld-linux.so.2--LIBRARY-PATH/WWW/USERS/ABCDEFG.NET/LIB/WWW/USERS/ABCDEFG.NET/BIN/CP- Rfp/www/users/abcdefg.net/lib/lib

Recovery/bin

/www/users/abcdefg.net/lib/ld-linux.so.2--LIBRARY-PATH/WWW/USERS/ABCDEFG.NET/LIB/WWW/USERS/ABCDEFG.NET/BIN/CP- Rfp/www/users/abcdefg.net/bin/bin

Recover Other Directories

Cd/www/users/abcdefg.net

For i in bin Boot etc lib Media misc mnt opt; Do Rsync-av--progress./$i//$i/; Done

Then we'll restore the dev directory.

CD Dev

CP-DRP */dev

Re-check SSH login, at this time has been able to log on the system, carefully check the/boot/etc, have been properly restored, restart the system, all recovery is complete

turn from http://blog.51cto.com/sharkyan/771966

Recovery of "Linux" MV root directory (RPM)

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.