How to install GRUB on USB-drive?

Good day.
I need to install GRUB on my USB-drive. I’ve gone through variety of manuals and articles but I have strange errors during install.
No am I going to show my way of installing GRUB. Please write me if I made something wrong.

  1. Insert USB in my laptop.
  2. My OpenSUSE automatically mount an USB-drive, so I unmount it

umount /media/disk-1

  1. Format USB-drive into ext3

mkfs -t ext3 /dev/sdb
mke2fs 1.41.1 (01-Sep-2008)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
250976 inodes, 1003519 blocks
50175 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1027604480
31 block groups
32768 blocks per group, 32768 fragments per group
8096 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

  1. Mount my USB-drive to /mnt

mount -t ext3 /dev/sdb /mnt

  1. Create /boot/grub directory

cd /mnt
mkdir boot
cd boot
mkdir grub

  1. Copy files, menu.lst, stage1, stage2 and e2fs_stage1_5 to /mnt/boot/grub
  2. Unmount USB drive

cd /
umount /mnt

  1. Start grub and write:

grub> device (hd0) /dev/sdb
device (hd0) /dev/sdb

  1. Then I try set root directory:

grub> root (hd0,0)
root (hd0,0)

Error 5: Partition table invalid or corrupt

Why do I receive this error? How can I fix it?

/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y

It warned you didn’t it?
Now you have overwritten the partition table and thus it says:

Error 5: Partition table invalid or corrupt

A disk (even if it is mimiced by other hardware) should have a partition table and at least one partition. So first partition it (using e.g. fdisk), then create the file system on the partition.

Thank you hcvv!!! I was stupid. Windows has eaten my brains. :slight_smile:

Even Windows needs partitioning rotfl!