如果啟動分割區被刪除,如何啟動 Linux?

如果啟動分割區被刪除,如何啟動 Linux?

最初,Windows 7 是磁碟機中唯一的作業系統。

然後我安裝了Linux Mint。我不小心將sda1分割區(儲存 Windows 7 引導程式的位置)格式化為 ext4,作為/boot.結果我再也無法啟動Win7了。

(順便說一句,Mint安裝在sda5分區)

後來我成功修復了Win7 bootloader,刪除了GRUB(2?) loader,導致我無法啟動Mint。

我嘗試運行:

sudo mount /dev/sda5 /mnt
sudo grub-install --root-directory=/mnt/ /dev/sda

結果訊息是:

grub-probe: error: cannot find a device for /boot (is /dev mounted?).
Installation finished. No error reported.

重新啟動後,我收到grub>提示,但沒有任何作業系統選項。

(請記住,沒有為 分配分區/boot

答案1

不要使用grub-install,進入 grub 互動式 shell 並使用這些命令來正確安裝引導程式。使用正確的分區號。

root (hd0,0) (where is /boot with /boot/grub/grub.conf and grub stages files ?)
setup (hd0) (where do you want to install the bootloader?)
exit

grub-install可能需要一個/etc/mtab.如果您想使用grub-install,首先複製/etc/mtab/mnt/etc/mtab(不要擔心覆蓋舊文件,它會在每次啟動時更新),然後 chroot 到,並在 chroot 內/mnt執行 MINT腳本。grub-install

答案2

首先,請確保您有 grub(如果使用 Mint,apt-get install grub)。然後運行蜘蛛人發布的內容。如果發生錯誤 15,請退出 shell 並執行 update-grub。它應該詢問您是否要製作 menu.lst,確認是。之後,嘗試一下蜘蛛人發布的內容,它應該可以工作。

相關內容