使用者工具

網站工具


linux:usb_boot

Booting ISO files from GRUB 2

製作 debian 的 USB 安裝碟

製作 ubuntu 的 Live USB

在USB隨身碟中裝入Linux開機系統

建立可開機之隨身碟

將隨身碟格式化成 fat 或 fat32 檔案格式。

linux

安裝 syslinux 套件後,執行:

syslinux /dev/sda1

Windows

下載:http://www.ntu-tw.lkams.kernel.org/pub/linux/boot/syslinux/Testing/syslinux-3.36-pre3.zip

解壓縮 syslinux-3.36-pre3.zip,有一個 win32 目錄,切換到該目錄,執行:

syslinux x:            # x:是隨身碟代號

下載 Live-CD 光碟映像檔

如:ftp://ftp3.tnc.edu.tw/KNOPPIX/health/2007/B2DpureKGB20070309.iso

  1. 將光碟資料夾isolinux內的東西統統複製到隨身碟根目錄內。
  2. 隨身碟根目錄內將isolinux.cfg改名為syslinux.cfg
  3. 隨身碟根目錄內將isolinux.bin改名為syslinux.bin

複製光碟內容

把所有光碟下所有目錄整個複製到隨身碟根目錄中,光碟根目錄有東西也複製到隨身碟中。

重新開機,將主機板 BIOS 的 USB 開機順序一到第一,用 usb 開機。

把ubuntu 7.04(完整Linux系統,非Live CD)裝入隨身碟中

Bootable USB Keys

Boot From a USB drive using GRUB

http://enterprise.linux.com/enterprise/07/06/04/141244.shtml?tid=129

Once upon a time GRUB was commonly used to make generic boot diskettes. A GRUB-enabled diskette would allow a user to boot directly into any operating system that GRUB recognized on the system. This was useful for recovering systems and fixing partitions that had bad master boot records (MBR).

Times have changed; many computers these days no longer have diskette drives, but they can boot from a USB drive. GRUB naturally adapted to USB disk drives. To get a USB disk drive to boot with GRUB, start with a USB thumb drive that is partitioned correctly and has a supported filesystem (BSD FFS, DOS FAT16 and FAT32, Minix fs, Linux ext2fs, ReiserFS, JFS, XFS, and VSTa fs). Then perform the following steps while logged in as root or a user that has sudo access.

First mount the USB drive. Under many distributions, USB storage devices are mounted automatically when the system recognizes them. If that's not the case with your distribution, you will need to install the sg3-utils package, which provides a set of SCSI management tools. (Linux treats USB drives as if they were SCSI.) Then run sg_scan -i to display a list of devices, find the one that matches the name of your device, and make note of the /dev/sg* information. Run sg_map to see how the device is actually mapped on the system; match the /dev/sg* name to the /dev/sd* line to get the device name of the device. On my machine the USB drive is /dev/sda, so the command is:

# mkdir /mnt/usb
# mount /dev/sda1 /mnt/usb

Copy the boot stage files to your USB drive. Stage files are the executable files that comprise GRUB. You need to copy the correct stage file for your filesystem. In GNOME you can determine the filesystem by right-clicking the icon for the drive and selecting Properties from the menu; the filesystem information in on the Volume tab. If you are not running GNOME you can determine the filesystem type by using fdisk.

In all there should be three files to copy: stage1, stage2, and your filesystem stage file. (The example below uses the e2fs stage file, which corresponds to the ext2 filesystem.) Once the files are copied you need to unmount the device so the MBR can be created.

mkdir /mnt/usb/grub
cp /boot/grub/stage* /boot/grub/e2fs_stage1_5 /mnt/usb/grub/
umount /mnt/usb

The final step is to install a master boot record on the drive. An MBR is a 512-byte hidden area of the disk that is reserved specifically for booting. To install the MBR, use the GRUB shell – a simple command shell that is used to preform GRUB-related tasks.

grub
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
  • device tells GRUB what disk device to use when processing commands.
  • root sets the default partition that GRUB will use to boot from. This is the partition where the stage files were copied to. GRUB starts counting at 0, not 1.
  • setup creates the MBR on the USB drive.
  • quit exits the GRUB command shell.

At this point GRUB is installed, and you should be able to boot the USB disk drive. When you do so, you should get dumped directly into the GRUB shell when the machine is booted. For information on what you can do with the command shell, review the GRUB command-line documentation.

If you want to go old school and use a diskette with GRUB, make sure the diskette is formatted as a FAT filesystem and replace /dev/sda1 with /dev/fd0 and hd0 with fd0.

linux/usb_boot.txt · 上一次變更: 2010/10/16 19:55 由 wenpei