Ok, that's a really long title, but I couldn't make it any shorter without losing the point!
In my case I already have the system installed to a hard drive in my target PC. I want to move all the files to a usb flash drive and make it bootable. I already know that the target system (DecTop) support USB boot. My workstation is a different linux PC.
bash# mkfs.ext3 /dev/sdb1 bash# sync ; sync
bash# cd / bash# mkdir /mnt/sda1 bash# mount /dev/sda1 /mnt/sda1 bash# mkdir udev bash# mount --move /dev /udev bash# cp -ax / /mnt/sda1
bash# mount --move /udev /dev bash# rm -fr /udev
Now to make the usb drive bootable. It should still be mounted at /mnt/sda1. First, in file /mnt/sda1/boot/grub/device.map set hd(0) to /dev/sda and in /mnt/sda1/boot/grub/menu.lst set the kernel boot options correctly for each boot configuration, eg:
title Debian GNU/Linux, kernel 2.6.18-6-486 root (hd0,0) kernel /boot/vmlinuz-2.6.18-6-486 root=/dev/sda1 ro vga=792 initrd /boot/initrd.img-2.6.18-6-486 savedefault
Finally, install grub on the usb flash drive:
bash# grub-install --root-director=/mnt/sda1 /dev/sda
All done! Now you can reboot into the flash drive.