How to Boot Linux ISO Image Directly from Hard Drive
Last Updated :
11 Nov, 2022
To Boot Linux ISO Image Directly from Hard Drive, you must have a Linux operating system installed on your hard drive and your computer must be using a GRUB2 bootloader. The GRUB2 bootloader is a standard bootloader on most Linux systems.
Note: The downloaded ISO file of Linux must be a live CD release of each Linux ISO image.
How to Get ISO files from Linux:
1) First of all, search for the ISO file on Google which you want to download. To download these Linux distributions you may visit:
2) Let us take the example of downloading Ubuntu.
- Visit the official website and navigate to the download tab.
- Select the Ubuntu desktop for downloading.
- Select the LTS(Long Term Support) version of Ubuntu for downloading.

- Your download will start in a few seconds.
Determine the Hard Drive Partition’s Path:
The “device name” scheme used by GRUB is a different scheme than Linux. In your Linux system, /dev/sda1 is the first partition on the first hard disk, where a means the first hard disk and 1 means its first partition. In GRUB, (hd0,1) is equivalent to /dev/sda0 where 0 means the first hard disk and 1 means the first partition on it. That means that in a GRUB device name, the disk numbers start counting at 0 and the partition numbers start counting at 1. For example, (hd2,5) refers to the fifth partition on the third hard disk.
To view the information, we use the fdisk -l command on Ubuntu’s terminal and use the following command:
sudo fdisk -l
A list of Linux device paths is shown, which you can convert to GRUB device names on your own.

Adding Boot Menu To GRUB:
The best way by which you can add a custom boot entry is by editing the /etc/grub.d/40_custom script, which is a file designed for user-added custom boot entries. After you are done editing the file, every content of your /etc/defaults/grub file and the /etc/grub.d/ scripts will get combined and create a /boot/grub/grub.cfg file.
Note: You shouldn’t edit this file by hand. It’s designed to be automatically generated from the settings you specify in other files.
You’ll need to open the /etc/grub.d/40_custom file for editing with root privileges. On Ubuntu, you can do this by opening a Terminal window and running the following command:
sudo gedit /etc/grub.d/40_custom
You can open this file in your favorite editor by just replacing gedit with your editor name.

So to boot an Ubuntu or Ubuntu-based distribution from an ISO file. We tested this with Ubuntu 20.04:
menuentry “Ubuntu 20.04 ISO” {
set isofile=”/home/nikhil/ubuntu-20.04.1-desktop-amd64.iso”
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash
initrd (loop)/casper/initrd.lz
}
Note:
- You can customize the boot entry to contain your desired menu entry name, the correct path to the ISO file on your pc, and the device name of the hard disk and partition containing the ISO file. If the vmlinuz and initrd files have different names or paths, be sure to specify the correct path to those files, too.
- Different Linux distributions require different boot entries with different boot options. The GRUB Live ISO Multiboot project offers a variety of menu entries for different Linux distributions. You should be able to adapt these example menu entries for the ISO file you want to boot or you can also just perform a web search for the name and release number of the Linux distribution you want to boot along with “boot from ISO in GRUB” to find more information.

If you want to add more ISO boot options, add additional sections to the file, otherwise just save the file and return to the terminal window.
Update GRUB:
To update GRUB run the following command:
sudo update-grub

The next time you boot your computer, you’ll see the ISO boot entry and you can choose to boot the ISO file. You may have to hold Shift while booting to see the GRUB menu.
Note: If you see an error message or a black screen when you attempt to boot the ISO file, you misconfigured the boot entry somewhere. Even if you got the ISO file path and device name right, the paths to the vmlinuz and initrd files on the ISO file may not be correct or the Linux system you’re booting may require different options.
Similar Reads
How to Convert Hash to JSON in Ruby?
Ruby Hash is an unordered set of data in key-value pairs. These are mutable and can store multiple data types. JSON stands for Javascript Object Notation and is a human-readable file format that is commonly used in web services and API calls. In this article, we will discuss how to convert a hash to
2 min read
How to Comment in JSON Files?
JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. However, JSON does not have a built-in syntax for comments. This limitation can be challenging when you want to annotate your JSON data wi
2 min read
Python - Convert list of dictionaries to JSON
In this article, we will discuss how to convert a list of dictionaries to JSON in Python. Python Convert List of Dictionaries to JsonBelow are the ways by which we can convert a list of dictionaries to JSON in Python: Using json.dumps()Using json.dump()Using json.JSONEncoderUsing default ParameterDi
5 min read
How to Convert Blob Data to JSON in JavaScript ?
When dealing with Blob data in JavaScript, such as binary data or files, we may need to convert it into JSON format for doing so JavaScript provides us with various methods as listed below. Table of Content Using FileReader APIUsing TextDecoder APIUsing FileReader APIIn this approach, we first use t
2 min read
How to print a circular structure in a JSON like format using JavaScript ?
The circular structure is when you try to reference an object which directly or indirectly references itself. Example: A -> B -> A OR A -> A Circular structures are pretty common while developing an application. For Example, suppose you are developing a social media application where each u
4 min read
How to Convert Typescript Dictionary to String ?
In TypeScript, dictionaries are often represented as the objects where keys are associated with the specific values. Converting a TypeScript dictionary to a string is an important task when doing API calls where we cast the JSON response from the API to a string. Below are the ways to convert a Type
5 min read
How to JSON Decode in PHP?
JSON Decode is the process of converting a JSON string into a PHP variable, typically an object or an associative array. Then we will print that decode JSON text. Below are the approaches to JSON decoding in PHP: Table of Content Using json_decode() methodUsing Explode and Foreach LoopUsing json_dec
2 min read
How to Handle Newlines in JSON?
Handling newlines in JSON is essential for maintaining data integrity when dealing with multiline text. JSON, being a text-based format, requires special consideration for newlines to ensure that text appears as intended across different platforms. Proper handling of newlines ensures consistent and
2 min read
How to Encode Array in JSON PHP ?
Encoding arrays into JSON format is a common task in PHP, especially when building APIs or handling AJAX requests. Below are the approaches to encode arrays into JSON using PHP: Table of Content Using json_encode()Encoding Associative ArraysCustom JSON SerializationUsing json_encode()PHP provides a
2 min read
How to get Matching Data from a Prompt on an Existing Object ?
In JavaScript, getting matching data from an object can be done using various approaches like using traditional looping or by using the Object properties. JavaScript provided various approaches for matching data from a prompt on an existing object which are as follows: Table of Content Using for...i
3 min read
How to Remove Backslash from JSON String in JavaScript?
Removing backslash from JSON String is important because it ensures proper JSON formatting for data interchange and prevents syntax errors during parsing, leading to accurate data representation and processing in JavaScript applications. we will going to learn three different approaches to removing
2 min read
How to Convert JSON to Blob in JavaScript ?
This article explores how to convert a JavaScript Object Notation (JSON) object into a Blob object in JavaScript. Blobs represent raw data, similar to files, and can be useful for various tasks like downloading or processing JSON data. What is JSON and Blob?JSON (JavaScript Object Notation): A light
2 min read
How to Convert a JSON File to Microsoft Excel?
JSON file is used to store human-provided text & then it will eventually convert it to a computer-readable file. The JSON file can't be readable and that's why it is often converted to an Excel file that is readable. That's why procedural steps must be followed to easily convert the JSON file to
3 min read
How To Escape Strings in JSON?
JSON (JavaScript Object Notation) is a popular data format that is widely used in APIs, configuration files, and data storage. While JSON is straightforward, handling special characters within strings requires some extra care. Certain characters must be escaped to be valid within a JSON string. Tabl
3 min read
How to Create JSON String in JavaScript?
JSON strings are widely used for data interchange between a server and a client, or between different parts of a software system. So converting objects to JSON strings is very important for good client-server communication. Below are the following approaches to creating a JSON string: Table of Conte
2 min read
How to Catch JSON Parse Error in JavaScript ?
JSON (JavaScript Object Notation) is a popular data interchange format used extensively in web development for transmitting data between a server and a client. When working with JSON data in JavaScript, it's common to parse JSON strings into JavaScript objects using the JSON.parse() method. However,
1 min read
How to create and download CSV file in JavaScript ?
CSV (Comma-Separated Values) files are widely used for data transfer, analytics, and storage purposes. They allow you to easily fetch data from JavaScript or JSON objects and save it in a readable format for users, machine learning, or analytics tasks. In this article, we’ll explore how to convert d
5 min read
How to Receive JSON Data at the Client Side ?
For sending and receiving data to or from the server JSON format is used. JSON stands for Javascript Object Notation and it is a widely used format nowadays because of its advantages and simplicity. In this article, we will use XML HttpRequest to receive data from the server and use NodeJS for the b
2 min read
How to communicate JSON data between Java and Node.js ?
So here we will use JSON to communicate between two programs called Java and Node.js. We can use a common text format to communicate, but text format will contain a lot of complexities. However, JSON is lightweight and easy to use. JSON is language-independent and hence can be used by any programmin
2 min read