-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

a few weeks before I sent in a patch to the manual describing the usage
of Debian Live on a USB stick partition other than the first using GRUB.
I think it got lost, so I'm resending it. I would like to get it
reviewed, I'm not exactly sure if all the things I did there should go
into the manual.

regards

Maximlian Weigand
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknkx/cACgkQpFuh3WZTcjXm3QCdF5ESYx67mwdJ0Y5XhKSbskoZ
x4QAoIL/k8fvCmUVAkTjlUSrL+/GwDEp
=QJLd
-----END PGP SIGNATURE-----
diff --git a/xml/chapters/basics.xml b/xml/chapters/basics.xml
index d4920c6..3c6e607 100644
--- a/xml/chapters/basics.xml
+++ b/xml/chapters/basics.xml
@@ -137,6 +137,155 @@ FIXME:
 Describe installing Debian Live to a partition (e.g. /dev/sdc1) AND using a 
bootloader to boot this.
 </para>
 </section>
+
+<section>
+<title>Installing Debian Live to a Partition</title>
+<para>
+It is possible to install the created live system to a already existend 
partition on the USB stick. In this way you can later on install new versions 
without overwriting the partition table of the USB stick (and therefore 
deleting all data on the stick). The GRUB Bootloader will be used to boot the 
Debian Live system from a partition.
+</para>
+
+<para>
+The first step is to create a normal USB <filename>binary.img</filename> as 
described above. This file contains not only the Debian Live system made 
bootable on a partition, but also a whole new partition layout for the USB 
stick. Therefore, if this partition layout is written to the stick, all 
existing partitions will be lost. Therefore, we now extract only the content of 
the partition containing the live system and will then write it to an existing 
partition later on.
+</para>
+
+<para>
+You can skip the first two items in the following directives. They are only 
used to get the offset at which the partition 1 resides in the 
<filename>binary.img</filename>
+</para>
+
+<itemizedlist>
+<listitem>
+<para>
+Extract the MBR out of the <filename>binary.img</filename>
+</para>
+<screen>
+$ dd if=binary.img bs=512 count=10 of=mbr.img
+$ file mbr.img
+1.img: x86 boot sector; partition 1: ID=0x83, active, starthead 1, startsector 
63, 3084417 sectors
+</screen>
+</listitem>
+
+<listitem>
+<para>
+Extract the boot sector of the partition 1 out of 
<filename>binary.img</filename>
+<screen>
+$ dd if=binary.img bs=512 count=12 skip=63 of=part.img
+$ file part.img
+part.img: x86 boot sector
+</screen>
+</para>
+</listitem>
+
+<listitem>
+<para>
+Copy partition 1 of <filename>binary.img</filename> to a seperate file (Could 
also directly write to usb stick).
+</para>
+
+<screen>
+dd if=binary.img bs=512 skip=63 of=binary_part1.img
+</screen>
+</listitem>
+
+<listitem>
+<para>
+Prepare USB stick: Create three partitions on the stick: The first one is the 
data partition, formated with FAT 32 to allow for data exchange with Windows. 
It has to be the first partition because often Windows can only read this one.
+
+The next partition is a small (100 MB) partition used to store the GRUB files, 
followed by the third partition which will contain the Debian Live system. You 
should choose the size of the first and third partition accordingly to your 
needs. The third partition has to be the size of the 
<filename>binary_part1.img</filename> at leat, but it doesn't matter if its 
bigger.
+</para>
+
+<para>
+Set the BOOTABLE Flag for the second partition.
+</para>
+
+<para>
+Format the first and second partitions to FAT32 respectively FAT 16:
+<screen>
+$ mkdosfs ${USBSTICK}1 
+$ mkfs.vfat -F32 ${USBSTICK}2
+</screen>
+
+You don't have to format the third partition, it will be fully configured by 
copying the <filename>binary_part1.img</filename> to it later on.
+</para>
+
+<para>
+For example, below you find the possible partition layout of a 8 GB stick:
+<screen>
+(parted) print                                                            
+Model: SanDisk Cruzer Micro (scsi)
+Disk /dev/sdc: 8036MB
+Sector size (logical/physical): 512B/512B
+Partition Table: msdos
+
+Number  Start   End     Size    Type     File system  Flags
+ 1      32,3kB  5001MB  5001MB  primary  fat32             
+ 2      5001MB  5100MB  98,7MB  primary  fat16             
+ 3      5100MB  8036MB  2936MB  primary  fat16        boot
+</screen>      
+</para>
+
+</listitem>
+
+<listitem>
+<para>
+Prepare and install GRUB on the usb stick:
+</para>
+
+<para>
+First you have to make sure you have GRUB installed. The following directions 
only apply to GRUB-LEGACY (not GRUB 2). If you haven't installed it yet, do it 
now:
+<screen>
+$ sudo aptitude install grub
+</screen>
+</para>
+
+<para>
+Now mount the second partition of the USB stick (you don't have to use /mnt as 
a mount point, any other will do):
+<screen>
+$ mount ${USBSTICK}2 /mnt
+</screen>
+</para>
+
+<para>
+Create the necessary directories:
+<screen>
+$ mkdir -p /mnt/boot/grub
+</screen>
+Create <filename>device.map</filename>:
+<screen>
+$ cat &gt;&gt; /mnt/boot/grub/device.map &lt;&lt; EOF
+(hd0) /dev/${USBSTICK}
+EOF
+</screen>
+Create <filename>menu.lst</filename>. This is the file where you configure the 
partitions to boot. Setting the timeout to zero results in GRUB directly 
booting the Debian Live partition.
+<screen>
+cat &gt;&gt; $mnt/boot/grub/menu.lst &lt;&lt; EOF
+timeout 0
+
+title Debian Live
+rootnoverify (hd0,2)
+chainloader +1
+makeactive
+EOF
+</screen>
+</para>
+
+<para>Now install GRUB to the stick:
+<screen>
+$ grub-install --root-directory=/mnt ${USBSTICK}
+</screen>
+</para>
+</listitem>
+
+<listitem>
+Now copy over the <filename>binary_part1.img</filename> to the third partition 
of the USB stick:
+<screen>
+$ dd if=binary_part1.img of=${USBSTICK}3 bs=1M
+</screen>
+</listitem>
+</itemizedlist>
+
+<para>
+At this point you should have a bootable USB stick with a Debian Live system 
and a FAT32 data partition which you can use to exchange data with other 
operating systems. 
+</para>
+</section>
 </section>
 
 <section>

Reply via email to