# grub
> device (hd0) /dev/sda
> root (hd0,0)
> setup (hd0)
(blah blah blah)
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2
/boot/grub/grub.conf"… succeeded
Done.
> quit
Be aware that (hd0,0) in this case is sda1.
If you want to apply the boot sector to sdb instead, the only thing you change is the name of the device. You still refer to it as (hd0):
# grub
> device (hd0) /dev/sdb
> root (hd0,0)
> setup (hd0)
(blah blah blah)
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2
/boot/grub/grub.conf"… succeeded
Done.
> quit
If you want to tell grub that the root partition isn't the first one, you address it as so. This example tells grub that partition 2 on sdb is where grub is installed:
grub> device (hd0) /dev/sdbgrub> root (hd0,1)
Filesystem type is ext2fs, partition type 0x83grub> setup (hd0)
(blah blah blah)
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage2 /boot/grub/grub.conf"… succeeded
Done.grub> quit