前提:
U盘:需要MBR和至少一个分区,假设u盘boot分区为sdb1
操作系统:Centos 6
step1.将grub写入u盘
#写入bootsector
[root@localhost ~]# grub-install --root-directory=/mnt/extend/usbdisk /dev/sdb1
Probing devices to guess BIOS drives. This may take a long time.
Installation finished. No error reported.
This is the contents of the device map /mnt/extend/usbdisk/boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
#写入MBR
[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root=