在之前 grub 時期,網上有各種的解決方法可以參考,花點時間找找也就解了,但Ubuntu 9.10 後將grub 改為 grub 2.0 ,事情對我來說就沒那麼單純了.....
先來個環境說明吧,我的"fstable -l"如下:
所用裝置 Boot Start End Blocks Id System
而我原本的 / 是放在 sda6 中,然後在sda8中再安裝了ubuntu netbook remix,結果 netbook remix 版是用grub2 所以取代了 sda6 中原本的grub,我也偷懶一直沒有動它...直到最近 sda6 的空間不夠了沒辨法才對它開刀,結果花了我好多時間...@@..待我慢慢道來..
我的目的是希望將 root 從 sda6 移到 sda8 如下图:
首先用 再生龍clonezilla(謎:開發者國家高速網路的clonezilla專屬網頁反而進不去.....) 將 sda6 直接整塊 clone 到 sda8,接下來我就很衝動對 sda6 作了 "sudo rm -rf *" ya~ 然後開機時它就抱怨找不到 grub ,所以要重裝grub ,這個動作很常見,像之前我們在 linux 安裝完後,再安裝 win xp 就會遇到 .....
接著我就按照論壇上的方法用光碟安裝,
sudo mount /dev/sda8 /mnt
sudo mount --bind /dev/ /mnt/dev
sudo chroot /mnt
sudo grub-install /dev/sda
reboot
結果是....失敗...只看到boot menu 點選進去,永遠都是ERR 15
依這邊的說法是:
File Not Found (Error 15) 此錯誤為 GRUB 2 安裝至 /boot 但主開機磁區(MBR)依然為傳統 Grub。此狀況發生在當您執行 sudo update-from-grub-legacy 時未選擇您的磁碟。
但是我沒有執行過 sudo update-from-grub-legacy ,而且用它教的方法 從開機光碟重新安裝 還是一樣的error出現,這可讓我傷腦筋了,還好後在英文版 grub2 wiki中看到 對從live 重新安裝Grub2 之METHOD 3 - CHROOT如下照作,就可以開機進去了..^^..我認為關鍵是在第7點,確定安裝時是使用live cd上的grub2,可能我原本usr下的grub2問題,所以之前重裝才會無法解決問題。
-------------------------------------------------------------------
METHOD 3 - CHROOT
This method of installation uses the chroot command to gain access to the broken system's files. Once the chroot command is issued, the LiveCD treats the broken system's / as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.
- Boot to the LiveCD Desktop (Ubuntu 9.10 or later).
Open a terminal - Applications, Accessories, Terminal.
- Determine your normal system partition - (the switch is a lowercase "L")
sudo fdisk -l
- If you aren't sure, run
df -Th. Look for the correct disk size and ext3 or ext4 format.
- If you aren't sure, run
- Mount your normal system partition:
- Substitute the correct partition: sda1, sdb5, etc.
sudo mount /dev/sdXX /mnt # Example: sudo mount /dev/sda1 /mnt
Only if you have a separate boot partition:
- sdYY is the /boot partition designation (for example sdb3)
sudo mount /dev/sdYY /mnt/boot
- Mount the critical virtual filesystems:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys - To ensure that only the grub utilities from the LiveCD get executed, mount /usr
sudo mount --bind /usr/ /mnt/usr
- Chroot into your normal system device:
sudo chroot /mnt
- If there is no /boot/grub/grub.cfg or it's not correct, create one using
update-grub
- Reinstall GRUB 2:
Substitute the correct device - sda, sdb, etc. Do not specify a partition number.
grub-install /dev/sdX
Verify the install (use the correct device, for example sda. Do not specify a partition): sudo grub-install --recheck /dev/sdX
Exit chroot: CTRL-D on keyboard
- Unmount virtual filesystems:
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys- If you mounted a separate /boot partition:
sudo umount /mnt/boot
- If you mounted a separate /boot partition:
- Unmount the LiveCD's /usr directory:
sudo umount /mnt/usr
- Unmount last device:
sudo umount /mnt
- Reboot.
sudo reboot
沒有留言:
張貼留言