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

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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

[edit | edit source]

Summary of steps

[edit | edit source]
  1. Download and install dependencies: bzr (bazaar), grub2 and (g)parted. (If you're running the distro, these are already installed.)
  2. Check out bouilloncube source code from launchpad.
  3. 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.
  4. Plug in the USB stick, find out which device file to use and run the script (using sudo).

In detail

[edit | edit source]

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.

  1. Installing all necessary dependencies to run the 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
  2. To check out the source code of bouilloncube (including type this in a terminal:
    bzr branch lp:bouilloncube

    This will create a directory called bouilloncube in your home directory.

  3. Download the DVD or CD iso image from 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

    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 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.
  4. 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:

    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 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 ./ /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

[edit | edit source]


On Linux

Navigate to the directory where the ISO file resides. Likely the Downloads directory of your home folder.

cd ~/Downloads

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:

$ lsblk

sda                   8:0    0 698.7G  0 disk  
├─sda1                8:1    0   2.5G  0 part  /boot
└─sda3                8:3    0 696.2G  0 part  /
sdb                   8:16   1   7.2G  0 disk  
└─sdb1                8:17   1   7.2G  0 part  

Use 'dd' to copy the ISO image to the drive. If you are in the directory containing the iso image, then you would use:

$ sudo dd bs=4M if=<iso file> of=/dev/sdX

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.


On Windows

For BIOS: Use win32diskimager -

For UEFI: Use rufu -

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

[edit | edit source]

Get unetbootin for Linux from 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

[edit | edit source]

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

See also

[edit | edit source]