FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 06-04-2010, 05:37 AM
Sergey Manucharian
 
Default 2nd partition for bootable USB flash drive

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<------------------------------
 

Thread Tools




All times are GMT. The time now is 08:34 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org