BootingUsbKey

From MorphixWiki

Jump to: navigation, search

ortasit Making a USB key bootable

The information below provides an overview of the steps you need to follow in order to create a bootable ext2 based file system partition on a USB key.

The information below is based on the assumptions that your USB key is /dev/sda and that it can be mounted to /media/usbdisk.

Run 'fdisk/dev/sda' and create at least one partition and mark it as bootable. The following steps will assume the bootable partition is the first one (ie. /dev/sda1).

Now that you have a bootable partition, run the following commands:

mke2fs /dev/sda1
mount /dev/sda1 /media/usbdisk
grub-install --no-floppy --root-directory=/media/usbdisk /dev/sda
cd /media/usbdisk/boot/grub
rm fat_stage1_5 ffs_stage_1_5 iso9660_stage_1_5 jfs_stage_1_5 minix_stage_1_5
rm reiserfs_stage_1_5 ufs2_stage_1_5 vstatfs_stage_1_5 xfs_stage_1_5
cd -

At this point, the only remaining stage1_5 file in /media/usbdisk/boot/grub should be the one named 'e2fs_stage1_5'.

The remaining information is for use when remastering a CD-ROM image for use on a USB key.

Delete (or don't copy) the stage1, stage2, and *stage1_5 files from the /boot/grub directory of the ISO being remastered for a USB key prior to copying the ISO files over to the USB key.

In the grub directory, create a symlink called menu.1st which points to grub.conf. Add bootusb1 or bootusb2 to the kernel command line of the grub.conf file in /boot/grub.

Personal tools