Start an ISO image with GRUB

Source: Internet
Author: User
Tags gparted

Start an ISO image with GRUB

If you want to use multiple Linux distributions, you have no choice. You can either install it on your physical machine or virtual machine, or start the ISO file in live mode. The second option is less demanding on hard disk space, but it is a little troublesome because you need to write the ISO file to a USB flash drive or CD/DVD to start it. However, there is another alternative compromise: Put the ISO image on the hard disk and start it in live mode. This solution saves more space than full installation and provides complete functions, which is a good alternative for slow virtual machines. Next I will introduce how to use the popular Grub boot loader to implement this solution.

Obviously, you will need to use Grub, which is used in almost all modern Linux distributions. You also need to download the Linux ISO file to the local disk. Finally, you need to know where the boot partition is and how to describe it in Grub. For this purpose, use the following command:

  1. # Fdisk-l

Start the partition. For me, it is/dev/sda1, which is described in Grub language (hd0, 1 ).

For reference, sda2 is (hd0, 2), sdb1 is (hd1, 1), and so on. (You understand .)

What do we need to edit?

First, open/etc/default/grub and check the following lines:

  1. # GRUB_HIDDEN_TIMEOUT = 0

'#' Must be added before this line for comment.

Save and open/etc/grub. d/40_custom.

In this file, you will add the parameter to start to ISO. The structure is as follows:

  1. Menuentry "[Entry's title in the grub screen]" {
  2. Set isofile = "[path to ISO file]"
  3. Loopback loop [boot partition inGrub language] $ isofile
  4. [Some specific] arguments
  5. }

For example, if you want to start Ubuntu from the ISO file, you just want to add the following line to the 40_custom file:

  1. Menuentry "Ubuntu 14.04 (LTS) Live Desktop amd64 "{
  2. Set isofile = "/boot/ubuntu-14.04-desktop-amd64.iso"
  3. Loopback loop (hd0, 1) $ isofile
  4. Linux (loop)/casper/vmlinuz. efi boot = casper iso-scan/filename =$ {isofile} quiet splash
  5. Initrd (loop)/casper/initrd. lz
  6. }

If you want to start Gparted:

  1. Menuentry "GParted Live amd64 "{
  2. Set isofile = "/boot/gparted-live-0.18.0-2-amd64.iso"
  3. Loopback loop (hd0, 1) $ isofile
  4. Loopback loop $ isofile
  5. Linux (loop)/live/vmlinuz boot = live config union = aufs noswap noprompt ip = frommedia toram = filesystem. squashfs findiso =$ {isofile}
  6. Initrd (loop)/live/initrd. img
  7. }

Or even Fedora:

  1. Menuentry "Fedora 20 Live Desktop x86_64 "{
  2. Set isofile = "/boot/Fedora-Live-Desktop-x86_64-20-1.iso"
  3. Loopback loop (hd0, 1) $ isofile
  4. Loopback loop $ isofile
  5. Linux (loop)/isolinux/vmlinuz0 root = live: CDLABEL = Fedora-Live-Desktop-x86_64-20-1 rootfstype = auto ro rd. live. image quiet rhgb rd. luks = 0 rd. md = 0 rd. dm = 0 iso-scan/filename =$ {isofile}
  6. Initrd (loop)/isolinux/initrd0.img
  7. }

Note: The parameters can be modified according to the release version. Fortunately, you can check it in many places. I like this release, but there are many other releases you can start. At the same time, pay attention to the place where you place the ISO file. If your home directory is encrypted or cannot be accessed, you may prefer to put these files into startup partitions like in the example. However, make sure that there is sufficient space for the start partition.

Finally, do not forget to save the 40_custom file and use the following command to update grub:

  1. # Sudo update-grub

So that you can see the changes at the next startup.

What to do next?

Want more? Well, modify the parameters for fun. You can start an ISO file and keep it running. For example, if you want to have an option to quickly clear the hard disk, you can use DBAN for some settings. Now, be careful, because this setting will clear your hard disk, and there is no recovery option at startup:

  1. Menuentry "Darik's Boot and Nuke "{
  2. Set isofile = "/boot/dban. iso"
  3. Loopback loop (hd0, 1) $ isofile
  4. Linux (loop)/dban. bzi nuke = "dwipe" silent
  5. }

Another option

  1. Menuentry "Darik's Boot and Nuke "{
  2. Set isofile = "/boot/dban. iso"
  3. Loopback loop (hd0, 1) $ isofile
  4. Linux (loop)/dban. bzi
  5. }

You can select to clear the drive by displaying the DBAN option. Be careful because it is still very dangerous.

To sum up, there are many things to do for ISO files and Grub: from quick live sessions to one-click destruction, they can satisfy you. Then, you can try to launch some privacy-related releases, such as Tails.

What do you think is the idea of starting an ISO from Grub? Is that what you want to do? Why? Please leave a message below.

How to reinstall or fix Grub2 boot in Ubuntu12.04/12.10

Grub and mbr during Linux boot

Installation and Use of grub

Grub Bootstrap Configuration File Analysis

CentOS 6.4 grub and password

CentOS GRUB boot error cannot enter system solution

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.