Make USB Stick Bootable

· klm's blog


Original post is here: eklausmeier.goip.de

In various forums one reads that one should use dd to copy a ISO image to an USB stick. Although this works, more often you do not want to use a ISO image but rather copy a Linux system at hand. First you mount the root filesystem of the new USB stick, then mount /boot within a chroot. Finally use grub commands. I.e., type

1mount /dev/sdc2 /mnt/stick
2arch-chroot /mnt/stick
3mount /dev/sdc1 /boot           <--- /boot is local to chroot!
4grub-install --target=i386-pc --boot-directory=/boot /dev/sdc
5grub-mkconfig -o /boot/grub/grub.cfg
6umount /boot                    <--- umount "local" /boot

Also see GRUB in the Arch Wiki.

Setting the bootable flag in the partition table one either uses gparted, a graphical tool, or, as the task at hand is so simple, one just uses parted.

1parted /dev/sdc
2set 1 boot on
3print

Unrelated, but often useful. Just in case you changed something in the initial RAM disk, use

1mkinitcpio -p linux