歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 將ubuntu系統安裝在移動硬盤裡

將ubuntu系統安裝在移動硬盤裡

日期:2017/2/28 17:21:06   编辑:Linux教程

在這裡開始Ubuntu,將ubuntu系統安裝在移動硬盤裡的方法:

1.在windows下從硬盤將 ubuntu 裝進移動硬盤(Grub4dos用0.4.3版本方有效)

在安裝之前,要把硬盤引導文件和ubuntu-7.10-alternate-i386.iso放到某個盤符下(放移動硬盤下不行,grub之初檢不到),7.10可以在ntfs下,不過以前的版本得在fat32下。後面和硬盤安裝一樣,只是裝到移動硬盤上。在提示裝Grub時最好不要裝在win的mbr,可填上/dev/sdb(因為內部有SATA硬盤了)

2.將 GRUB4DOS 引導代碼寫入移動硬盤MBR

在已裝好的ubuntu下,進入 bootlace.com 所在目錄,假設移動硬盤為 /dev/sdb

運行命令

sudo ./bootlace.com --floppy /dev/sdb

3.配置 GRUB4DOS

在移動硬盤上找一個或新建一個 fat16/fat32/ext2/ext3 分區,將grldr 拷至其根目錄, 並在同一目錄下建立 menu.lst 文件,內容如下:

timeout 6

default 0

title Ubuntu, kernel 2.6.20-16-lowlatency

kernel /boot/vmlinuz-2.6.20-16-lowlatency root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro quiet splash

initrd /boot/initrd.img-2.6.20-16-lowlatency

quiet

title Ubuntu, kernel 2.6.20-16-lowlatency (recovery mode)

kernel /boot/vmlinuz-2.6.20-16-lowlatency root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro single

initrd /boot/initrd.img-2.6.20-16-lowlatency

title Ubuntu, kernel 2.6.20-16-generic

kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro quiet splash

initrd /boot/initrd.img-2.6.20-16-generic

quiet

title Ubuntu, kernel 2.6.20-16-generic (recovery mode)

kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro single

initrd /boot/initrd.img-2.6.20-16-generic

title Ubuntu, kernel 2.6.20-15-lowlatency

kernel /boot/vmlinuz-2.6.20-15-lowlatency root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro quiet splash

initrd /boot/initrd.img-2.6.20-15-lowlatency

quiet

title Ubuntu, kernel 2.6.20-15-lowlatency (recovery mode)

kernel /boot/vmlinuz-2.6.20-15-lowlatency root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro single

initrd /boot/initrd.img-2.6.20-15-lowlatency

title Ubuntu, kernel 2.6.20-15-generic

kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro quiet splash

initrd /boot/initrd.img-2.6.20-15-generic

quiet

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)

kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro single

initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, memtest86+

kernel /boot/memtest86+.bin

quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

其中,“177430b6-2e85-4674-88c1-029d51aeca13”需換成根分區"/" 的UUID。

查看各分區UUID的命令:ls -l /dev/disk/by-uuid

或者直接到通過裝好的ubuntu 看移動硬盤中根分區下/boot/grub/menu.list中去看它寫入的uuid是多少,復制過來就行

4.硬件自動檢測

將ptptptptpt附件中 S03xconfig.sh 復制到 /etc/rc2.d/ ,並修改其權限使“允許作為可執行文件執行” —— 這個用來配置 X 。至此,移動硬盤系統已經可以在不同機子上運行了。

sudo cp xxxxx/S03xconfig.sh /etc/rc2.d/S03xconfig.sh;xxxxx省略,按實際路徑做

sudo chmod 755 /etc/rc2.d/S03xconfig.sh

再安裝兩個軟件以增強硬件檢測能力:啟動移動硬盤系統,設置好源,連上網絡,運行命令代碼:

apt-get update

apt-get install discover1 xresprobe

搞定。

5.如果不支持USB-HDD啟動,可以將移動硬盤中裝好的/boot目錄,上述menu.list文件放到機器C:\下,並在裝好Grub4dos,改好boot.ini啟動選改好的項即可。

6.在將移動硬盤插到別的機器上時要設重新設一下xserver

sudo dpkg-reconfigure xserver-xorg

在從HDD啟動時,應該要在kernel和initrd後添加盤

如我的是:

kernel (hd0,7)/boot/vmlinuz-2.6.20-16-lowlatency root=UUID=177430b6-2e85-4674-88c1-029d51aeca13 ro quiet splash

initrd (hd0,7)/boot/initrd.img-2.6.20-16-lowlatency書寫日記、心情。

Copyright © Linux教程網 All Rights Reserved