Install Ubuntu to USB Disk

以下適用想把 Ubuntu 裝到 USB 隨身碟
但 bios 不支援從 USB 開機的電腦

使用 LiveCD 直接安裝
使用 VMware mount ISO ubuntu-8.10-desktop-i386.iso
用 4G 以上的隨身碟
插入 USB Disk
安裝

然後 製作 USB boot
UbuntuBootCDForUSB_8.10.iso

VMware mount USB boot 開機
或燒成CD 然後 BIOS 選成CD開機
建議使用RW來作開機CD
方便修改選項或是更新 kernel 時可重複使用。

#-------------------------------------------------------------------------------
# 製作 USB boot CD
# MakeBootCD.txt
#-------------------------------------------------------------------------------

# UbuntuHelp:BootFromUSB
# http://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:BootFromUSB&variant=zh-hant
# http://www.pendrivelinux.com/usb-boot-cd-for-ubuntu-810/

# Make a bootcd that boot from USB
# In home directory or 'sudo -i' root home directory

alex@alex-laptop:~$ mkdir bootcd
alex@alex-laptop:~$ cd bootcd
alex@alex-laptop:~/bootcd$ mkdir boot
alex@alex-laptop:~/bootcd$ cd boot
alex@alex-laptop:~/bootcd/boot$ mkdir grub
alex@alex-laptop:~/bootcd/boot$ cd grub
alex@alex-laptop:~/bootcd/boot/grub$ cp /usr/lib/grub/i386-pc/stage2_eltorito .
alex@alex-laptop:~/bootcd/boot/grub$ cp /boot/grub/menu.lst .
alex@alex-laptop:~/bootcd/boot/grub$ ls
menu.lst stage2_eltorito
alex@alex-laptop:~/bootcd/boot/grub$
alex@alex-laptop:~/bootcd/boot/grub$ gedit menu.lst

#---------------------------------------------------------------------------------------------------
timeout 6
# hiddenmenu

#-----------------------------------------------------------
# 直接將 'uuid ...'那一行改成 'root (cd)' 即可
# 拿掉 quiet 以顯示開機過程
#-----------------------------------------------------------
# title Ubuntu 8.10, kernel 2.6.27-11-generic
# uuid 9d32cf82-dc7a-4e17-a4b8-f8d6a89aa1f0
# kernel /boot/vmlinuz-2.6.27-11-generic root=UUID=9d32cf82-dc7a-4e17-a4b8-f8d6a89aa1f0 ro locale=zh_TW quiet splash
# initrd /boot/initrd.img-2.6.27-11-generic
# quiet
#-----------------------------------------------------------------
# 預設使用 uuid 來指定 kernel root 讓它不受磁碟的實際位置影響
# 參考 ( https://help.ubuntu.com/community/UsingUUID )
#-----------------------------------------------------------------

title Ubuntu 8.10 2.6.27-11, UUID
root (cd)
kernel /boot/vmlinuz-2.6.27-11-generic root=UUID=9d32cf82-dc7a-4e17-a4b8-f8d6a89aa1f0 ro locale=zh_TW splash
initrd /boot/initrd.img-2.6.27-11-generic

#--------------------------------------------------------------------------------
# 或是自行指定 kernel root 位置 (/dev/sda5 為 Ubuntu 安裝在 USB 的 Partition)
# vmlinuz 及 initrd.img 請視實際的版本更改
#--------------------------------------------------------------------------------

title Ubuntu 8.10 2.6.27-11, sda5
root (cd)
kernel /boot/vmlinuz-2.6.27-11-generic root=/dev/sda5 ro splash locale=zh_TW
initrd /boot/initrd.img-2.6.27-11-generic
boot

title Ubuntu 8.10 2.6.27-7, sda5
root (cd)
kernel /boot/vmlinuz-2.6.27-7-generic root=/dev/sda5 ro splash locale=zh_TW
initrd /boot/initrd.img-2.6.27-7-generic
boot
#---------------------------------------------------------------------------------------------------

alex@alex-laptop:~/bootcd/boot/grub$ cd ..
alex@alex-laptop:~/bootcd/boot$ cp /boot/vmlinuz-2.6.27-11-generic .
alex@alex-laptop:~/bootcd/boot$ cp /boot/initrd.img-2.6.27-11-generic .
alex@alex-laptop:~/bootcd/boot$ cp /boot/vmlinuz-2.6.27-7-generic .
alex@alex-laptop:~/bootcd/boot$ cp /boot/initrd.img-2.6.27-7-generic .
alex@alex-laptop:~/bootcd/boot$ ls -al
total 20424
drwxr-xr-x 3 alex alex 4096 2009-02-20 11:46 .
drwxr-xr-x 3 alex alex 4096 2009-02-20 11:28 ..
drwxr-xr-x 2 alex alex 4096 2009-02-20 11:44 grub
-rw-r--r-- 1 alex alex 8185142 2009-02-20 11:46 initrd.img-2.6.27-11-generic
-rw-r--r-- 1 alex alex 8183294 2009-02-20 11:46 initrd.img-2.6.27-7-generic
-rw-r--r-- 1 alex alex 2248912 2009-02-20 11:45 vmlinuz-2.6.27-11-generic
-rw-r--r-- 1 alex alex 2244464 2009-02-20 11:46 vmlinuz-2.6.27-7-generic
alex@alex-laptop:~/bootcd/boot$

alex@alex-laptop:~/bootcd$ cd ..
alex@alex-laptop:~$ sudo mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o UbuntuBootCDForUSB.iso bootcd
alex@alex-laptop:~$ ls
bootcd Desktop Examples UbuntuBootCDForUSB.iso 文件 桌面
alex@alex-laptop:~$ mv UbuntuBootCDForUSB.iso /media/RALLY2/UbuntuBootCDForUSB_8.10.iso
alex@alex-laptop:~$

# ps.
# RALLY2 是隨身碟的名字
# OCZ 這支 Rally2 8G Read 30MB/s, Write 只有 9MB/s, 網頁灌水說寫入有 15MB/s :-(
# 裝好 Ubuntu 8.10 後,在我那沒硬碟的 Notebook 由光碟開機到看到桌面約 90 秒。

No comments: