2011年10月15日 星期六

boot and run Linux from a USB flash memory stick

先插上 USB, 假設裝置節點為 /dev/sda

方法一:
how to install ubuntu to a USB stick

  1. Download the Ubuntu 6.10 ISO and burn it to CD
  2. Restart your computer (booting from the Ubuntu Live CD)
  3. Insert a 1GB or larger USB flash drive
  4. Open a terminal window and type sudo su
  5. Now type fdisk -l to list available drives/partitions (note which device is your flash drive Example: /dev/sdb). Throughout this tutorial, replace all instances of x with your flash drive letter. For example, if your flash drive is sdb, replace x with b.
  6. Type umount /dev/sdx1
  7. Type fdisk /dev/sdx
    • type p to show the existing partition and d to delete it
    • type p again to show any remaining partitions (if partitions exist, repeat the previous step)
    • type n to make a new partition
    • type p for primary partition
      • type 1 to make this the first partition
      • hit enter to use the default 1st cylinder
      • type +750M to set the partition size
      • type a to make this partition active
      • type 1 to select partition 1
      • type t to change the partition filesystem
      • type 6 to select the fat16 file system
    • type n to make another new partition
    • type p for primary partition
      • type 2 to make this the second partition
      • hit enter to use the default cylinder
      • hit enter again to use the default last cylinder
      • type w to write the new partition table
  8. Type umount /dev/sdx1 to unmount the partition
  9. Type mkfs.vfat -F 16 -n usb /dev/sdx1 to format the first partition
    "Alternately you can try mkfs.vfat -F 32 -n usb /dev/sdx1 (doesn't always work)"
  10. Type umount /dev/sdx2 to ensure the partition is unmounted
  11. Type mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2 to format the second partition
  12. Remove and Re-insert your flash drive
  13. Back at the terminal, type sudo apt-get install syslinux mtools
  14. Type syslinux -sf /dev/sdx1
  15. Restart your computer, remove the CD and boot back into Windows

方法二:
boot debian from an USB device
中文版


$ sudo umount /dev/sda
$ wget ftp://ftp.debian.org/debian/dists/stable/main/installer-i386/current/images/hd-media/boot.img.gz
$ sudo zcat boot.img.gz > /dev/sda
$ sudo mount /dev/sda /mnt

只要留下
vmlinuz (核心二進位檔案),
initrd.gz (初始化記憶體映像檔) ,
syslinux.cfg (SYSLINUX 設定檔案),

這三個就好,其它可以刪掉,
當然也可以換成自己的核心、檔案系統,
也可以修改一下 syslinux.cfg,加些開機所需參數等。

沒有留言:

張貼留言