Difference between revisions of "HowTo Put Multiple Live Images On One USB Memory Stick"

From NST Wiki
Jump to navigationJump to search
(Prepare Your USB Memory Stick)
(Install GRUB 2 Boot Loader)
Line 49: Line 49:
 
The following command demonstrates how to mount your partition and install the GRUB 2 boot loader (again, you will need to change ''/dev/sdx'' for your USB memory stick):
 
The following command demonstrates how to mount your partition and install the GRUB 2 boot loader (again, you will need to change ''/dev/sdx'' for your USB memory stick):
  
 +
[root@cayenne ~]# [ -d /mnt/vfat ] || mkdir /mnt/vfat
 +
[root@cayenne ~]# mount LABEL=multboot /mnt/vfat
 
  [root@cayenne ~]# grub2-install --force --no-floppy --root-directory=/mnt/vfat /dev/sdx
 
  [root@cayenne ~]# grub2-install --force --no-floppy --root-directory=/mnt/vfat /dev/sdx
 +
[root@cayenne ~]# umount /mnt/vfat
 +
 +
At this point you should have a bootable USB memory stick. It would be a good idea to verify this by booting from the USB memory stick and make sure that you can at least get to GRUB 2.
  
 
= Copy Files From ISO (NST, Fedora) =
 
= Copy Files From ISO (NST, Fedora) =

Revision as of 08:47, 13 September 2012

Overview

The livecd-iso-to-disk program is used by Fedora based distributions (like NST) to transfer the contents of a Live ISO image to a USB memory stick. The livecd-iso-to-disk program works well and offers some extra features (such as persistent storage). However, it is primarily used when you want to put a single Fedora based distribution onto a USB memory stick.

It is often desirable to create a USB memory stick with multiple Live images to choose from (NST 32 bit, NST 64 bit, Ubuntu, Debian, ...). To accomplish this, you must:

  • Create a primary bootable partition on a USB memory stick.
  • Format the partition as FAT 32 (if you want easy access to the files from non Linux based systems).
  • Install the GRUB 2 boot loader onto the USB memory stick.
  • Transfer ISO images (Debian based distros) or contents from the ISO for other distributions (Fedora based distros).

WARNING: Know What You Are Doing

The partitioning and formatting steps of this process assume that you know what you are doing. If you are new to Linux, make sure you understand how to identify the device entry associated with your USB memory stick (like: /dev/sdx). If you blindly copy/paste commands from this page you will likely destroy data on your system.

We have chosen to use /dev/sdx and /dev/sdx1 in our examples below as this device probably won't be present on your system to reduce the chance of a data destruction. You will need to substitute the device entry of your USB memory stick for this value.

Prepare Your USB Memory Stick

You only need to perform these steps once. In other words, skip the USB preparation section when you want to add additional distributions to your USB memory stick.

Partition Your USB Memory Stick

You can use fdisk, gparted or one of the many other partition tools to partition your memory stick. A single primary partition marked as bootable works well.

Here's an example of what fdisk will show if you have a single primary partition marked as bootable (substitute the device entry of your USB memory stick for the /dev/sdx shown below):

[root@cayenne ~]# fdisk -l /dev/sdx

Disk /dev/sdx: 15.6 GB, 15606349824 bytes
255 heads, 63 sectors/track, 1897 cylinders, total 30481152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000230dd

   Device Boot      Start         End      Blocks   Id  System
/dev/sdx1   *          34    30481118    15240542+   c  W95 FAT32 (LBA)
[root@cayenne ~]#

Create A File System And Label

The following command demonstrates how to create a FAT 32 file system on partition /dev/sdx1 with a label of "multboot" (you will need to adjust this command based on the device entry for your partition):

[root@cayenne ~]# mkfs.vfat -F 32 -n multboot /dev/sdx1

Install GRUB 2 Boot Loader

The following command demonstrates how to mount your partition and install the GRUB 2 boot loader (again, you will need to change /dev/sdx for your USB memory stick):

[root@cayenne ~]# [ -d /mnt/vfat ] || mkdir /mnt/vfat 
[root@cayenne ~]# mount LABEL=multboot /mnt/vfat
[root@cayenne ~]# grub2-install --force --no-floppy --root-directory=/mnt/vfat /dev/sdx
[root@cayenne ~]# umount /mnt/vfat

At this point you should have a bootable USB memory stick. It would be a good idea to verify this by booting from the USB memory stick and make sure that you can at least get to GRUB 2.

Copy Files From ISO (NST, Fedora)

Copy ISO Files (Debian, Ubuntu, ...)

Create Grub 2 Configuration

Create Menu Entry Files

Create Script To Join Menu Entry Files

Run Script

Test