【GRUB2】通过操作系统的ISO文件 启动或安装操作系统

本文详细介绍了如何通过GRUB2使用操作系统的ISO文件来启动或安装系统。首先确保ISO文件存放在硬盘适当位置,然后利用GRUB2创建menuentry,找到内核(vmlinuz)和文件系统镜像(initrd.img)。通过GRUB终端命令挂载ISO,查看其内容,并在/etc/grub.d/40_custom文件中添加menuentry,更新GRUB菜单,实现从ISO启动。
摘要由CSDN通过智能技术生成

 

首先,要使用ISO文件,当然,硬盘上得有,所以先下载好ISO文件存放在某个分区,比如/HOME目录(最好不要发那个在根分区,如果根分区空间不够的话,同样也别放在/boot分区,因为你给/boot分区的指定的空间也可能是不大的)。

 

接着我们的GRUB2要建立 menuentry , 但是我们需要操作系统ISO里的两个文件,即 内核和文件系统镜像(kernel, initrd image)。

内核的链接文件是  vmlinuz   ,镜像文件的链接是initrd.img    

 

On other bootable Linux ISOs and utility CDs, these files may be located in other folders and may be named differently (vmlinuz0, initramfs, etc). Note that some non-Ubuntu ISOs contain an initrd image with a.gz extension rather than the .lz extension now used by Ubuntu.

 

在linux的图形界面中查看ISO文件的内容

你在linux中使用   解压缩工具(Archive Manager)查看ISO文件里的内容。

如果你要在终端中查看的话(输入命令,回车之后会弹出图形界面),可以使用 “file-roller ”或者“ gksu file-roller ” 这两个命令。

 

如果要在LINUX命令行终端直接查看的话:

       可以把ISO镜像挂载到系统,通过通常查看文件的方式来查看ISO中的内容。

sudo mount -o loop /home/username/Downloads/ubuntu-desktop-amd64.iso /mnt/iso/

 

示例:

  • sudo mkdir /mnt/iso # Optional - the ISO file can be mounted on an existing mount point if desired.
    sudo mount -o loop /<path>/<filename>.iso /mnt/iso
    gksu nautilus /mnt/iso
    sudo umount /mnt/iso # When finished inspecting the contents.

 

通过 GRUB终端中的GRUB命令 来查看ISO

ls

显示grub已知的分区; Display partitions known to GRUB.

ls (hdX,Y)/     

显示X硬盘上Y分区中的的某个文件夹; Display the contents of the / folder on /dev/sdXY

To mount an ISO via the GRUB terminal, determine the location/path of the ISO file, then:

通过GRUB终端的命令挂载 ISO镜像 :

  • loopback loop (hdX,Y)/<path>/<filename.iso>

    Example: loopback loop (hd0,5)/my_isos/ubuntu-12.04-desktop-amd64.iso

    Once mounted via the above command, the ISO can be inspected using thels command. The ISO will be mounted on 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值