Pendrive Linux: Difference between revisions
(1st version) |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Everything on how to make a persistent Live USB Linux, pen drive linux, install linux on a flash drive, from Windows or Linux... |
|||
== References == |
== References == |
||
* NetBookIn |
|||
* Ubuntu wiki: https://wiki.ubuntu.com/LiveUsbPendrivePersistent) |
* Ubuntu wiki: https://wiki.ubuntu.com/LiveUsbPendrivePersistent) |
||
* [http://unetbootin.sourceforge.net/ UNetbootin] |
|||
* [http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/ Universal USB Installer] on pendrivelinux.com |
|||
* [http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/ Universal USB Installer] on pendrivelinux.com, simply the best on Windows. |
|||
== |
== Using Automatic Tools == |
||
* Extract Linux CD in USB root |
|||
* Delete folder [ROOT] |
|||
* Copy the files to USB root: |
|||
menu.c32 |
|||
syslinux.cfg |
|||
ubnfilel.txt (list of all files on the cd - probably useless) |
|||
ubnpathl.txt (list of all dir on the cd - probably useless) |
|||
* Copy /casper/vmlinuz to /ubnkern |
|||
* Copy /casper/initrd.lz to /ubninit |
|||
=== Universal USB Installer (Windows) === |
|||
* Use "PDL-Casper-RW-Creator.exe" to create the casper file |
|||
See [http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/ Universal USB Installer] on pendrivelinux.com. |
|||
* Then edit D:\syslinux.cfg (where D: is the drive letter of your usb stick), and add "persistent" at the end of the line that begins with "append": |
|||
=== UNetbootin (Windows, Linux) === |
|||
=== Startup Disk Creator (Ubuntu) === |
|||
This is an utility on Ubuntu. |
|||
* Launch ''Startup Disk Creator'' in menu ''System'' → ''Administration''. |
|||
* Select ISO you want to use |
|||
* Select a free ''FAT32'' partition on your USB drive ({{red|BEWARE! Don't let it erase the partition, because that b*tch will erase the '''WHOLE''' disk}}) |
|||
* Select size of ''casper'' file for persistent |
|||
* ... and let's go. |
|||
In case you want several partitions, first create your partitions yourself with e.g. '''gparted''', allocating a free ''FAT32'' for the Ubuntu partition. Eg: |
|||
{| style="margin-left:2em;" class="wikitable" |
|||
|- |
|||
|sdb1||NTFS|| || || Data partition |
|||
|- |
|||
|sdb2||FAT32|| 2850MB || || Ubuntu (850MB) + Casper-rw file (2000MB) |
|||
|} |
|||
Alternatively you can also use a separate ''casper-rw'' partition: |
|||
{| style="margin-left:2em;" class="wikitable" |
|||
|- |
|||
|sdb1||NTFS|| || || Data partition |
|||
|- |
|||
|sdb2||FAT32|| 850MB || || Ubuntu |
|||
|- |
|||
|sdb3||ext3|| 2000MB ||<tt>casper-rw</tt>||persistent storage |
|||
|} |
|||
Note that ''Windows XP'' (and maybe later) only shows the first partition on USB drive (because it is seen as a removable media, see [[USB]]). So you should create your data partition as the first partition on the disk. |
|||
== Manual recipes == |
|||
=== Recipe based on Universal USB Installer (Windows) === |
|||
Assuming we install '''Ubuntu Lucid 10.04.2''' on '''H:''' drive |
|||
* Install SysLinux |
|||
<source lang="bash"> |
|||
syslinux.exe -maf H: |
|||
</source> |
|||
* Extract linux ISO in USB root |
|||
<source lang="bash"> |
|||
# Exclude directory [BOOT] |
|||
7zG.exe x ubuntu-10.04.2-desktop-i386.iso -o"H:\" -y -x![BOOT]* |
|||
</source> |
|||
* Create configuration files: |
|||
{|style="margin-left:2em;" |
|||
|- |
|||
|<tt>H:\isolinux\</tt>||→||<tt>H:\syslinux\</tt> |
|||
|- |
|||
|<tt>H:\isolinux\isolinux.cfg</tt>||→||<tt>H:\syslinux\syslinux.cfg</tt> |
|||
|} |
|||
* Create file <tt>H:\syslinux\text.cfg</tt>, with as content (from <tt>ubuntu1004text.cfg</tt>): |
|||
<source lang="text"> |
<source lang="text"> |
||
default |
default live |
||
label |
label live |
||
menu label ^Run Ubuntu from this USB |
|||
kernel /ubnkern |
|||
kernel /casper/vmlinuz |
|||
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash persistent -- |
|||
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz splash -- |
|||
label live-install |
|||
menu label ^Install Ubuntu on a Hard Disk |
|||
kernel /casper/vmlinuz |
|||
append cdrom-detect/try-usb=true file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz splash -- |
|||
label memtest |
|||
menu label Test ^memory |
|||
kernel /install/mt86plus |
|||
label hd |
|||
menu label ^Boot from first hard disk |
|||
localboot 0x80 |
|||
</source> |
</source> |
||
* Create casper file <tt>H:\casper-rw</tt> (see below) |
|||
== |
=== Create the CASPER file / partition === |
||
To create a persistent file (4GB file): |
To create a persistent file (here 4GB file), assuming USB is at <tt>/media/PENDRIVE</tt>: |
||
<source lang="bash"> |
<source lang="bash"> |
||
dd if=/dev/zero of= |
dd if=/dev/zero of=/media/PENDRIVE/casper-rw bs=1M count=4096 --progress |
||
mke2fs -b |
mke2fs -b 4096 -L casper-rw /media/PENDRIVE/casper-rw |
||
</source> |
</source> |
||
Also works on '''Windows''', but requires <code>dd.exe</code> and <code>mke2fs</code> (see for instance ''Universal USB Installer'') |
|||
To create a persistent partition: |
To create a persistent partition: |
||
<source lang="bash"> |
<source lang="bash"> |
||
sudo mkfs.ext3 -b 4096 -L casper-rw /dev/ |
sudo mkfs.ext3 -b 4096 -L casper-rw /dev/sdb3 # mkfs.ext3 is the same as mke2fs |
||
dd if=/dev/zero of=/media/hda1/casper-rw bs=1M count=128 |
|||
mkfs.ext3 /media/hda1/casper-rw |
|||
</source> |
</source> |
||
== |
=== Variants === |
||
We have by default: |
|||
* Created partition: 1 for extract iso, 1 for casper-rw |
|||
{|style="margin-left:2em;" |
|||
* extract the .ISO to usb |
|||
|- |
|||
* make the drive bootable: |
|||
| ||<tt>/isolinux/isolinux.cfg</tt> |
|||
<source lang="bash"> |
|||
|- |
|||
syslinux -maf X: |
|||
|→ includes → ||<tt>menu.cfg</tt> |
|||
|- |
|||
|→ includes → ||<tt>text.cfg</tt> |
|||
|} |
|||
So we can simply add a file <tt>/syslinux.cfg</tt> (necessary for ''syslinux'', the boot used on USB): |
|||
<source lang="text"> |
|||
include /isolinux/isolinux.cfg |
|||
</source> |
</source> |
||
* delete [BOOT] |
|||
* created /syslinux.cfg |
|||
* include /isolinux/isolinux.cfg |
Latest revision as of 13:46, 1 June 2011
Everything on how to make a persistent Live USB Linux, pen drive linux, install linux on a flash drive, from Windows or Linux...
References
- Ubuntu wiki: https://wiki.ubuntu.com/LiveUsbPendrivePersistent)
- UNetbootin
- Universal USB Installer on pendrivelinux.com, simply the best on Windows.
Using Automatic Tools
Universal USB Installer (Windows)
See Universal USB Installer on pendrivelinux.com.
UNetbootin (Windows, Linux)
Startup Disk Creator (Ubuntu)
This is an utility on Ubuntu.
- Launch Startup Disk Creator in menu System → Administration.
- Select ISO you want to use
- Select a free FAT32 partition on your USB drive (BEWARE! Don't let it erase the partition, because that b*tch will erase the WHOLE disk)
- Select size of casper file for persistent
- ... and let's go.
In case you want several partitions, first create your partitions yourself with e.g. gparted, allocating a free FAT32 for the Ubuntu partition. Eg:
sdb1 | NTFS | Data partition | ||
sdb2 | FAT32 | 2850MB | Ubuntu (850MB) + Casper-rw file (2000MB) |
Alternatively you can also use a separate casper-rw partition:
sdb1 | NTFS | Data partition | ||
sdb2 | FAT32 | 850MB | Ubuntu | |
sdb3 | ext3 | 2000MB | casper-rw | persistent storage |
Note that Windows XP (and maybe later) only shows the first partition on USB drive (because it is seen as a removable media, see USB). So you should create your data partition as the first partition on the disk.
Manual recipes
Recipe based on Universal USB Installer (Windows)
Assuming we install Ubuntu Lucid 10.04.2 on H: drive
- Install SysLinux
syslinux.exe -maf H:
- Extract linux ISO in USB root
# Exclude directory [BOOT]
7zG.exe x ubuntu-10.04.2-desktop-i386.iso -o"H:\" -y -x![BOOT]*
- Create configuration files:
H:\isolinux\ | → | H:\syslinux\ |
H:\isolinux\isolinux.cfg | → | H:\syslinux\syslinux.cfg |
- Create file H:\syslinux\text.cfg, with as content (from ubuntu1004text.cfg):
default live
label live
menu label ^Run Ubuntu from this USB
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz splash --
label live-install
menu label ^Install Ubuntu on a Hard Disk
kernel /casper/vmlinuz
append cdrom-detect/try-usb=true file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz splash --
label memtest
menu label Test ^memory
kernel /install/mt86plus
label hd
menu label ^Boot from first hard disk
localboot 0x80
- Create casper file H:\casper-rw (see below)
Create the CASPER file / partition
To create a persistent file (here 4GB file), assuming USB is at /media/PENDRIVE:
dd if=/dev/zero of=/media/PENDRIVE/casper-rw bs=1M count=4096 --progress
mke2fs -b 4096 -L casper-rw /media/PENDRIVE/casper-rw
Also works on Windows, but requires dd.exe
and mke2fs
(see for instance Universal USB Installer)
To create a persistent partition:
sudo mkfs.ext3 -b 4096 -L casper-rw /dev/sdb3 # mkfs.ext3 is the same as mke2fs
Variants
We have by default:
/isolinux/isolinux.cfg | |
→ includes → | menu.cfg |
→ includes → | text.cfg |
So we can simply add a file /syslinux.cfg (necessary for syslinux, the boot used on USB):
include /isolinux/isolinux.cfg