I've used Unetbootin in Fedora Linux to make a Bootable Live Linux on USB. Today, I discovered that there is much more under the Hood of Unetbootin, if your interested...
UNetbootin allows you to create bootable Live USB drives for Ubuntu, Fedora, and other Linux distributions without burning a CD. It runs on Windows, Linux, and Mac OS X. You can either let UNetbootin download one of the many distributions supported out-of-the-box for you, or supply your own Linux .iso file if you've already downloaded one or your preferred distribution isn't on the list.
- Microsoft Windows 2000/XP/Vista/7, or Linux, or Mac OS X 10.5+. Note that resulting USB drives are bootable only on PCs (not on Macs).
- Internet access for downloading a distro to install, or a pre-downloaded ISO file
UNetbootin can create a bootable Live USB drive, or it can make a "frugal install" on your local hard disk if you don't have a USB drive. It loads distributions either by downloading a ISO (CD image) files for you, or by using an ISO file you've already downloaded.
How UNetbootin Works ¶
UNetbootin's functioning is split up into 3 stages: downloading, extracting files, and installing the bootloader.
UNetbootin supports http and ftp as download sources. Usually, a redirector URL is used, or a regexp is used on directory listings on mirror sites, to ensure that the latest distribution version is downloaded. Resuming of downloads has not yet been implemented.
Extracting Files ¶
What occurs during this stage differs depending on the disk image type (ISO file or floppy disk image).
ISO files ¶
7-zip is used to extract files from the ISO file to the target drive. Heuristics based on file size and name are then used to locate kernel and initrd files; these are placed in /ubnkern and /ubninit. Boot configuration files (named syslinux.cfg, isolinux.cfg, extlinux.conf, or menu.lst) are then read to determine any boot options that need to be used and locations of other kernel and initrd files.
Floppy image files ¶
The specified IMG file is copied to /ubninit, and memdisk is copied to /ubnkern. Upon bootup, memdisk will load the IMG file into memory, and boot from it.
Installing the Bootloader ¶
What occurs during this stage differs depending on whether USB drive install mode or Hard Disk (frugal) install mode is used.
USB Drive install mode ¶
For the Live USB creation mode, UNetbootin generates an appropriate syslinux config file in /syslinux.cfg, and makes your USB drive bootable using syslinux. On Linux, if extlinux is installed and the target USB drive is ext2 or ext3, extlinux is used instead; the config file is installed in /extlinux.conf. The partition to which it has been installed is also marked as active.
Hard Disk (frugal) install mode ¶
On Windows, UNetbootin modifies boot.ini (on 2000/XP), or uses bcdedit (on Vista/7) to add a boot menu option titled UNetbootin. This loads the GRUB4DOS bootloader, which is installed at /ubnldr and /ubnldr.mbr, and this in turn reads boot menu entries from /unetbtin/menu.lst. The installation .exe file is copied to /unetbtin.exe, and this is added to autorun upon the next bootup. When run, this will uninstall UNetbootin by deleting the extracted files (which is recorded using /ubnfilel.txt and /ubnpathl.txt) and removing the UNetbootin boot menu entry.
On Linux, menu.lst (if using GRUB) or grub.cfg (if using GRUB2) is modified to add the UNetbootin entry. The existing config file is backed up to menu.lst.bak or grub.cfg.bak. When UNetbootin is run again, the uninstaller is run; this will delete the extracted files (which is recorded using /ubnfilel.txt and /ubnpathl.txt) and restore the backed-up boot configuration files.
USB Drive Install Mode ¶
This install mode uses the supplied iso file to create a bootable Live USB drive, which should behave as though you had burned the iso to a CD. It can also be used on other FAT32-formatted media, such as Secure Digital (SD) cards. While the target drive in this install mode isn't reformatted, the syslinux bootloader is installed to the drive's MBR, hence you should not use it to install to any partition on a hard drive you expect to boot from (in other words, don't force USB Drive install mode to install to C: or Windows won't boot anymore).
Should you wish to make a full, standard install to your hard disk (an install with its own dedicated bootloader and partition), just boot the created Live USB and follow the same procedure that is used if you're installing from a CD.
However, should you wish to make a full, standard (not Live USB) install onto your USB drive rather than onto your hard disk, there's an additional restriction that the drive you wish to launch the installer from should not be the same as the drive you wish to install to, so either use 2 USB drives, or use a single USB drive and follow the procedure described in "Making a full, standard hard disk install from a frugal install" to repartition it. Again, this complex procedure isn't necessary if you're installing from a Live USB to a hard disk, or from a Live USB to another USB drive, only from a Live USB to the same USB drive.
Hard Disk Install Mode ¶
If you provide a LiveCD iso file, such as the Ubuntu desktop iso, to UNetbootin and use the hard disk install mode, the resulting install will NOT be a full, standard hard drive installation. Rather, you are simply booting into the live environment, the same way as if you had booted from a live CD or a live USB, except it's being loaded from your hard disk instead. This is often referred to as a "frugal install", as it doesn't install a dedicated bootloader and doesn't make a separate partition, but rather piggybacks off the existing OS's bootloader and installs the files for the live environment inside the existing partition. For details about the boot process, see How UNetbootin Works.
Making a full, standard hard disk install if you can't use a Live USB ¶
If you want to make a full, standard install and can't use a Live USB drive as your installer, you can still use a frugal install as the installer (with some extra work needed for partitioning). The particular details of this task depends on the boot mechanism used by your distribution (as you are unable to repartition your drive while it's mounted). Again, this issue only arises if you're installing to hard disk from a frugal install, and not if you're installing to hard disk from a Live USB.
First, let's distinguish between two separate types of distributions:
Distributions loaded entirely into RAM: These distributions load everything into RAM and run directly from there. Since they don't need to access your hard drive partition, it remains unmounted, and hence you are free to repartition your hard drive (using the installer or GParted) while they are running. These tend to be the smaller distributions, such as Parted Magic, Slitaz, Puppy Linux, and DSL. A few distributions, like PCLinuxOS, also have a copy2ram boot option that will make them behave like this. Additionally, Ubuntu and Debian's netboot installers (listed as the NetInstall? option in the UNetbootin versions menu for those distributions) also run entirely from RAM (but the standard desktop, server, and alternate installers do not).
Distributions that need access to the source medium while running: These distributions will need access to the source medium (in this case, your hard drive) while they're running. As such, your hard drive partition will remain mounted while the distribution is running, and you won't be able to repartition it. The Live CD and installer iso files for basically all major distributions, including Ubuntu, Fedora, Linux Mint, and Sabayon belong to this category.
If you're simply trying to install a mini-distribution that's loaded entirely into RAM, or will be using the netboot installer for Ubuntu or Debian (listed as the NetInstall? option in the UNetbootin versions menu for those distributions) rather than the standard desktop iso, then you don't need to read further, as you shouldn't run into any partitioning issues; just use the Hard Disk install mode to make a frugal install, boot and run the installer, and install to hard drive as usual.
To install a distribution that needs access to the source medium while running, then you will need to do the repartitioning before you launch the actual installer.
Repartitioning using Parted Magic
First, start UNetbootin, and use the Hard Disk install mode to install Parted Magic. Reboot, and select the UNetbootin boot option to boot into Parted Magic. Launch the partitioner from Parted Magic, and shrink your Windows partition (remember to resize, rather than delete, your Windows partition, even if you don't want to dual-boot, as you will need something for UNetbootin to run from; you can delete it later). Now you will have some free space left for Linux; leave it as-is, as most user-friendly installers (such as Ubuntu and Fedora's) will automatically create partitions in the free space appropriately.
Making a frugal install of your installer
Next, boot back into Windows, and run UNetbootin again; it will prompt you to uninstall the Parted Magic install, and say yes. Next, start UNetbootin again, and again using the Hard Disk install mode, supply the iso file you wish to install (such as the Ubuntu desktop iso). Now reboot again, and select the UNetbootin boot option to boot into your frugal install's live environment.
Performing the actual install from the live environment
Now that you're booted into the live environment, launch the installer (on Ubuntu and Fedora, it's an icon on the desktop). Go through the steps as usual, but when you get to the partitioning stage, make sure that it's using the free space that you previously set aside for Linux, rather than attempting to resize any partitions.
Now that you have a full, standard install, you can get rid of the frugal install you used to launch the installer from; just boot Windows and uninstall UNetbootin.