# Live distro and Full Linux Install/Creating a live USB stick

This document assumes that you are familiar with, and not afraid of using a command shell.
Simpler instructions for creating a live USB stick if you already have one
BACK-UP YOUR DATA! We do not recommend working on a hdd, or a usb drive, that has important data on it without keeping another copy somewhere else. We can not, and will not ever, assume responsibility, implied or expressed, for any loss of data incurred using this guide. Again, back-up your data Luke!
This guide assumes that you have a working distro CD or DVD (or a running virtualisation image, e.g. using qemu FIXME-does this work??) from which you can create the USB stick. You can create working devices from other gnu/linux distros too, using these instructions.

## Creating a USB bootable drive in Linux using make-live-device.sh
### Summary of steps

* Download and install dependencies: bzr (bazaar), grub2 and (g)parted. (If you're running the distro, these are already installed.)
* Check out bouilloncube source code from launchpad.
* Download the DVD (or CD) iso image from one of the distro mirrors. Refer to the Getting the distro page for ways to do that.
* Plug in the USB stick, find out which device file to use and run the make-live-device.sh script (using sudo).

### In detail

Note: if you are creating a stick from a running distro, you already have the script installed, but at the moment it's a good idea to follow all of these steps so that you have the latest version of the script.
* Installing all necessary dependencies to run the make-live-device.sh script strongly depends on which distribution of GNU/Linux you are using. In Debian-based systems (such as Debian, Ubuntu, Linux Mint or Puredyne) you can just open a terminal and type: sudo aptitude install bzr grub2 parted Update: as of Ubuntu 10.10+ aptitude is no longer included with Ubuntu. Use apt-get. Other flavours of GNU/Linux, for instance like gentoo you have to use their respective package management tools to install these programs. Here's an example for gentoo: sudo emerge bzr parted grub2
* To check out the source code of bouilloncube (including make-live-device.sh) type this in a terminal: bzr branch lp:bouilloncube This will create a directory called bouilloncube in your home directory.
* Download the DVD or CD iso image from one of the distro mirrors closest to you. You can get detailed instructions to do this here, for one example for downloading the iso from the distro main mirror using rsync type this in a terminal window: rsync -P rsync.goto10.org::puredyne-pub/ This will give you a directory listing of all releases on our rsync server, as well as an empty entry as a pointer to the newest release (currently "LATEST_IS_CARROT_AND_CORIANDER") To download the lastest DVD release type: rsync -P rsync.goto10.org::puredyne-pub/carrot_and_coriander/puredyne-911-carrot_and_coriander-DVD-amd64.iso puredyne-911-carrot_and_coriander-DVD-amd64.iso TIP: if you already have a DVD or CD iso on your hard disk you can rsync over it (and thus save quite a lot of download bandwidth) by substituting the second argument to rsync with a path to your stored iso image.
* Now plug in the USB pen drive or USB-HDD to your computer and open a terminal. Wait for a couple of seconds until the device has settled and type: dmesg This will show you something like this: In the highlighted line (and in fact the line above that even clearer) you can see what the device file identifier is for the USB device you have just plugged in, and how many partitions are on it already. In this case there are two partitions on /dev/sdb already, /dev/sdb1 and /dev/sdb2 - make sure you have all data on these partitions backed up, as they will be wiped off the drive completely. All data will be lost! Tip: you can use the very great rdiff-backup tool to create, maintain and restore timestamped backups. Next, run the make-live-device.sh script. If you are not using the distro to create the stick you have to go into the bouilloncube directory checked out from bazaar earlier: cd /path/to/bouilloncube/sh/grub2 Then, or if you are already running a distro, you can run the command like this: sudo ./make-live-device.sh /path/to/puredyne-911-carrot_and_coriander-DVD-amd64.iso /dev/sdX Make sure that you substitute /dev/sdX for the device you see when running dmesg, as noted above. Failure to do so can result in damaged/overwritten data on hard disk drives, so be careful! Replace the .iso filename if you downloaded the CD or the i386 version of the distro. The script will prompt you whether the selected device is correct, so answer this accordingly. After the script is finished you can unplug the device or reboot your computer straight into it.

## Creating a USB bootable drive manually

FIXED
On Linux
Navigate to the directory where the ISO file resides. Likely the Downloads directory of your home folder.
Use lsblk to check the correct device path of the USB drive you wish to use.
/dev/sda will likely be the internal drive. If only one USB device is plugged in, then you should see someting like this:
Use 'dd' to copy the ISO image to the drive. If you are in the directory containing the iso image, then you would use:
Where <isofile> is the filename of the iso file, ending with the .iso extension, ie 'some-linux-distro-4.4-x86_64.iso' And X denotes the single most imporant part of this command. It signifies which drive to write the iso onto. Use the correct letter for your USB stick. MAKE SURE YOU GET THIS PART RIGHT. With the example above, in which the USB drive is /dev/sdb, then you would replace X with b - ignoring any numerical instances (sdb1, sdb2 etc.) If you were to accidentally type a, you would overwrite your interal HD, which would be bad and should be avaoided.
Done.
On Windows
For BIOS: Use win32diskimager - https://sourceforge.net/projects/win32diskimager/
For UEFI: Use rufu - http://rufus.akeo.ie/
Note: None of these methods will have persistent storage. Care should be taken using dd, as it will overwrite whatever device specified after "of="

## Creating a USB bootable drive using unetbootin

Get unetbootin for Linux from http://unetbootin.sourceforge.net/ and a distro iso file.
On some distro's you may need to give unetbootin permission to run as a program.
Use a partitioning tool to create two ext2 partitions on your keypen.
The first should be 1.5 GB in size to hold the distro & should be bootable.
The second can use the remaining space on the drive and should be given the label live-rw (lower case, as typed). The distro will detect this and use it to store any changes you make.
Plug in the keypen & then use either mount or dmesg at a terminal to get the name of the first partition on the keypen.
Start unetbootin. Choose the 'Diskimage' option & click the box with three dots to get the file browser & choose the distro iso. Check to make sure that the correct drive (the first on your keypen) is chosen. Click OK & wait for the message that will tell the process is completed.
The first boot will be slower than subsequent boots.

## Creating a USB bootable drive using UltraISO

Open an ISO image with UltraISO and choose choose 'Bootable' -> 'Write disk image' to burn onto a bootable USB disk.

## See also

* Multibook Specification