| 1 |
<?xml version='1.0' encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
|
| 3 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/liveusb.xml,v 1.3 2006/01/08 21:56:04 rane Exp $ -->
|
| 4 |
|
| 5 |
<guide link="/doc/en/liveusb.xml">
|
| 6 |
<title>Gentoo Linux LiveUSB HOWTO</title>
|
| 7 |
|
| 8 |
<author title="Author">
|
| 9 |
<mail link="brix@gentoo.org">Henrik Brix Andersen</mail>
|
| 10 |
</author>
|
| 11 |
|
| 12 |
<abstract>
|
| 13 |
This HOWTO explains how to create a Gentoo Linux LiveUSB or, in other words,
|
| 14 |
how to emulate a Gentoo Linux Installation CD using an USB flash drive.
|
| 15 |
</abstract>
|
| 16 |
|
| 17 |
<!-- The content of this document is licensed under the CC-BY-SA license -->
|
| 18 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
|
| 19 |
<license/>
|
| 20 |
|
| 21 |
<version>1.0</version>
|
| 22 |
<date>2006-01-04</date>
|
| 23 |
|
| 24 |
<chapter>
|
| 25 |
<title>Introduction</title>
|
| 26 |
<section>
|
| 27 |
<title>The LiveUSB</title>
|
| 28 |
<body>
|
| 29 |
|
| 30 |
<p>
|
| 31 |
This HOWTO explains how to create a <e>Gentoo Linux LiveUSB</e> or, in other
|
| 32 |
words, how to emulate a Gentoo Linux Installation CD using an USB flash drive.
|
| 33 |
This is particularly useful for installing Gentoo Linux on a modern laptop with
|
| 34 |
no CD-ROM drive.
|
| 35 |
</p>
|
| 36 |
|
| 37 |
<p>
|
| 38 |
Although the instructions found in this document aim at emulating a Gentoo
|
| 39 |
Linux Installation CD using an USB flash drive, they should work for any
|
| 40 |
arbitrary block device as long as you adjust the device names accordingly.
|
| 41 |
</p>
|
| 42 |
|
| 43 |
</body>
|
| 44 |
</section>
|
| 45 |
<section>
|
| 46 |
<title>Prerequisites</title>
|
| 47 |
<body>
|
| 48 |
|
| 49 |
<p>
|
| 50 |
In order to use a Gentoo Linux LiveUSB you need the following:
|
| 51 |
</p>
|
| 52 |
|
| 53 |
<ul>
|
| 54 |
<li>Bootable USB flash drive (at least 64MB)</li>
|
| 55 |
<li>x86 computer with support for booting from USB</li>
|
| 56 |
</ul>
|
| 57 |
|
| 58 |
<p>
|
| 59 |
You will also need access to the following for creating the LiveUSB:
|
| 60 |
</p>
|
| 61 |
|
| 62 |
<ul>
|
| 63 |
<li>
|
| 64 |
A computer running Gentoo Linux (or alternatively another Linux
|
| 65 |
distribution)
|
| 66 |
</li>
|
| 67 |
</ul>
|
| 68 |
|
| 69 |
</body>
|
| 70 |
</section>
|
| 71 |
</chapter>
|
| 72 |
<chapter>
|
| 73 |
<title>Preparing the USB flash drive</title>
|
| 74 |
<section>
|
| 75 |
<title>Partitioning the drive</title>
|
| 76 |
<body>
|
| 77 |
|
| 78 |
<warn>
|
| 79 |
These instructions will erase all data from the USB flash drive. Make sure to
|
| 80 |
backup your data first.
|
| 81 |
</warn>
|
| 82 |
|
| 83 |
<impo>
|
| 84 |
This HOWTO assumes that the <path>/dev/sda</path> device node corresponds to
|
| 85 |
your USB flash drive. If you have other SCSI-like devices make sure to use the
|
| 86 |
correct device node.
|
| 87 |
</impo>
|
| 88 |
|
| 89 |
<p>
|
| 90 |
Create a FAT32 partition on your USB flash drive and mark it bootable using
|
| 91 |
<c>fdisk</c>. An example partitioning scheme can be seen below:
|
| 92 |
</p>
|
| 93 |
|
| 94 |
<pre caption="Example partitioning scheme">
|
| 95 |
# <i>fdisk -l /dev/sda</i>
|
| 96 |
|
| 97 |
Disk /dev/sda: 1048 MB, 1048313856 bytes
|
| 98 |
33 heads, 61 sectors/track, 1017 cylinders
|
| 99 |
Units = cylinders of 2013 * 512 = 1030656 bytes
|
| 100 |
|
| 101 |
Device Boot Start End Blocks Id System
|
| 102 |
/dev/sda1 * 1 1017 1023580 b W95 FAT32
|
| 103 |
</pre>
|
| 104 |
|
| 105 |
</body>
|
| 106 |
</section>
|
| 107 |
<section>
|
| 108 |
<title>Creating the filesystem</title>
|
| 109 |
<body>
|
| 110 |
|
| 111 |
<p>
|
| 112 |
Create a FAT32 filesystem on the USB flash drive using <c>mkdosfs</c>:
|
| 113 |
</p>
|
| 114 |
|
| 115 |
<pre caption="Running mkdosfs">
|
| 116 |
<comment>(Make sure you have sys-fs/dosfstools installed)</comment>
|
| 117 |
# <i>emerge -av sys-fs/dosfstools</i>
|
| 118 |
# <i>mkdosfs -F 32 /dev/sda1</i>
|
| 119 |
mkdosfs 2.11 (12 Mar 2005)
|
| 120 |
</pre>
|
| 121 |
|
| 122 |
</body>
|
| 123 |
</section>
|
| 124 |
<section>
|
| 125 |
<title>Installing a Master Boot Record</title>
|
| 126 |
<body>
|
| 127 |
|
| 128 |
<p>
|
| 129 |
Install the precompiled Master Boot Record (MBR) from <c>syslinux</c> on the
|
| 130 |
USB flash drive:
|
| 131 |
</p>
|
| 132 |
|
| 133 |
<pre caption="Installing a master boot record">
|
| 134 |
<comment>(Make sure you have sys-boot/syslinux-3.00 or later installed)</comment>
|
| 135 |
# <i>emerge -av '>=sys-boot/syslinux-3*'</i>
|
| 136 |
# <i>dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda</i>
|
| 137 |
0+1 records in
|
| 138 |
0+1 records out
|
| 139 |
</pre>
|
| 140 |
|
| 141 |
</body>
|
| 142 |
</section>
|
| 143 |
</chapter>
|
| 144 |
<chapter>
|
| 145 |
<title>Copying the files</title>
|
| 146 |
<section>
|
| 147 |
<title>Mounting the Gentoo Linux Installation CD</title>
|
| 148 |
<body>
|
| 149 |
|
| 150 |
<p>
|
| 151 |
Download the <path>install-x86-minimal-2005.1-r1.iso</path> file from your
|
| 152 |
local Gentoo Linux <uri link="/main/en/where.xml">mirror</uri> site and mount
|
| 153 |
the ISO image on <path>/mnt/cdrom/</path> as shown below:
|
| 154 |
</p>
|
| 155 |
|
| 156 |
<pre caption="Mounting the Gentoo Linux Installation CD ISO image">
|
| 157 |
<comment>(Create the /mnt/cdrom/ mount point if needed)</comment>
|
| 158 |
# <i>mkdir -p /mnt/cdrom</i>
|
| 159 |
# <i>mount -o loop,ro -t iso9660 install-x86-minimal-2005.1-r1.iso /mnt/cdrom/</i>
|
| 160 |
</pre>
|
| 161 |
|
| 162 |
</body>
|
| 163 |
</section>
|
| 164 |
<section>
|
| 165 |
<title>Mounting the LiveUSB</title>
|
| 166 |
<body>
|
| 167 |
|
| 168 |
<p>
|
| 169 |
Mount the newly formatted USB flash drive on <path>/mnt/usb/</path> as shown
|
| 170 |
below:
|
| 171 |
</p>
|
| 172 |
|
| 173 |
<pre caption="Mounting the USB flash drive">
|
| 174 |
<comment>(Create the /mnt/usb/ mount point if needed)</comment>
|
| 175 |
# <i>mkdir -p /mnt/usb</i>
|
| 176 |
# <i>mount -t vfat /dev/sda1 /mnt/usb/</i>
|
| 177 |
</pre>
|
| 178 |
|
| 179 |
</body>
|
| 180 |
</section>
|
| 181 |
<section>
|
| 182 |
<title>Copying the files</title>
|
| 183 |
<body>
|
| 184 |
|
| 185 |
<p>
|
| 186 |
Copy the files from the Gentoo Linux Installation CD to the LiveUSB. The files
|
| 187 |
need to be reordered a bit as we will be using the <c>syslinux</c> bootloader
|
| 188 |
instead of <c>isolinux</c>:
|
| 189 |
</p>
|
| 190 |
|
| 191 |
<pre caption="Copying the files">
|
| 192 |
# <i>cp -r /mnt/cdrom/* /mnt/usb/</i>
|
| 193 |
# <i>mv /mnt/usb/isolinux/* /mnt/usb/</i>
|
| 194 |
# <i>mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg</i>
|
| 195 |
# <i>rm -rf /mnt/usb/isolinux*</i>
|
| 196 |
|
| 197 |
<comment>(The memtest86 kernel needs to be renamed for loading it via syslinux)</comment>
|
| 198 |
# <i>mv /mnt/usb/memtest86 /mnt/usb/memtest</i>
|
| 199 |
</pre>
|
| 200 |
|
| 201 |
<p>
|
| 202 |
You can now unmount the ISO image:
|
| 203 |
</p>
|
| 204 |
|
| 205 |
<pre caption="Unmounting the ISO image">
|
| 206 |
# <i>umount /mnt/cdrom/</i>
|
| 207 |
</pre>
|
| 208 |
|
| 209 |
</body>
|
| 210 |
</section>
|
| 211 |
<section>
|
| 212 |
<title>Adjusting the bootloader configuration</title>
|
| 213 |
<body>
|
| 214 |
|
| 215 |
<p>
|
| 216 |
Adjust the syslinux configuration file using <c>sed</c> as shown below. The
|
| 217 |
<c>scandelay=10</c> parameter will introduce a 10 seconds delay before
|
| 218 |
attempting to mount the filesystem. This is needed to allow the USB flash drive
|
| 219 |
to settle upon detection.
|
| 220 |
</p>
|
| 221 |
|
| 222 |
<pre caption="Adjusting the boot parameters">
|
| 223 |
# <i>sed -i \
|
| 224 |
-e "s:cdroot:cdroot scandelay=10:" \
|
| 225 |
-e "s:kernel memtest86:kernel memtest:" \
|
| 226 |
/mnt/usb/syslinux.cfg</i>
|
| 227 |
</pre>
|
| 228 |
|
| 229 |
<note>
|
| 230 |
Consider adding <c>docache</c> to the boot parameters. This will allow running
|
| 231 |
<c>umount /mnt/cdrom/</c> after booting so that you can unplug the USB flash
|
| 232 |
drive.
|
| 233 |
</note>
|
| 234 |
|
| 235 |
</body>
|
| 236 |
</section>
|
| 237 |
</chapter>
|
| 238 |
<chapter>
|
| 239 |
<title>Installing a bootloader</title>
|
| 240 |
<section>
|
| 241 |
<title>Unmounting the drive</title>
|
| 242 |
<body>
|
| 243 |
|
| 244 |
<p>
|
| 245 |
Make sure you unmount the USB flash drive before installing the bootloader:
|
| 246 |
</p>
|
| 247 |
|
| 248 |
<pre caption="Unmounting the USB flash drive">
|
| 249 |
# <i>umount /mnt/usb/</i>
|
| 250 |
</pre>
|
| 251 |
|
| 252 |
</body>
|
| 253 |
</section>
|
| 254 |
<section>
|
| 255 |
<title>Installing syslinux</title>
|
| 256 |
<body>
|
| 257 |
|
| 258 |
<p>
|
| 259 |
Finally install the <c>syslinux</c> bootloader on the USB flash drive:
|
| 260 |
</p>
|
| 261 |
|
| 262 |
<pre caption="Running syslinux">
|
| 263 |
# <i>syslinux /dev/sda1</i>
|
| 264 |
</pre>
|
| 265 |
|
| 266 |
<impo>
|
| 267 |
You will need to rerun <c>syslinux /dev/sda1</c> each time you modify the
|
| 268 |
<path>syslinux.cfg</path> file for the configuration changes to take affect.
|
| 269 |
</impo>
|
| 270 |
|
| 271 |
</body>
|
| 272 |
</section>
|
| 273 |
</chapter>
|
| 274 |
<chapter>
|
| 275 |
<title>Using the LiveUSB</title>
|
| 276 |
<section>
|
| 277 |
<title>Booting</title>
|
| 278 |
<body>
|
| 279 |
|
| 280 |
<p>
|
| 281 |
Insert the USB flash drive and turn on the computer, making sure the BIOS is
|
| 282 |
set to boot from USB. If all goes well you should be presented with a standard
|
| 283 |
syslinux prompt.
|
| 284 |
</p>
|
| 285 |
|
| 286 |
<p>
|
| 287 |
You should be able to follow the generic installation instructions found in the
|
| 288 |
<uri link="/doc/en/handbook/">Gentoo Handbook</uri> from here on.
|
| 289 |
</p>
|
| 290 |
|
| 291 |
</body>
|
| 292 |
</section>
|
| 293 |
</chapter>
|
| 294 |
</guide>
|