2nd partition for bootable USB flash drive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi folks,

Of course, it's very convenient to install Archlinux using a bootable
USB flash putting the corresponding .iso file in it (e.g.
archlinux-2010.05-core-i686.iso). But it's not convenient to keep a
separate flash drive for it. The natural solution is to create
another partition at the same jump drive for regular file transfers
etc. Linux has no problem working with multiple partitions, but not M$
Windows. It principally recognizes only the 1st partition. Some flash
drives can be hacked with toggling so called Removable Media Bit, but
most cannot.

I realized that the easiest way is to "manually" change the partition
number of the bootable image before writing it into a flash drive. The
script below does it rewriting the partition record from the first line
to the second one. (Alternatively you can rework it to read back the
MBR from the bootable drive, hack it and write back). Then with fdisk
you can create another partition with number 1 - and voilà - it will be
recognizable even by M$.

Cheers,
Sergey

(the script is far from being perfect, just illustrates the idea)
----------------------------------8<------------------------------
#!/bin/bash
# changes the partition number of bootable image from 1 to 2 
# accepts a bootable image file as argument

BLOCK=1
COUNT=16
PARTTBL_OFFSET=446
TEMP_FILE=/tmp/part_table

dd if=/dev/zero of=$TEMP_FILE bs=$BLOCK count=$COUNT
dd if=$1 of=$TEMP_FILE bs=$BLOCK skip=$PARTTBL_OFFSET seek=$COUNT
count=$COUNT
dd if=$TEMP_FILE of=$1 bs=$BLOCK seek=$PARTTBL_OFFSET
conv=notrunc count=$((COUNT*2))
----------------------------------8<------------------------------



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux