有没有一种方法可以做到这一点?
或者直接复制/粘贴以下内容:
sudo -s
apt-get install grub-imageboot
mkdir /boot/images/
cp $YOUR_ISO_FILE.iso /boot/images/
update-grub2
就是这样。
有时,在运行update-grub2之前,您可能需要执行另外两个步骤:
如果您以前从未这样做过,则需要编辑/etc/default/grub文件,以便在启动时显示grub菜单:
## To show the menu, disable the hidden_timeout, and set a timeout
#GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT=10
ISOOPTS="iso raw"
update-grub2
。menuentry "Bootable ISO Image: SV100S2_64_128_120229" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set=root 6ca082d0-63d0-48c3-9e5f-2ce5d7a74fe4
linux16 /boot/memdisk iso raw
initrd16 /boot/images/SV100S2_64_128_120229.iso
}
menuentry
结果? - dma_kmemdisk
只能加载小于1GB的镜像,对于更大的文件(比如Win7 DVD ISO)会出现问题。 - dma_kupdate-grub
确实显示Found iso image: /boot/images/ubuntu-12.04.4-desktop-amd64.iso
,但是当我重新启动时,GRUB菜单中没有条目。 - Ciro Santilli OurBigBook.com我假设你想在GRUB菜单中添加一个.iso条目并启动它?
我在Ubuntu论坛上找到了这个信息
linux16 (hd0,gpt2)/usr/lib/syslinux/memdisk iso raw
initrd16 (hd0,gpt3)/myUserAccount/download/Barracuda-ALL-GRCC4H.iso
boot
# where Barracuda-ALL-GRCC4H.iso is a FreeDOS-based ISO 9660 image, and
# the mathematical 2-tuples or ordered pairs, (hd0,gpt2) and (hd0,gpt3),
# are GRUB 2's respective device notations for my rootfs partition
# (e.g., /dev/sda2) and home partition (e.g., /dev/sda3).
# NOTE: This procedure also applies to Seagate's SeaTools (based on
# FreeDOS as well); just substitute the file SeaToolsDOS223ALL.iso
# for Barracuda-ALL-GRCC4H.iso.
memdisk
的相关信息可以在http://www.syslinux.org/wiki/index.php/MEMDISK上找到。
通过直接在迷你shell中操纵命令,此过程比大多数前述方法更灵活简单,因为您不必每次尝试不同的Linux发行版或基于BSD的Live CD时都要费心调整和更新那些GRUB 2的配置。
目前,这四行命令是可以作为GRUB 2迷你shell中通用模式的,即loopback-linux-initrd-boot序列加上一些传递给给定内核的参数,例如引导尽可能多的流行Linux ISO映像(在这种情况下是带有System Rescue CD的3个内核命令行参数):
loopback lb (hd0,gpt3)/myUserAccount/download/systemrescuecd-x86-3.7.0.iso
linux (lb)/isolinux/rescue64 isoloop=systemrescuecd-x86-3.7.0.iso setkmap=us docache
initrd (lb)/isolinux/initram.igz
boot
http://ansi.interblc.com/2010/02/06/howto-boot-iso-images-via-grub2-with-ubuntu/
切换到`/etc/grub.d`目录。 在这里添加以`50`开头的ISO镜像。例如,我的Ubuntu正常ISO镜像的条目(50_ubuntu)如下所示: ``` echo "Adding $(egrep menu[e]ntry $0 | cut -d'"' -f2)" >&2 cat << EOF menuentry "Ubuntu 10.04 Daily Build" { loopback loop (hd0,3)/ansi/software_and_config/ISOs/ubuntu/lucid-desktop-i386.iso linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ansi/software_and_config/ISOs/ubuntu/lucid-desktop-i386.iso file=(loop)/preseed/ubuntu.seed quiet splash bootkbd=sg -- initrd (loop)/casper/initrd.lz } ``` 我的ISO文件存储在`sda3`下的`/ansi/software_and_config/ISOs/ubuntu/`目录中。为了根据您的需求进行更改,有三个元素需要更改。`loopback`行包含了您的硬盘(以grub样式表示,hdx,y x=0->sda x=1->sdb等)和路径。第三个要更改的元素位于`linux`行中。将此文件保存为“50_ubuntu”,放在“/etc/grub.d”目录中,并使用“chmod a+x 50_ubuntu”命令使其可执行,并使用“update-grub”命令激活更改。重新启动后,您应该能够使用Shift键激活grub菜单并选择新的条目。正如Mark Rooney所说,您可以在Ubuntu论坛上找到一个很棒的指南。
这将允许您从ISO文件启动,但仅当ISO支持时。 (所有最近的Ubuntu版本都应该支持,以及其他一些发行版)。
如果您计划从现场ISO安装,您应该将文件放在与您将要安装的不同分区中(因为您不能写入运行的分区)。也有可能安装程序会抱怨。您需要手动编辑/etc/mtab
并删除与包含ISO文件的分区对应的条目。
vmlinuz
的ISO镜像。有什么想法吗? - dma_k