How to boot Linux ISO image file from hard disk

  
                

Usually Linux boot Linux ISO image must be burned to CD or boot from USB drive, the following small series will introduce you how to directly boot Linux ISO file from the hard disk under Linux, let's learn together.

We implemented the process on Ubuntu 14.04 — — Ubuntu and Ubuntu-based Linux versions support this. The working principle on other Linux distributions is similar.

Getting Linux ISO Files

This trick requires you to have a Linux system installed on your hard drive. Your computer must use the GRUB2 boot loader, which is the standard boot for most Linux systems. Loader. Sorry, you can't use the Windows boot loader to launch a Linux ISO file directly.

Download the ISO file you want to use and put it in your Linux partition. GRUB2 should support most Linux systems. If you want to use them in a live environment and don't want to install them on your hard drive, make sure you download the version of the Linux ISO's "live CD". Many Linux-based bootable tools should also work.

Checking the contents of an ISO file

You may need to look inside the ISO file to know where those specific files are. For example, you can open ISO files by using graphical applications such as Archive Manager/File Manager in Ubuntu and other GNOME-based desktop environments. In the Nautilus file manager, right click on the ISO file and select Open with Archive Manager.

Locate the kernel file and the initrd image. If you are using Ubuntu ISO files, you will find these files in the casper folder ——vmlinuz files are Linux kernels, and initrd files are initrd images. Later, you need to know where they are in the ISO file. Different

Check the hard disk partition path

GRUB using Linux & ldquo; device name & rdquo; mode. On Linux systems, /dev/sda0 is the first partition on the hard disk — —a refers to the first hard disk, and 0 refers to the first partition. In GRUB, corresponding to /dev/sda0 is (hd0,1). 0 refers to the first hard disk, and 1 refers to the first partition above it. In other words, in the GRUB device name, the disk number starts counting from 0, and the partition number starts counting from 1 —— Yes, this is really confusing. For example, (hd3, 6) refers to the sixth partition on the fourth disk.

You can use the fdisk -l command to view this information. On Ubuntu, open the terminal and run the following command:

sudo fdisk -l

You will see a list of Linux device paths, which you can convert to GRUB device names yourself. For example, in the image below, we can see that there is a system partition that is /dev/sda1—— then, for GRUB, it is (hd0,1). The easiest way to

Create a GRUB2 boot entry

Add custom boot entry is /etc/grub.d/40_custom script editor, the file is designed for users to add their own start entry. After editing the file, the contents of the /etc/defaults/grub file and /etc/grub.d/script will be combined to create the /boot/grub/grub.cfg file —— you should not edit this file manually. It is designed to be automatically generated by the settings you specify in another file.

You need to open the /etc/grub.d/40_custom file with root privileges to edit it. On Ubuntu, you can do this by opening a terminal window and running the following command:

sudo gedit /etc/grub.d/40_custom

Take it easy, you can use your favorite Text editing opens the file. For example, you can replace the command in “gedit” as “nano”, open it in the Nano text editor.

Unless you have added other custom startup entries, you should see an almost empty file. You need to add one or more ISO startup sections under the comment line.

here to show you how to start ISO file from the Ubuntu or Ubuntu-based distributions, we were tested under Ubuntu 14.04:

menuentry & ldquo; Ubuntu 14.04 ISO & rdquo; {set isofile=“/home/name/Downloads/ubuntu-14.04.1-desktop-amd64.iso”loopback loop (hd0,1)$isofilelinux (loop)/casper/vmlinuz.efi boot=casper iso-scan/Filename=${isofile} quiet splashinitrd (loop)/casper/initrd.lz}

Customize the startup entry to include the entry name of the menu you want and specify the correct path to the ISO file on your computer, and The name of the hard disk and partition device that contains the ISO file. If the names or paths of the vmlinuz and initrd files are different, specify the correct path for these files.

(If your /home/directory is a partition, ignore the /home section, like this: set isofile=“/name/Downloads/${isoname}”).

IMPORTANT: Different Linux distributions require different boot entries with different boot options. The GRUB Live ISO multi-boot project provides different types of menu entries for different Linux distributions. You should adjust these sample menu entries for the ISO file you want to launch. You can also just search the name and release number of the Linux distribution you want to launch from the web page, along with the keyword “Start from ISO in GRUB” for more information.

If you want to add more options to start ISO, for the file to add additional parts. Save the file after

finished, return to the terminal window and run the following command:

sudo update-grub

When you start the computer again, you will see ISO boot entry You can choose it to start the ISO file. At startup, you may need to press the Shift key to display the GRUB menu.

If you see an error message or a black screen when trying to start an ISO file, your boot entry configuration is definitely misconfigured. Even if the ISO file path and device name are correct, the path to the vmlinuz and initrd files on the ISO file may be incorrect, or you may need different options to boot the Linux system.

The above is the introduction of the Linux ISO image from the hard disk. You can start it directly on the hard disk without having to use USB or CD. Please try it out.

Copyright © Windows knowledge All Rights Reserved