Boot de ISO
Boot de ISO
br/2015/09/usar-um-sistema-linux-live-
diretamente-do-disco-a-partir-de-uma-imagem-iso.html
O gerenciador de boot do Linux, o GRUB 2, pode inicializar arquivos de imagem ISO diretamente
do disco rígido do seu computador. Esse recurso, permite você inicializar (“dar boot“) um sistema
LiveCD sem a necessidade de um pendrive ou CD/DVD para queimar a imagem ISO. Além disso, é
possível instalar um sistema Linux, em uma outra partição do disco rígido já particionada, sem
queimar em um disco ou iniciar a partir de um pendrive.
Embora seja fácil de queimar arquivos ISO em um disco USB ou CD/DVD; em certos casos, pode-
se querer executar a mesma imagem ISO muitas vezes ou executar diferentes sistemas
Live regularmente. Com o GRUB 2 é possível configurar de modo que você não precise queimar as
imagens ISOs constantemente ou usar uma unidade USB. Basta executar usar um sistema Linux
Live diretamente do disco a partir de uma imagem ISO.
Ambiente de Teste
Realizamos este processo no Ubuntu 14.04 – Ubuntu e distribuições Linux baseada no Ubuntu tem
um bom suporte para isso. Outras distribuições Linux deve funcionar de forma semelhante.
Mão na massa
1 – Obtendo a imagem ISO
Para obter uma imagem ISO, você deverá visitar o site da distribuição desejada e fazer download de
qualquer imagem que seja compatível com a sua configuração. Se a imagem pode ser iniciada a
partir de um pendrive, ela deve ser capaz de iniciar a partir do menu GRUB também.
No no nosso caso, escolhi a imagem ISO do Fedora.
Normalmente, esses arquivos encontram-se na pasta casper. Contudo, no caso do Fedora (baixado
no exemplo) o caminho é diferente: pasta isolinux. Na próxima etapa, as duas últimas linhas que
serão adicionadas, no arquivo do GRUB, indicarão esse caminho.
4 – Configurando o GRUB 2
A maneira mais fácil para adicionar uma entrada de inicialização personalizada é editar o arquivo
/etc/grub.d/40_custom. Este arquivo é projetado para entradas de inicialização personalizados
adicionados pelo usuário.
Após editar esse arquivo, o conteúdo do arquivo /etc/defaults e dos arquivos /grub, /etc/grub.d/
serão alterados para criar o arquivo /boot/grub/grub.cfg – você não deve editar esse arquivo
manualmente.
Ele foi projetado para ser gerado automaticamente a partir de configurações que você especificar
nesses outros arquivos.
Agora, você vai precisar para abrir o arquivo /etc/grub.d/40_custom para edição com privilégios
de root. No Ubuntu, você pode fazer isso abrindo uma janela de terminal e executando o seguinte
comando:
$ sudo gedit /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
Para iniciar o Fedora Live a partir da imagem ISO pelo GRUB, adicione o seguinte trecho ao final
do conteúdo mostrado à cima:
menuentry "FEDORA LIVE ISO" {
set isofile="/home/ricardo/Fedora-Live-Workstation-x86_64-22-3.iso"
loopback loop (hd0,1)$isofile
linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=${isofile} quiet
splash
initrd (loop)/isolinux/initrd0.img
}
Salve o arquivo quando concluir. Por fim, retorne para a janela do Terminal e execute o seguinte
comando:
$ sudo update-grub
A próxima vez que você iniciar seu computador, você verá a entrada de inicialização do arquivo
ISO. Assim, você poderá escolhê-lo para inicializar diretamente pela imagem ISO. Quando iniciar o
PC, segure a tecla Shift durante a inicialização para aparacer a tela de GRUB.
Onde Encontrei
How to Run ISO Files Directly From the HDD with GRUB2
How to Boot Linux ISO Images Directly From Your Hard Drive
Exemplos de várias entradas no GRUB – diversas distros
EXEMPLOS PRONTOS
NÃO ESTÃO FUNCIONANDO
#LOCAL – inicio#
# o arquivo ISO não pode estar em /media jah que esse caminho exige login
#LOCAL – fim#
em junho 2024: https://pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/
More Grub2 Bootable ISO files will be added to the grub.cfg file as I find time to test them. Contact
me to submit your working Bootable Linux ISO grub.cfg entries for inclusion.
UPDATE: There is now an updated method to boot Multiple ISO from USB from an exFAT
formatted flash drive. <- This method includes a grub.cfg that makes it possible to simply drag and
drop ISO files onto the USB drive and then boot from them.
If you have access to a Windows machine, the YUMI – exFAT Multiboot USB Maker Software
Tool completely automates this process.
Eventually you might find the need to pick up a larger external storage device in order to include
every bootable ISO entry. Here are some of the Fastest USB flash drives that I personally use and
recommend.
How to Boot Multiple ISO from USB using GRUB2
I. Format a USB Flash Drive to use a Single Partition
The following assumes you are already up and running from a Linux desktop with your flash drive
plugged in. Ubuntu was used for this tutorial. Most Debian based systems will also work.
sudo su
fdisk -l
fdisk /dev/sdx
1. First, you might have to unmount the mounted partition (it may or may not be mounted). To
unmount, type the following and press Enter.
umount /dev/sdx1
Important Note:
Old versions of grub used --root-directory=/mnt/USB
while current versions use --boot-directory=/mnt/USB/boot
If you use the wrong syntax, you will receive an error stating "Installation is impossible. Aborting"
Again, for the following steps replace x with your actual usb device.
1. First, you need to remount your usb device partition to make it accessible to Grub for install.
2. Next, use ONE of the steps below to install Grub2 on the USB device.
a.) If Grub2 64 bit UEFI x86_64-efi is used on the Linux host, then type
b.) If Grub2 32 bit UEFI i386-efi is used on the Linux host, then type
c.) If Grub2 BIOS i386-pc is used on the Linux host, then type
cd /mnt/USB/boot/grub
wget pendrivelinux.com/downloads/multibootlinux/grub.cfg
This example configuration uses grub2 loopback mounting for the ISO files.↑
IV. Adding Bootable ISO files to USB
This step assumes your USB is still mounted... else repeat section III. (part 1)
cd /mnt/USB
2. Next, from the tabs below, simply follow the instructions for each ISO Distro you would like to
add to make bootable from USB.
For USB Ubuntu, type the following in the terminal, and press Enter.
Alternately you can rename an existing ISO to ubuntu.iso and copy it to the USB device.
For USB Debian Live, type the following in the terminal, and press Enter.
wget "https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-10.6.0-
amd64-gnome.iso" -O debian.iso
For USB Linux Mint, type the following in the terminal, and press Enter.
wget "http://mirrors.gigenet.com/linuxmint/iso/stable/20/linuxmint-20-cinnamon-64bit.iso" -O
linuxmint.iso
For USB dban, type the following in the terminal, and press Enter.
For USB TinyCore, type the following in the terminal, and press Enter.
wget "distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore-current.iso" -O
tinycore.iso
Or rename your existing ISO to tinycore.iso and copy it to your external drive.
For MemTest86+, type the following in the terminal, and press Enter.
wget memtest.org/download/5.31b/memtest86+-5.31b.bin.zip
unzip memtest86+-5.31b.bin.zip
Then to copy, type the following in the terminal, and press Enter.
cp memtest86+-5.31b.bin memtest86+.bin
Or extract the contents of your existing memtest86+ zip file. Rename the bin to memtest86+.bin and
copy it to your USB device
Adding an Unlisted ISO: To try ISO Files that are not yet listed, use the existing menuentry
examples in /boot/grub/grub.cfg and append any options normally found in the distributions
syslinux.cfg file on the "append" line to the "linux" line of the menu entry.
Please inform me of entries you get to work and I will add them to the list, so that others may
benefit as well.
V. Test that your computer can Boot Multiple ISO from USB
Reboot your Computer, and enter your BIOS or Boot Menu. Set the Boot Order to boot from the
USB Device. Save your changes and then Reboot.
If all went well, you should be presented with a Grub2 Boot Menu containing the USB bootable
entries you previously added. Concluding How to create a Multiboot USB which can be used to
Boot Multiple ISO from USB.