65 - Make a grub4dos bootable ISO

Unique hitsweb counter
If you already have a working bootable USB stick that uses grub4dos and a grub4dos menu, you might want to make a bootable ISO file from it. This tutorial explains how to do it.

Grub4dos (0.4.5c) can read files on a CD/DVD ISO 9660 CDFS filesystem and the RockRidge filesystem, but not the Joliet filesystem - thus CDs/DVDs or ISOs that are prepared with no RockRidge extensions will only be read by grub4dos as ISO 9660 standard (filenames will be 8.3). Note: Grub4dos 0.4.6a can read Joliet ISOs (but it is in Alpha status).
What this means is that with some ISOs (or when you boot from a CD/DVD), grub4dos may not be able to access a particular file if it has a long filename: e.g.

title test iso
map /myiso.iso (0xff)
map --hook
root (0xff)
ls /MyFileIsHere.txt && echo RockRidge has been used
ls /MyFileIs.txt && echo RockRidge has not been used

If our ISO contains the file MyFileIsHere.txt and the ISO was prepared as Joliet but not RockRidge, then long filenames will not be visible via grub4dos. In this case, the file we are listing under grub4dos (MyFileIsHere.txt) will appear as /MYFILEIS.txt if the ISO has no RockRidge filesystem extension.
Also note that grub4dos does not usually care about case on FAT, exFAT and NTFS volumes, so in this example ls /MYFILEISHERE.TXT and ls /MYFILEIS.TXT would also work (but this may depend on how you made the ISO file - so try all capital letters as well)..

Also, be aware that your grub4dos menu.lst file may need modifying because your files will be on a CD and not a 'hard disk' when the ISO boots. Therefore if you have any commands which expect two hard disks to be present, i.e. (hd0) and (hd1), or you have hard coded the payload files as (hd0,0)/xxxx, or if you have excluded CD's from any file 'find' commands used in the menu, then when you boot from an ISO you cannot expect these to work! You can use () or (bd) as a device name for the boot device or just use / in your menus.

If you have downloaded and installed the WAIK you can use the microsoft OSCDIMG.exe utility.
If you do not have OSCDIMG.exe then you will need to download MKISOFS.exe.

To test that your ISO boots correctly, I recommend you load the ISO file in QEMU (use RMPrepUSB File - Boot from ISO file using QEMU Emulator) which allows you to emulate booting direct from the ISO file under Windows just as if it were a CD/DVD but without affecting your Windows system.

Some of the oscdimg information has been taken from this forum post and I have used the switches suggested by jaclaz/Wonko-the-Sane (thanks!).

To make a grub4dos ISO file

Use RMPrepUSB - use the latest version of RMPrepUSB - and use Files - 'Make grub4dos ISO from Drive' to automatically convert the selected grub4dos bootable USB drive to an ISO file! RMPrepUSB will run a .cmd script to make a grub4dos bootable ISO file.

If your USB drive has WinPE files (i.e. bootmgr, \boot\BCD and boot.wim) then add oscdimg.exe to the RMPrepUSB installation's \QEMU folder. 'Make grub4dos ISO from Drive' will then use oscdimg to make the ISO instead of mkisofs which does not make bootable WinPE ISO properly.

Note that it does not alter the menu.lst file, so you must ensure your menu.lst is suitable to run from a CD/DVD.

If you wish to use a similar manual process using a Windows .cmd script, then follow steps 1 and 2 below...


2013-01-01 - I have changed the mkisofs download link to point to a cygwin version - the old link used a version of mkisofs.exe that had a 2GB ISO size limitation. The cygwin version of mkisofs.exe has a 4GB size limitation. If this is still a problem then use oscdimg instead!
2013-05-26 - Changed makegrub4dosiso.cmd to use start segment of 7C0 for better compatibility with some BIOSes!

Use a Windows .cmd script

1a. If you already have Microsoft Windows WAIK installed...
1. Download the Makegrub4dos.zip file from the Download - Beta Downloads page - extract the cmd file and place it in the same folder that you want your ISO file to be made in (or an empty folder)
2. In the Windows Start Menu - click on the Deployment Tools Command Prompt to open a Command Prompt window

1b. If you do not have Microsoft Windows WAIK installed...

1. Create a new empty folder on your hard disk (e.g. C:\MAKEISO)
2. Download mkisofs.exe and the dll (note: this is a cygwin (4GB) version, MinGW versions only make files up to 2GB!)
3. Download the Makegrub4dos.zip file from the Download - Beta Downloads page - extract the cmd file and place it in the same folder.
4. Run a Windows Command Prompt window (e.g. Start Menu - Accessories - Command Prompt)

2. Using the Makegrub4dosISO.cmd file

1. Type ma and hit the <TAB> key to complete the command and press <ENTER> - you should see a usage prompt:


Variable 1 = ISO FILENAME =
Variable 2 = SOURCE FOLDER =
Variable 3 = ISO VOLUME NAME = G4DOS
BOOTFILE = grldr (grldr from "source")

Usage: makegrub4dosiso.cmd [ISO FILENAME] [SOURCE FOLDER] [ISO VOLUME NAME]

2. To make an ISO, you need to make sure that the grldr file is present at the top level of your source folder. Now type the command (use ma <TAB> to save typing!):

makegrub4dosiso.cmd test.iso I:\ my_iso_label

where test.iso is the name of the iso that you want to create, I: is the USB drive that you want to convert to an ISO file and my_iso_label is the volume label of the ISO that you want to create.

If all your boot files are in a folder, you can specify a source folder instead of a drive letter - e.g.

makegrub4dosiso.cmd test.iso C:\myusbpen\formycd my_iso_label

Do NOT use any filenames/foldernames with spaces in them.

The script will use either OSCDIMG or MKISOFS (depending on which one you have on your system) to create a new grub4dos bootable ISO file.

Note: 'bertrand' from reboot.pro uses this command line to prepare an ISO file, it differs in that it has a -l parameter and no -J or -r parameters (not tested):
mkisofs -v -iso-level 4 -N -D -d -joliet-long -volid "Grldr" -A GRLDR/MKISOFS -sysid "Win32" -b grldr -no-emul-boot -boot-load-seg 0x7C0 -boot-load-size 4 -o "grldr.iso" "folder"

Use this command for a WinPE bootable ISO
set VNAME=myvol
set BOOTFILE=grldr
set ISONAME=fred.iso
set SRCFOLDER=C:\temp
mkisofs -iso-level 3 -force-uppercase -volid "%VNAME%" -b %BOOTFILE% -no-emul-boot -hide boot.catalog -o %ISONAME% %SRCFOLDER%

You may find grub4dos 0.4.6 does now work with level 4, so use level 3

3. Testing your ISO file

I would recommend that you test your new ISO file before burning a CD to save making coasters! Here are some alternatives which you can try:

1. The latest versions of RMPrepUSB (v2.1.652 and later) can boot from an ISO via the emulator QEMU under Windows - just type Ctrl-F11 or use the File menu tab to test that your new ISO works.


use Qemu Manager - install this on your Windows system and create a new new virtual machine (New virtual machine - choose an OS and create a virtual hard disk so that at least one hard disk is present when the ISO file boots). Then in the Drives tab, click the CD-ROM icon and set the image name to your new ISO file. Then click the green arrow button to test your new ISO file.

2. Use RMPrepUSB to copy the new ISO file to a USB drive. Make a menu list that will load your ISO as a CD and test it using the RMPrepUSB - QEMU button. Note that this will test that you can at least get to the ISO's grub4dos menu, but it may not run the menu entries correctly. If the ISO file is large (>4GB) you may need to use NTFS when you prepare the bootable USB drive.

title testiso
map /test.iso (0xff)
map --hook
chainloader (0xff)

or easy still, just copy your new ISO file to an Easy2Boot USB drive and boot it.

3. Install and run Oracle VM Virtual Box or some other virtual machine and load the ISO onto a virtual CD drive used by the emulator. Be aware that I have seen problems where QEMU boots from a grub4dos ISO successfully but Virtual Box does not.

4. If you have a Zalman VE200 HDD caddy, copy your new ISO file to the _ISO folder and select it as the CD boot file - then test it on a real system.
Note: I have seen grub4dos bootable ISOs which don't boot from the ZalMan VE200 but that do boot when burnt to a Real CD and booted on a real system.

5. The acid test - burn the ISO to a CD or DVD and boot from it using a real computer!

4. Troubleshooting

If you are using MKISOFS, try the OSCDIMG utility instead (and vice versa). Mkisofs may have a 4GB size limitation.

The usual problems are due to the type of filesystem used for the ISO. When an OS boots, it may expect the files to have lowercase filenames or uppercase filenames. e.g. bootmgr or BOOTMGR. If it looks like some files are not being detected by the booting OS, this may be the reason. Try Googling for someone with similar problems to see if you can modify the makegrub4dos.cmd file by changing some of the switches on the command line.

If you are having trouble getting your grub4dos menu to work when a menu option is selected (grub4dos reports an error due to a 'bad' command), this is probably due to the fact that it is now booting as a CD rather than a 'hard disk' device. Here are some points to watch:

1. When booting from CD there may only be one hard disk (the system's internal hard disk) in the system. So any reference to (hd1) in a menu will cause an error.
2. Try to avoid booting from a mapped image using chainloader (xxxx)+1 (where xxxx is whatever you have mapped it to) - instead specify the actual boot file such as chainloader ()/io.sys or chainloader ()/bootmgr or chainloader ()/ntldr
3. Check filenames are not case sensitive - e.g. if chainloader /bootmgr does not seem to work try chainloader /bootmgr || chainloader /BOOTMGR so that it will work whether it is lower case or uppercase.
4. If you have excluded CDROM drives from a find command then it obviously won't find the file on the CD! For example, don't use find --set-root --devices=h /bootmgr .
5. Use find --set-root xxxx to set the root device, this way it will work on a USB drive or on a CD.
6. There could be more than one CD device present in a system, the boot CD may not always be (cd0).

Tip: use (bd) to reference the boot device disk and that will work for both USB drives and CD/DVDs.

Here is an example of a menu that loads a DOS hard disk image file and boots it as a hard disk. Note how io.sys is specifically loaded instead of just ()+1 being used.

title HDDREG.img\nMS-DOS hard disk image file
map --mem /hddreg.img (hd0) || map /hddreg.img (hd0)
map --hook
#look for a file inside the image and set device as the root device
find --set-root /hddreg.cab
#load and boot using DOS bootloader
chainloader ()/io.sys

Make a large DOS-bootable CD without needing CD drivers!

Booting from a CD or DVD to DOS is a problem these days as most PCs have modern SATA drives and the old DOS CD-ROM drivers are often not compatible.

Do you want to make a CD which boots to DOS (MS-DOS or FreeDOS) as A: but has access to all files on the CD without needing any CD drivers?

Using the method below, you can make a bootable CD which will boot to a grub4dos menu (which can be made invisible to the user). You can then run MS-DOS or FreeDOS and boot to DOS. Once at the DOS command prompt (A:) you will have the entire contents of the CD on the virtual A: drive. Drive A: can be 500MB or more! You do not need to load CD drivers in order to access all the CD contents as the contents will be on the A: drive.

The only problem with this method is that you cannot have more than 1000's of files in any one folder (and cannot have lots of large deep sub-folders). It does not work with an XP CD (/I386 folder), for instance, as this has 1000's of files in one folder - however it should work with most ordinary DOS folder structures.

How it works

When you boot from a CD it can be booted as a floppy or a hard disk or as neither. The Makegrub4dos.cmd script uses a switch with mkisofs of --no-emul-boot so that the BIOS does not emulate either a floppy disk or a hard disk when booting the CD. If we used floppy-disk emulation then we could only access 2.8MB within a floppy disk image. We could use a hard disk image but that might confuse DOS when it boots, as the CD will appear as hd0 (but write-protected). Instead of using a hard disk or floppy disk image, we specify the grub4dos bootloader file grldr and specify 'no emulation' when we create the ISO. The 'El Torito' BIOS specification has more details.

When we boot from a cd with no emulation, the operating system that is loaded must use it's own drivers to access the CD/DVD. However, grub4dos can access the CD as it understands the CD filesystem which has a CDFS (non-FAT, non-NTFS) filesystem with 800h long sectors. Once grub4dos has been loaded, we call copycd.bat. This is a grub4dos batch file which makes a large (500MB+) ram drive and then copies the contents of the cd to the virtual ram drive (fd0), folder by folder. We can then boot to DOS from the files that are now on the virtual fd0 drive. The internal Hard Disk 0 will still be hd0 in DOS so we can fdisk it or format it and copy files to it.


  1. Install RMPrepUSB
  2. Download Makegrub4dos.zip file and extract the makegrub4dos.cmd file to a new folder on your hard disk
  3. Download mkisofs.exe and copy it to the same folder
  4. Download the grubutils zip file and extract the fat utility
Use latest RMPrepUSB to install the latest grub4dos version. Old versions of grub4dos (2011 and before) will not work!


  1. Prepare a USB drive with the contents that you want your CD to have - in this case it will be some DOS systems files plus any other files that you require.

  2. Install grub4dos to the USB drive using the 'Install grub4dos' button on RMPrepUSB

  3. Copy the grubutils file 'fat' to the root of the USB drive.

  4. Cut and paste the text below to make a new file called copycd.bat on the root of the USB drive.

  5. Edit the menu.lst file on the USB drive (press F4 in RMPrepUSB to load it into Notepad) - copy the menu items below into it and save the file to the USB drive. If you are using MS-DOS you can delete the FreeDOS menu's - if you are using FreeDOS you can delete the MS-DOS menus.
# Display CD contents
ls (cd)/

title MS-DOS BOOT WITH CD contents on FD0
# call the copy batch file - first parameter is either (fd0) or (fd1) - next parameter is size of virtual drive (0x100000=512MiB)
call (bd)/copycd.bat (fd0) 0x100000
# set number of floppies seen by BIOS - must be 2 if using (fd1) instead of (fd0)
map --floppies=1
root (fd0)
chainloader /io.sys

title FREE-DOS BOOT WITH CD contents on FD0