自己來公司1年多了,管的系統早就爛熟於心。真是到了出了什麼問題閉着眼睛都知道是錯在哪。而且自己平時在服務器上操作小心謹慎。從來不會有什麼問題。今天下午,想把服務器上的東西備份一下。然後從遠程傳了一些東西到主服務器上的根下。用完之後準備把它刪了。不知道腦子裏在想什麼。我只是想刪除一個目錄而已。但是直接打出了rm -rf *的命令。回車的那一瞬間,提示
雖然刪了我知道怎麼恢復。但是當時身體立馬發熱,感覺頭上冒汗。立馬按住ctrl+c停止。停止以後也沒有用,因爲執行命令已經提示沒有那個文件或目錄了。沒辦法,我先從其它服務器上把/bin下的東西都拷了過來。然後查看下的文件和查看磁盤佔用率的時候,發現大部分東西還在。冷靜下來以後。想想怎麼收尾。
首先查看了下數據被刪的情況,看了下磁盤利用率沒刪多少
發現,應該是先刪除bin,然後刪boot,然後刪除dev。bin已經恢復了。boot系統提示正在運行,無法刪除。然後我就及時停止了。但是查看boot目錄的時候發現什麼東西都沒有了,那應該是在內存中的緩存了。如果重啓的話肯定是起不來的
[root@rsync boot]# mkdir /boot/grub/ [root@rsync boot]# cp /usr/share/grub/x86_64-redhat/* boot/grub/ [root@rsync boot]# grub Probing devices to guess BIOS drives. This may take a long time. GNU GRUB version 0.97 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename.] grub> root (hd0,0) root (hd0,0) Filesystem type is ext2fs, partition type 0x83 grub> setup (hd0) setup (hd0) Checking if "/boot/grub/stage1" exists... no Checking if "/grub/stage1" exists... yes Checking if "/grub/stage2" exists... yes Checking if "/grub/e2fs_stage1_5" exists... yes Running "embed /grub/e2fs_stage1_5 (hd0)"... 27 sectors are embedded. succeeded Running "install /grub/stage1 (hd0) (hd0)1+27 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded Done. [root@rsync boot]# yum -y install kernel-* 以下步驟還沒開始執行,等服務器不忙的時候進行重啓 4、reboot 5、系統會停留在grub界面上輸入以下命令 kernel /vmlinux-2.4.20-8 ro root=LABEL=/ initrd /initrd-2.4.20-8 ro root=LABEL=/ 6、boot
那麼就是說現在如果重啓能起來的話,應該是沒有什麼問題了。這次事件呢,總算是有驚無險。希望大家引以爲戒。不要大意。覺得自己沒什麼問題。儘量不要去服務器上操作。如果必須使用普通用戶,需要權限的時候sudo過去,然後執行命令的時候查看確認一下再進行刪除,要不然出了問題,只能捲鋪蓋走人了