Linux ISO to bootable USB

From Noah.org
Jump to: navigation, search


Install syslinux

aptitude install syslinux

Totally wipe the USB device. Faster:

dd if=/dev/zero of=/dev/sdb bs=4096 count=35
dd if=/dev/zero of=/dev/sdb bs=4096 count=35 seek=$(($(blockdev --getsz /dev/sdb)*512/4096 - 35))

Safer:

<pre>
dd if=/dev/zero of=/dev/sdb bs=512

Make sure the kernel knows about the new partition information.

partprobe /dev/sdb

Maybe partition the damn thing?

# fdisk -l /dev/sdb

Disk /dev/sdb: 2003 MB, 2003828736 bytes
9 heads, 40 sectors/track, 10871 cylinders, total 3913728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6a204df6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048     3913727     1955840    6  FAT16

Make a filesystem.

mkfs.vfat -F 16 /dev/sdb1
  1. NO Copy the ISO to the USB device using dd.
  2. NO
#NO dd if=ubuntu-13.10-desktop-amd64.iso of=/dev/sdb bs=4096 #NO

Again, make sure the kernel knows about the new partition information.

partprobe /dev/sdb
mkdir /mnt/iso
mount -o loop,ro -t iso9660 ubuntu-13.10-desktop-amd64.iso /mnt/iso
mkdir -p /mnt/sdb1
mount -t vfat /dev/sdb1 /mnt/sdb1
cp -rL /mnt/iso/* /mnt/sdd1/.
sync
dd conv=notrunc bs=440 count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sdb
# already done in the initial partitioning. Shouldn't need to do this again.
parted /dev/sdb set 1 boot on 

old attempts

Run syslinux on the first partition of the USB device.

syslinux -i /dev/sdb1
dd conv=notrunc bs=440 count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sdb
parted /dev/sdb set 1 boot on