Re: [問題] 關於 live USB 一問

看板Linux作者 (Wynn 的 批踢踢)時間10年前 (2015/08/02 01:27), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/3 (看更多)
※ 引述《qas612820704 (Lego)》之銘言: : ※ 引述《qas612820704 (Lego)》之銘言: : : 請問一個隨身碟有沒有辦法擁有多個安裝碟 : : 不然我每次重新裝機就要把隨身碟重刷成其他的安裝碟 : : 在隨身碟不夠的情況下 : : 每次都要在Win10 Win7 Archlinux Debian 之間裝來裝去 : : 請問有沒有辦法把讓 grub 之類的東西 裝在隨身碟裡面 : : 好讓我隨身碟裡面可以同時擁有多個安裝碟 讓我去選取 : : 如果無解 想請問大大是用什麼方式解決這個問題的 : : 求解 謝謝 <(_ _)> : 哈囉! 在製作完之後 grub找不到我的開機磁區... : 想請問是那邊有問題? : 以下是我的動作 : #### 切磁區 : # fdisk /dev/sdc #切3個然後在2,3加boot flag : #### 製作檔案系統 : # mkfs.ext2 /dev/sdc1 # 放grub/的地方 : # mkfs.ext4 /dev/sdc2 # 放Debian stretch : # mkfs.ext4 /dev/sdc3 # 放Archlinux : #### 製作Debian磁區 : # mount /tmp/debian.iso /mnt/iso; : mount /dev/sdc1 /mnt/usb : # cp -a /mnt/iso/* /mnt/usb : # umount /mnt/iso; : umount /mnt/usb : #### 製作 Archlinux磁區 方法如上 : # ... : #### 安裝grub到 sdc1 : # mount /dev/sdc1 /mnt : # grub-install --target=i386-pc --recheck --force --boot-directory=/mnt/boot : # grub-mkconfig -o /mnt/boot/grub/grub.cfg : !!!!! 就是這裡 : 他只有找到我電腦裡的系統 : 並沒有找到隨身碟裡那安裝的兩個 : 想請問問題在哪裡?? : 謝謝 <(_ _)>! 由於grub2可以使用loopback指令來掛載iso檔,所以我建議你用grub2來自製作多重 Live USB! 首先,第一個步驟就是格式化你的USB碟。(推薦使用ntfs、ext3或ext4)(fat32有4G限制) 第二步,建立USB資料夾並掛載上去。(如果有自動掛載可以用"df -h"查詢並跳過這一步 且取代/mnt/usb這一行) >mkdir /mnt/usb && mount /dev/sdx1 /mnt/usb (x為你的USB代號,可用"dmesg"找出) 第三步,安裝grub。 >grub-install --force --no-floppy --boot-directory=/mnt/usb/boot /dev/sdx (x為你的USB代號) 第四步,建立iso資料夾。 >mkdir -p /mnt/usb/boot/grub2/iso 第五步,拷貝iso檔到iso資料夾。(這裡以Ubuntu為例) >cp ubuntu-15.04-desktop-amd64.iso /mnt/usb/boot/grub2/iso/ 第六步(也是最難的一步),在/mnt/usb/boot/grub2/grub.cfg寫開機選單設定檔。 因為只要沒寫好設定檔kernel就會跟你抱怨找不到rootfs。 你可以參考https://github.com/thias/glim/tree/master/grub2 裡面的設定檔 或者是google 搜尋 "grub2 (Linux發行版) live cd"。 也可以參考iso裡面的的開機設定檔。(但不可以全部照抄) 以下是我的範例:(這裡以Ubuntu為例) ================================== submenu 'Ubuntu X64 ISO'{ menuentry "Try Ubuntu without installing" { loopback loop /boot/grub2/iso/ubuntu-15.04-desktop-amd64.iso linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=/boot/grub2/iso/ubuntu-15.04-desktop-amd64.iso splash --- persistent initrd (loop)/casper/initrd.lz } menuentry "Install Ubuntu" { loopback loop /boot/grub2/iso/ubuntu-15.04-desktop-amd64.iso linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=/boot/grub2/iso/ubuntu-15.04-desktop-amd64.iso only-ubiquity splash --- persistent initrd (loop)/casper/initrd.lz } menuentry "Check disc for defects" { loopback loop /boot/grub2/iso/ubuntu-15.04-desktop-amd64.iso linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=/boot/grub2/iso/ubuntu-15.04-desktop-amd64.iso integrity-check splash --- persistent initrd (loop)/casper/initrd.lz } } ================================== ##注意! 如果loopback中的iso檔名與iso資料夾中的檔名不符合的話,請修改loopback中 的iso檔名或iso資料夾中的檔名。 第七步,用grub-script-check來檢查開機選單設定檔 >grub-script-check /mnt/usb/boot/grub2/grub.cfg (如果有錯誤訊息的話,請在該行錯 誤的地方做修正,否則你只能看到"grub>"命令列) 第八部,卸除USB碟 >cd / && umount /mnt/usb 完成!!這樣多重Live USB就建立好了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.213.128.199 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1438450040.A.45B.html

08/02 17:16, , 1F
有loopback就不用dd了,有想syslinux換grub2玩玩看XD
08/02 17:16, 1F
文章代碼(AID): #1LlG5uHR (Linux)
文章代碼(AID): #1LlG5uHR (Linux)