1. 程式人生 > >linux根目錄被移動走了怎麼辦

linux根目錄被移動走了怎麼辦

今天本來打算把yum源移走一下,結果命令輸入成了 mv /* /mnt,然後整個人都不好了

所有命令都沒有用了

[[email protected] yum.repos.d]# ls
CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo
[[email protected] yum.repos.d]# mv /* /mnt/
mv: cannot move ‘/boot’ to ‘/mnt/boot’: Device or resource busy
mv: cannot move ‘/dev’ to ‘/mnt/dev’: Device or resource busy
mv: cannot move ‘/home’ to ‘/mnt/home’: Device or resource busy
mv: cannot move ‘/mnt’ to a subdirectory of itself, ‘/mnt/mnt’
mv: cannot move ‘/proc’ to ‘/mnt/proc’: Device or resource busy
mv: cannot move ‘/run’ to ‘/mnt/run’: Device or resource busy
mv: cannot move ‘/sys’ to ‘/mnt/sys’: Device or resource busy
[
[email protected]
yum.repos.d]# ls -bash: /usr/bin/ls: No such file or directory [[email protected] yum.repos.d]# ls -bash: /usr/bin/ls: No such file or directory

他上面有一個方法

/ztmp/lib/ld-linux.so.2 --library-path /ztmp/lib /ztmp/bin/cp -rfp /ztmp/* /

---------------------

本文來自 善良的獸人Goodorc 的CSDN 部落格 ,全文地址請點選:https://blog.csdn.net/mayao11/article/details/7692350?utm_source=copy 

然後我發現lib下並沒有這玩應。。。原來我是64位的

[[email protected] etc]# /mnt/lib64/ld-linux-x86-64.so.2 --library-path /mnt/lib /mnt/bin/cp -rvf /mnt/* /
-rvf: error while loading shared libraries: -rvf: cannot open shared object file: No such file or directory

並沒有用。。靠

然後發現額。。。原來後面也應該是lib64......

[[email protected]
mnt]# lib64/ld-linux-x86-64.so.2 --library-path lib64/ bin/cp -rfp /mnt/* / [[email protected] mnt]# ls bin etc lib lib64 media opt root sbin srv tmp usr var

64位下linux應該是

你動到的地址/lib64/ld-linux-x86-64.so.2 --library-path 你移動到的地址/lib64/ 你移動到的地址/bin/cp -rfp /mnt/* /