Skip to main content

Boot From ISO Files Using Grub2 Boot Loader

Boot From ISO Files

In this tutorial, I will show you a very neat trick that can help you boot ISO files directly from your hard drive. Normally you need to create a live DVD or live USB in order to boot Linux ISO images. That’s Okay for most circumstances. But what if you don’t have an optical disk or USB drive around, or your computer does not support burning ISO images to optical disk?

Grub2 boot loader comes to the rescue! You have downloaded a Linux ISO image on your hard drive and Grub2 can boot this ISO image on your hard drive. Many Linux distributions can be booted directly from an ISO file. This is another reason why I love Grub so much. So let’s get started.

Boot From ISO Files Using Grub2

First edit /etc/grub.d/40_custom file with nano text editor or your favorite text editor.

sudo nano /etc/grub.d/40_custom

The first line of this file is #! /bin/bash indicating it’s a shell script. Now paste the following text at the end of this file.

menuentry "ubuntu-mate-15.10-desktop-amd64.iso" {
 set isofile="/home/xiao/Downloads/ubuntu-mate-15.10-desktop-amd64.iso"
 loopback loop (hd0,3)/$isofile
 linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile quiet noeject nopromt spalsh --
 initrd (loop)/casper/initrd.lz


  • menuentry: This entry will be displayed on the Grub2 boot menu. You can name it whatever you like.
  • set isofile: It’s used to specify the path of your Linux ISO image. Here I’m using Ubuntu Mate edition ISO image which is saved under the Downloads directory.
  • hd0, 3: hd0 means the first hard drive and 3 means the ISO image is on /dev/sda3 disk partition.
  • capser/vmlinuz.efi is the linux kernel on the Ubuntu ISO image.
  • casper/initrd.lz is the initrd image on the Ubuntu ISO image.

After you make your change. Save the file and update Grub boot menu.

sudo update-grub

You might not see the new menu entry here. But you will see it when you reboot your computer. Now reboot your machine.

sudo reboot

You will see your custom entry at the bottom of Grub boot menu.

If grub couldn’t boot your ISO image, please check /etc/grub.d/40_custom file to see if there is a typo or your left out a space or something like that.

You can add many menu entries as you like. Here’s a screenshot of my /etc/grub.d/40_custom file. The first menu entry is for Ubuntu Mate edition and the second menu entry is for Archlinux.

Boot From ISO Files

Please note that Linux kernel and initrd image file can be different for different Linux ISO images. For Ubuntu, the Linux kernel is located at /casper/vmlinuz.efi and the initrd image file is located at /casper/initrd.lz. If you don’t know where they are located, just open your ISO image with archive manager.

inspect the content of ISO file with archive manager

Booting from ISO files eliminates the need for burning a CD/DVD and creating a Live USB. Grub legacy does not have this feature.

Rate this tutorial
[Total: 0 Average: 0]