Bootable USB (Not the same as wiki)

A 5 star hangout for overworked and underpaid system admins.
Post Reply
ixeous
Posts: 113
Joined: 2005/07/07 13:01:59

Bootable USB (Not the same as wiki)

Post by ixeous » 2012/05/30 12:42:38

Some time back I wanted a bootable usb drive that I could use to boot several useful utilities (Live CDs) from ISO files. It took some trial and error to get it working and CentOS does not use the ISO file directly. This method does not require formatting or partitioning the USB and the device can still be used to store other files also.

A. Install Grub 2 to the USB device. You must use Grub 2. It has the ability to use iso files. I used an Ubuntu Live CD to perform the install to USB. I think 11.04 had the correct version, but it may have been 11.10. http://www.pendrivelinux.com/install-grub2-on-usb-from-ubuntu-linux/
[quote]1. Boot from your Live Ubuntu Linux CD
2. Once booted, insert your USB Flash Drive
3. Open a terminal and type sudo su
4. Type fdisk -l (and note which device is your USB)
5. Type mkdir /mnt/USB && mount /dev/sdx1 /mnt/USB (replacing x with your actual usb device)
6. Type grub-install --force --no-floppy --root-directory=/mnt/USB /dev/sdx (replacing x with your actual USB device)[/quote]

B. Find the UUID of your device. This will be needed later.
[quote]blkid /dev/sdX[/quote]
Where "X" is your USB device

C. Create a folder on the USB for iso files. All bootable systems go here. It's not actually necessary, but helps with organization if the USB will be used for other purposes also.

D. Copy the iso files into the iso folder. For CentOS and Fedora the contents of the ISO must be extracted. Create a folder for each system and copy the contents of the CD to the folder. Simply copying the files from the mounted iso is sufficient. For example, my device has in the iso folder
[quote]1. CentOS-6.0-i386-LiveCD (folder)
2. CentOS-6.0-i386-netinstall (folder)
3. CentOS-6.0-x86_64-LiveDVD (folder)
4. CentOS-6.0-x86_64-netinstall (folder)
5. Fedora-16-i686-LIve-Security (folder)
6. nst-2.15.0-2515.i686 (folder)
7. chntpw.iso
8. Helix2008r1.iso
9. kubuntu-11.04-desktop-i386.iso
10. LPS-1.2.3_public_deluxe.iso
11. pmagic-6.6.iso
12. systemrescuecd-x86-2.3.0.iso[/quote]

(I also have a couple of memory checker images in / of my USB)

E. Create grub.cfg to boot the various systems. A good example is at http://www.panticz.de/MultiBootUSB . My current grub.cfg is
[quote]
# to boot linux live cd, check isolinux.cfg for options

menuentry "Memtest86" {
linux16 /memtest.bin
}

menuentry "Memtest86+ v4.20" {
linux16 /memtest86+-4.20.bin
}

menuentry "Windows Password Recovery" {
set isofile="/iso/chntpw.iso"
loopback loop $isofile
linux (loop)/VMLINUZ. iso-scan/filename=$isofile
initrd (loop)/initrd.cgz
}

menuentry "Kubuntu 11.04 Live" {
set isofile="/iso/kubuntu-11.04-desktop-i386.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz iso-scan/filename=$isofile boot=casper noprompt noeject
initrd (loop)/casper/initrd.lz
}

menuentry "CentOS 6 Live (i386)" {
set root=(hd0,1)
linux /iso/CentOS-6.0-i386-LiveCD/isolinux/vmlinuz0 root=UUID=XXXX-XXXX ro liveimg quiet nodiskmount nolvmmount live_dir=/iso/CentOS-6.0-i386-LiveCD/LiveOS
initrd /iso/CentOS-6.0-i386-LiveCD/isolinux/initrd0.img
}

menuentry "CentOS 6 Live (x86_64)" {
set root=(hd0,1)
linux /iso/CentOS-6.0-x86_64-LiveDVD/isolinux/vmlinuz0 root=UUID=XXXX-XXXX ro liveimg quiet nodiskmount nolvmmount live_dir=/iso/CentOS-6.0-x86_64-LiveDVD/LiveOS
initrd /iso/CentOS-6.0-x86_64-LiveDVD/isolinux/initrd0.img
}

menuentry "CentOS 6 Netinstall (i386)" {
set root=(hd0,1)
linux /iso/CentOS-6.0-i386-netinstall/isolinux/vmlinuz root=UUID=XXXX-XXXX ro liveimg quiet nodiskmount nolvmmount
initrd /iso/CentOS-6.0-i386-netinstall/isolinux/initrd.img
}

menuentry "CentOS 6 Netinstall (x86_64)" {
set root=(hd0,1)
linux /iso/CentOS-6.0-x86_64-netinstall/isolinux/vmlinuz root=UUID=XXXX-XXXX ro liveimg quiet nodiskmount nolvmmount
initrd /iso/CentOS-6.0-x86_64-netinstall/isolinux/initrd.img
}

menuentry "LPS 1.2.3" {
set isofile="/iso/LPS-1.2.3_public_deluxe.iso"
loopback loop $isofile
linux (loop)/vmlinuz load_ramdisk=1 ramdisk_blocksize=4096 root=/dev/ram0 ramdisk_size=524288 console=ttyS3 splash=silent vga=791 findiso=$isofile
initrd (loop)/initrd
}

menuentry "Helix 2008R1" {
set isofile="/iso/Helix2008r1.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz iso-scan/filename=$isofile boot=casper splash
initrd (loop)/casper/initrd.gz
}

menuentry "Fedora 16 Security" {
set root=(hd0,1)
linux /iso/Fedora-16-i686-Live-Security/isolinux/vmlinuz0 root=UUID=XXXX-XXXX ro liveimg quiet nodiskmount nolvmmount live_dir=/iso/Fedora-16-i686-Live-Security/LiveOS
initrd /iso/Fedora-16-i686-Live-Security/isolinux/initrd0.img
}

menuentry "Parted Magic" {
set isofile="/iso/pmagic-6.6.iso"
loopback loop $isofile
linux (loop)/pmagic/bzImage iso_filename=$isofile boot=live load_ramdisk=1 prompt_ramdisk=0 noeject noprompt
initrd (loop)/pmagic/initramfs
}

menuentry "System Rescue Disk" {
set isofile="/iso/systemrescuecd-x86-2.3.0.iso"
loopback loop $isofile
linux (loop)/isolinux/rescue64 setkmap=us isoloop=$isofile
initrd (loop)/isolinux/initram.igz
}

menuentry "NST 2.15.0" {
set root=(hd0,1)
linux /iso/nst-2.15.0-2515.i686/isolinux/vmlinuz0 root=UUID=XXXX-XXXX ro liveimg quiet nodiskmount nolvmmount live_dir=/iso/nst-2.15.0-2515.i686/LiveOS
initrd /iso/nst-2.15.0-2515.i686/isolinux/initrd0.img
}
[/quote]

The isolinux.cfg or syslinux files can be helpful for finding the correct options to use for each specific system.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Bootable USB (Not the same as wiki)

Post by pschaff » 2012/05/30 18:46:54

[quote]
ixeous wrote:
Some time back I wanted a bootable usb drive that I could use to boot several useful utilities (Live CDs) from ISO files. It took some trial and error to get it working and CentOS does not use the ISO file directly. This method does not require formatting or partitioning the USB and the device can still be used to store other files also. [/quote]
I don't see how that can work for DVD ISO images larger than the FAT32 4GB - 1byte file size limit.

ixeous
Posts: 113
Joined: 2005/07/07 13:01:59

Re: Bootable USB (Not the same as wiki)

Post by ixeous » 2012/05/30 19:11:54

[quote]
pschaff wrote:

I don't see how that can work for DVD ISO images larger than the FAT32 4GB - 1byte file size limit.[/quote]

I'm cheating a little in that I'm using the contents of the DVD ISO and not actually using the ISO itself. Step D is to copy the contents of the DVD ISO into a folder and use the files from there. That was a requirement to get any CentOS or Fedora to work regardless of whether it was a DVD ISO or a CD ISO. All of the ISO files that I use directly are CD and not DVD so I have not run into that problem.

Also, the CentOS Live DVD is approx 1.7 GB

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Bootable USB (Not the same as wiki)

Post by pschaff » 2012/05/30 19:21:54

OK - I missed where you said "For CentOS and Fedora the contents of the ISO must be extracted."

Adding a link to this thread from the Wiki.

AlektroNik
Posts: 1
Joined: 2012/06/29 05:49:41
Contact:

Re: Bootable USB (Not the same as wiki)

Post by AlektroNik » 2012/06/29 05:58:08

[quote]
ixeous wrote:
A good example is at http://www.panticz.de/MultiBootUSB.[/quote]

Please correct the link.
There is an issue - dot just added to the link.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Bootable USB (Not the same as wiki)

Post by pschaff » 2012/06/29 13:31:41

Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

Thanks for the correction. I have edited the original post with the broken link.

geychaner
Posts: 3
Joined: 2013/11/18 20:34:21

Re: Bootable USB (Not the same as wiki)

Post by geychaner » 2013/11/18 20:41:15

I tried this, and it worked great for everything except CentOS 6.4-i386 LiveCD. When I tried to boot the LiveCD option, it gave me:
Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-358.el6.i686 #1
Call trace:
<blah>
panic occurred, switching back to test console.
The netinstall option worked OK, as did everything else. Oddly, I have just been installing on this computer via cloning, and this is also what happens when I try to boot the clone source via USB as well. Once I clone to the SATA disk, it's OK. The computer is a SuperMicro X10SAE system, if it matters. I am using the LiveCD and not DVD to save space, and have only tried the i386; is there an important difference?

geychaner
Posts: 3
Joined: 2013/11/18 20:34:21

Re: Bootable USB (Not the same as wiki)

Post by geychaner » 2013/11/19 12:15:24

OK, I took off the "quiet" on the boot command, and got MUCH more information. The error message is:
No root device "block:/dev/mapper/live-rw" found
It suggests adding "rdshell" to the kernel command line, so now I'm digging a deeper hole. :-)

geychaner
Posts: 3
Joined: 2013/11/18 20:34:21

Re: Bootable USB (Not the same as wiki)

Post by geychaner » 2013/11/19 17:32:26

The only thing that I've been able to get from "rdshell" is that the USB key is NOT showing up as /dev/sda on boot. In fact, it doesn't seem to be in /rdshell/dev anywhere that I can find. The computer is an X10SAE Haswell system; maybe hardware incompatibility?

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Bootable USB (Not the same as wiki)

Post by TrevorH » 2013/11/19 18:05:06

Or a BIOS setting as to how to emulate USB sticks
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply