126 - Boot CentOS or Fedora from an ISO file using grub4dos

Here is how to boot directly from a CentOS 7 or Fedora 20 ISO file using grub4dos.

The USB drive must be formatted as FAT32 or ext2/3/4 - NOT NTFS.

Use a November 2014 or later version of grub4dos.

The full path and filename of the ISO file must not contain spaces.

CentOS 7

It is possible to boot CentOS directly from an ISO file using grub4dos, but you must specify the CD Volume Label correctly and the full path of the ISO file.

You must pay particular attention to any spaces that are in the ISO volume label (if possible, remove any spaces to make life easier!).

NO SPACES! - DO NOT USE A PATH OR ISO FILENAME THAT HAS SPACES IN IT (using \\x20 in the iso-scan/filename= parameter does not seem to work, or anything else I have tried such as %x20!)

CD volume lablels, Paths and Filenames are case sensitive.

If you use a CD/DVD ISO editing tool such as UltraISO, it will display the volume label of the ISO.

If the ISO volume label is A B (note the space in the label) then:

# spaces must be replaced by \\x20 in a volume label

set LBL=A\\x20B

Example menu (only works for CentOS 7 not CentOS 6)

title Boot CentOS 7 from ISO\n Direct boot CentOS 7 from ISO file

#ISO is full path to ISO - no spaces

set ISO=/_ISO/CentOS-7.0-1406-x86_64-DVD.iso

#LBL=CD VOLUME LABEL OF THE ISO - spaces replaced by \\x20

set LBL=CentOS\\x207\\x20x86_64

map %ISO% (0xff) || echo -e $[0147]%ISO% IS NOT CONTIGUOUS! && map --mem %ISO% (0xff)

map --hook

root (0xff)

# CDLABEL must match ISO volume label (usually file name)

# NTFS is not supported! use FAT32 or ext2/3/4

# ISO must not have spaces

echo

echo -e $[1174]WARNING: THIS WILL NOT WORK ON NTFS DRIVES (use FAT32 or ext2/3/4).

echo

kernel /isolinux/vmlinuz root=live:CDLABEL=%LBL% iso-scan/filename=%ISO% rd.live.image vga=791

initrd /isolinux/initrd.img

boot

Fedora 20

You can use the same technique for Fedora too (you can add parameters such as quiet or splash or nosplash or vga=ask as required

title Boot Fedora 20 from ISO\n Direct boot Fedora from ISO file

#ISO is full path to ISO - no spaces

set ISO=/_ISO/Fedora-Live-Desktop-x86_64-20-1.iso

#LBL=CD VOLUME LABEL OF THE ISO (usually same as ISO filename) - spaces replaced by \\x20

set LBL=Fedora-Live-Desktop-x86_64-20-1

map %ISO% (0xff) || echo -e $[0147]%ISO% IS NOT CONTIGUOUS! && map --mem %ISO% (0xff)

map --hook

root (0xff)

# CDLABEL must match ISO volume label (usually file name)

# NTFS is not supported! use FAT32 or ext2/3/4

# ISO must not have spaces

echo

echo -e $[1174]WARNING: THIS WILL NOT WORK ON NTFS DRIVES (use FAT32 or ext2/3/4).

echo

kernel /isolinux/vmlinuz0 iso-scan/filename=%ISO% root=live:CDLABEL=%LBL% nosplash rootfstype=auto live-config.timezone=America/Los_Angeles ro rd.live.image rhgb rd.luks=0 rd.md=0 rd.dm=0

initrd /isolinux/initrd0.img

boot

Troubleshooting

Symptoms and causes:

Loading progress bar or splash screen appears but activity LED on USB drive is not flashing

The iso-scan/filename was correct, but the CDLABEL was specified incorrectly. (press ESC to see messages)

Warning: /dev/disk/by-label/Fedora-Live-Desktop-x86_64-20-1 does not exist

Warning: /dev/mapper/live-rw does not exist

The iso-scan/filename was not correctly specified and so it was not mounted as a filesystem by linux.

dracut: FATAL: For argument 'ip=frommedia'\nSorry unknown value 'frommedia'

Check E2B USB drive is not NTFS!

dracut-initqueue[323]: mount: unknown filesystem type 'ntfs'

There will be one line for every NTFS volume found (make sure the E2B drive is not formatted as NTFS)