woff 發表於 2008-7-30 13:48:24

如何使隨身碟能開機的方法

http://www.ubuntu-tw.net/modules/newbb/viewtopic.php?post_id=25170

Paul_Chang
之前發了文 "請問有那些廠牌的隨身碟不支援開機?" http://www.ubuntu.org.tw/modules/newbb/viewtopic.php?topic_id=5680&forum=11 ,很遺憾沒有得到明確的協助,更感慨竟有人貼圖諷刺,卻不提供解決辦法.


不過經過幾天的研究和測試,我整理了以下內容和大家分享:

隨身碟的晶片並不全部支援開機,但使用適當的開機程式(Boot Loader),則晶片不支援開機的隨身碟也能開機了,目前在Linux下主要使用兩種開機程式(Boot Loader),Syslinux和GRUB,分別說明如下:

(隨身碟的代號假設為 /dev/sdb,這可在terminal中鍵入指令fdisk -l查得;而在/media中隨身碟的代號假設為 disk,這可在terminal中鍵入指令ls /media查得)

1. Syslinux

適用於晶片支援開機的隨身碟,開機選項存放在檔案syslinux.cfg中,電腦系統中必須先已安裝套件syslinux(版本3.30以上)和mtools,然後執行下列指令以使隨身碟能開機:

$ syslinux -sf /dev/sdb


2. GRUB

適用於所有的隨身碟,開機選項存放在檔案menu.lst中,執行下列指令以使隨身碟能開機:

$ mkdir -p /media/disk/boot/grub
$ cp /usr/lib/grub/i386-pc/* /media/disk/boot/grub/
$ gedit /media/disk/boot/grub/menu.lst

確認磁碟代號為 hd0,如下例
## ## End Default Options ##
title Ubuntu, kernel 2.6.20-16-generic
root (hd0,1)

再輸入以下指令:

$ echo '(hd0) /dev/sdb' > /media/disk/boot/grub/device.map
$ grub-install --root-directory=/media/disk /dev/sdb

如出現以下訊息即表示隨身碟能開機了

Installation finished. No error reported.
This is the contents of the device map /media/liveusb/boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/sdb


PS: 我成功地在一晶片支援開機的威剛隨身碟上安裝了Clonezilla,而在另一晶片不支援開機的金士頓隨身碟上安裝了gparted-livecd-0.3.4-8

eh87ms07 發表於 2013-11-12 01:00:38

不錯,感謝版主
頁: [1]
查看完整版本: 如何使隨身碟能開機的方法