Bootable_USB_WIKI-V2.txt
This document describes how to make a Bootable USB Device with Linux OS.
==Needed==
* USB Device (stick or disk).
* (Live)Image or CD/DVD with your favorite distribution.
==Prepare==
* Plugin your USB Device.
* Display devicename with 'df -h' or 'mount'.
* Unmount device with 'umount <devicename>' e.g. 'umount /dev/sdb' BUT don't remove the device!
* Startup Parted, with 'parted <devicename>' e.g. 'parted /dev/sdb'
* Display the current partition table with 'print'.
Below shows an output example from the partition table:
Disk geometry for /dev/sdb: 0.000-7663,999 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0,031 1953,215 primary fat16 startup, lba
2 1953,215 7663,820 extended lba
5 1953,246 7663,820 logical fat32
* If you have an older bios then it possible wouldn't boot from a FAT32 partition.
- Cause of that it's better to create a FAT16 partition.
* But if you have a device bigger than 2Gb you can't use all that space because
- you can't make a FAT16 partition bigger than 2Gb.
Create partitions:
* Remove the current partiontable with 'rm <Minor #>' e.g. 'rm 1' CAUTION ALL DATA ON THE PARTITION/DEVICE WILL BE LOST!
* Repeat this for all partitions, in case example above also 2 & 5.
* Create a primary partition from 2Gb with 'mkpart primary fat16 0 2048'. Start and endpoint in Mb.
* Make that partition bootable with 'toggle <Minor #> boot' e.g. 'toggle 1 boot'.
* Create an extended FAT32 partition for all the other space on the device with: 'mkpart extended 2049 4096'
- in this example the device is 4Gb and the startpoint begins after endpoint primary partition.
* Create a logical partition for this extended partition with: 'mkpart logic fat32 2049 4096'.
- You can also choose to split the extended partition in two or more logical partitions.
Create filesystem:
* First check with parted option 'print' for the right partitionnumbers!
* On the primary partition: '/sbin/mkdosfs -F 16 -n usbdisk /dev/sdb1'
- where '-n usbdisk' is an optional disklabel, '/dev/sdb' the devicename and '1' it's partition number.
* On the logical partition: '/sbin/mkdosfs -F 32 -n data /dev/sdb5'
==Copy your favorite distro to the device==
- If booted from live cd/dvd:
* Startup your machine with Live cd/dvd.
* cd to directory with livetools e.g. /media/live/LiveOS
* 'livecd-iso-to-disk (--noverify) --overlay-size-mb nnn /dev/cdrom /dev/USBPARTITIONNAME'
- e.g. 'livecd-iso-to-disk --overlay-size-mb 1024 /dev/cdrom /dev/sdb1'
NOTE: if you want to use the device for installing Linux on other systems, then overlay-size should be at least 512Mb!
- Or copy your favorite distro with ISO:
* Download .iso file with your favorite distro.
* Install the Livecd-tools on your system: 'yum install livecd-tools' for RPM based distro's
- or 'apt-get install livecd-tools' for deb(ian) based distro's
* 'livecd-iso-to-disk (--noverify) –overlay-size-mb nnn path-to-iso <device/partition>
- e.g. 'livecd-iso-to-disk --overlay-size-mb 1024 /home/wiki/Linux-distro.iso /dev/sdb1'
- (/home/wiki/...., or wherever you stored your iso-file)
==Check device==
* When finished you can check your device with: 'dmsetup status'.
- Output must look similar like below:
live-osimg.min: 0 8388608 snapshot 2352/2352 24
live-rw: 0 8388608 snapshot 42296/204800 176
|
|