2012/11/29

Grub2 Live USB

1. Format your USB Flash Drive to use a Single Partition:

    Open a terminal and type sudo su
    Type fdisk -l (and note which device is your USB Drive)
    Type fdisk /dev/sdx (replacing x with your actual usb device)
    Type d (to delete the existing partition)
    Type n (to create a new partition)
    Type p (for primary partition)
    Type 1 (to create the first partition)
    Press Enter (to use the first cylinder)
    Press Enter again (to use the default value as the last cylinder)
    Type a (for active)
    Type 1 (to mark the first partition active "bootable")
    Type w (to write the changes and close fdisk)

2. Create a Fat32 Filesystem on the USB Flash Drive:

    Type umount /dev/sdx1 (to unmount the mounted partition)
    Type mkfs.vfat -F 32 -n MBOOT /dev/sdx1 (to format the partition as fat32)

3. Install Grub2 on the USB Flash Drive:

    Type mkdir /media/MBOOT (to create a directory for the mountpoint)
    Type mount /dev/sdx1 /media/MBOOT (to mount the USB)
    Type sudo grub-install --no-floppy --root-directory=/media/MBOOT /dev/sdx (to install Grub2)
    Type cd /media/MBOOT/boot/grub (to change directory)
    Type wget pendrivelinux.com/downloads/multibootlinux/grub.cfg (to get the grub.cfg file)
    Type sudo mkdir /media/MBOOT/iso

4. Edit grub.cfg

     File location: /media/MBOOT/boot/grub/grub.cfg

set color_normal='light-blue/black'
set color_highlight='light-cyan/blue'
set drive_label=MBOOT

menuentry "System Rescue CD" {
 loopback loop /iso/systemrescuecd-x86-2.8.1.iso
 linux (loop)/isolinux/rescuecd isoloop=/iso/systemrescuecd-x86-2.8.1.iso setkmap=us docache dostartx
 initrd (loop)/isolinux/initram.igz
}

menuentry "Parted Magic Disk Utilities 2012-07-13" {
 loopback loop /iso/pmagic_2012_07_13.iso
 linux (loop)/pmagic/bzImage iso_filename=/iso/pmagic_2012_07_13.iso edd=off load_ramdisk=1 prompt_ramdisk=0 rw loglevel=9 vga=normal livemedia noeject max_loop=256 vmalloc=288MiB
 initrd (loop)/pmagic/initrd.img
}

menuentry "Ubuntu 12.04 (amd64)" {
 loopback loop /iso/ubuntu-12.04-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/ubuntu-12.04-desktop-amd64.iso noeject noprompt --
 initrd (loop)/casper/initrd.lz
}

menuentry "Arch Linux x86_64 (Archboot 2012.06)" {
 loopback loop /iso/archlinux-2012.06-1-archboot-dual.iso
 linux (loop)/boot/vmlinuz_x86_64 gpt loglevel=7 rootdelay=10
 initrd (loop)/boot/initramfs_x86_64.img
}

menuentry "Arch Linux x86_64 (2012.07)" {
 set isofile="iso/archlinux-2012.07.15-netinstall-dual.iso"
 loopback loop /$isofile
 linux (loop)/arch/boot/x86_64/vmlinuz img_dev=/dev/disk/by-label/$drive_label img_loop=$isofile archisolabel=ARCH_201207
 initrd (loop)/arch/boot/x86_64/archiso.img
}

menuentry "FreeBSD 9.0 x86_64" {
 set isofile=/iso/FreeBSD-9.0-RELEASE-amd64-disc1.iso
 loopback loop $isofile
 kfreebsd (loop)/boot/kernel/kernel iso-scan/filename=$isofile noeject noprompt splash --
 kfreebsd_module (loop)/boot/mfsroot.gz type=mfs_root
}

沒有留言:

張貼留言