Windows 11下从硬盘直接装Ubuntu,不用外接U盘/硬盘
网速快捷的今天,手边找个U盘还真不容易。微软在Windows 11里封死了它的bootmanager,不支持添加非Windows的启动项。EasyBCD也不能Easy了。让我们来手工搞一个直接从UEFI启动Grub2,再从Grub2下引导Ubuntu安装光盘(iso)的方案。如果您喜欢,或对您有用,请给个赞。将是我持续创作的助力。
以下方案,在Virtualbox里的Windows 11虚拟机上测试通过。所有的操作,可以移到物理机上,只需对物理机上的相应设置做调整即可。请务必仔细读完全文后,理解的基础上,再行操作。
1,下载Ubuntu iso。此处以23.04镜像为例子,文件名ubuntu-23.04-desktop-amd64.iso。你可以直接在虚拟机里下,也可以在宿主(物理)机下载,然后通过共享文件夹移动到虚拟机。文件放C盘根目录下。
2,Windows虚拟机里打开ubuntu-23.04-desktop-amd64.iso,复制EFI/boot文件夹下的grubx64.efi到C盘根目录。
3,以管理员身份,Windows虚拟机里运行terminal。
4,运行diskpart命令。




5,输入list vol命令,查看分区情况。找到efi启动分区。如上图,100MB FAT32标记为系统的分区,即是。
6,select vol 5选择第5分区,再assign letter m为选定的分区分配盘符m,最后exit退出。




7,输入命令copy c:\grubx64.efi m:\拷贝grub2的启动文件到启动盘m。exit退出。
8,虚拟windows机里,启动磁盘管理程序(于底部任务栏搜索框输入mmc,在mmc添加磁盘管理单元即可),压缩出一个20G的空白区,并将其新建为新分区,用以安装Ubuntu。因为作演示用,只给了20G。建议您给到至少30G。




9,重启Windows虚拟机器,按F2进入UEFI(如果不行,同时快速切换按F2,F10, F12。这个我没去细查资料看具体是哪个)。
10,在UEFI里选择Boot Maintenance Manager \ Boot Options\Add Boot Options。选择磁盘(我的是No Volume Label)。








11,在File Explorer第二部分里就可以看到整个启动盘的目录结构。我的启动盘里有EFI文件夹和上面操作步骤里拷贝的grubx64.efi。选择grubx64.efi,enter确认。




12,弹出界面里,按enter,输入描述文字ubuntu grub2。Commit Changes and Exit保存退出。




13,退回到以下菜单,进入Boot Manager。选择Ubuntu Grub2,enter进入grub2 shell。








14,于grub shell依次输入以下命令,引导ubuntu iso光盘镜像。
#查看本机磁盘分区
ls
#查看磁盘1分区3根目录下的文件
ls (hd0,gpt3)/
#将hd0,gpt3分区设置为grub根目录
set root=(hd0,gpt3)
#将ubuntu iso赋值给一个变量isofile,以便后面命令行引用
set isofile="/ubuntu-23.04-desktop-amd64.iso"
#装载iso文件到虚拟光驱设备
loopback loop $isofile
#加载光盘casper目录下的linux内核,传递后面的参数以供启动
linux (loop)/casper/vmlinuz boot=casper layerfs-path=minimal.standard.live.squashfs iso-scan/filename=$isofile
#加载光盘casper下的初始化根分区
initrd (loop)/casper/initrd
#执行启动
boot




注意:每个人的分区情况不同,ubuntu iso镜像放置的盘不同,则需要做相应更改grub shell里磁盘引用符号hd0,gpt3。可通过ls (hdX,gptX)逐一查看,以找准确。
15,剩下的就是根据提示,安装系统了。




装完以后,可以在Ubuntu shell里删除前面拷贝到启动分区下的grubx64.efi文件,不影响既定启动。具体如下:
su
cd /boot/efi/
rm grubx64.efi
默认情况下,Ubuntu把启动分区挂载在/boot/efi目录下。你也可以sudo nautilus,在图形文件管理器里去删除。
2024最新激活全家桶教程,稳定运行到2099年,请移步至置顶文章:https://sigusoft.com/99576.html
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。 文章由激活谷谷主-小谷整理,转载请注明出处:https://sigusoft.com/13428.html