歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 格式化Linux分區後WINDOWS不能啟動的解決

格式化Linux分區後WINDOWS不能啟動的解決

日期:2017/2/28 17:20:39   编辑:Linux教程

格式化Linux分區後而導致WINDOWS不能啟動,這是新手常遇到的問題,感覺Linux不好,想退出,就要直接格式化Linux分區,覆蓋Grub;而裝了Windows與Linux雙系統的用戶,又會在重裝Windows時把Grub覆蓋掉,需要恢復Grub。這是後路,我們在做事之前需要先考慮好的。

刪除Linux,覆蓋Grub,還原成XP自帶的啟動引導,這個很簡單,只要你有Windows XP盤(非Ghost),用它啟動,至選擇安裝位置的地方退出重啟就可以。或者用它啟動故障修復台,運行fixboot或者fixmbr都可以。

而恢復Grub,其實也很簡單的:用Live CD(對於Ubuntu來說就是Desktop CD或者DVD)啟動,打開終端(Applications──>Accessory──>Terminal),執行以下代碼:
代碼:
sudo grub
find /boot/grub/stage1
root (hdX,Y)
setup (hdX)
quit


注意:其中的X、Y是執行find /boot/grub/stage1命令後系統提示的。,比如:
代碼:
grub> find /boot/grub/menu.lst
(hd0,7)

注意:這裡的grub>是執行sudo grub命令後進入grub環境得到的提示符,不用輸入。這時,X就是0,Y就是7。

下面詳細解釋一下這幾條命令:


sudo grub 以root用戶身份啟動grub,否則會出錯,錯誤見後文
find /boot/grub/stage1 尋找/boot所在分區,其實換用find /boot/grub/menu.lst也一樣。
root (hdX,Y) 設置硬盤hdX的根文件系統(root Device),實際就是設置/boot所在的分區
setup (hdX) 自動安裝GRUB到硬盤hdX。
quit 退出GRUB
root、setup命令後都有空格,如果沒有會出錯誤。
如果不以root用戶身份會出現什麼樣的錯誤呢?
引用:
ubuntu@ubuntu:~$grub

[ 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> find /boot/grub/stage1

Error 15: File not found

grub> find /boot/grub/menu.lst

Error 15: File not found

grub> root(hd0,7)

Error 27: Unrecognized command

grub> root (hd0,7)

Error 21: Selected disk does not exist
grub> setup (hd0)

Error 12: Invalid device requested

Copyright © Linux教程網 All Rights Reserved