怎样给空硬盘装系统(如何给空硬盘装系统)

如何安装空硬盘系统(如何给空硬盘装系统)有时我们希望在不同的操作系统环境中进行不同的任务场景,需要在机器或硬盘上安装多个不同的操作系统。Grub2是多系统引导软件,现在大部分都是Linux默认的系统引导软件是Grub2,

如何安装空硬盘系统

(如何给空硬盘装系统)

有时我们希望在不同的操作系统环境中进行不同的任务场景,需要在机器或硬盘上安装多个不同的操作系统。

Grub2是多系统引导软件,现在大部分都是Linux默认的系统引导软件是Grub2,可在Index of /gnu/grub(https://ftp.gnu.org/gnu/grub下载最新版本grub2,最新版本是grub-2.06-for-windows.zip,压缩包大小为12M。安装前下载并解压c:盘中。安装前下载并解压c:盘中。

直接使用硬盘分区windows自带的diskpart不使用第三方分区软件完成。安装的多个Windows启动是通过的Windows引导器指导,即各分区Windows统一入口,不变\\\\efi\\\\microsoft\\\\boot\\\\位置和名称。Grub启动后,直接使用链式引导将控制交给Windows的引导器。优点是关机正常。

一、硬盘分区

2T硬盘,选择GPT硬盘格式,分区表类型GUID,包含一个ESP和MSR其中保留分区ESP分区大小为800M,盘符为B:。

自动批处理文件Disk2t.txt,用 diskpart /s .\\\\disk2t.txt自动执行。

操作前注意使用diskpart检查要分区的硬盘是否disk 1!!!检查盘符b和盘符bDL是空的吗?

Disk2t.txt内容如下:

REM 运行此批处理文件前必须使用diskpart的list disk检查是否disk 1!!!!

List disk

Select disk 1

List partition

Clean

Select disk 1

Convert gpt

REM 建esp同时,将建立15个分区mb保留分区,所以esp分区是分区2

Create partition efi size=800

format fs=fat32 label=”esp” quick

assign letter=b

create partition primary size=102400

assign letter=d

format fs=ntfs label=”oos01″ quick

create partition primary size=102400

assign letter=e

format fs=ntfs label=”oos02″ quick

create partition primary size=102400

assign letter=f

format fs=ntfs label=”oos03″ quick

create partition primary size=102400

assign letter=g

format fs=ntfs label=”oos04″ quick

create partition primary size=102400

assign letter=h

format fs=ntfs label=”oos05″ quick

create partition primary size=102400

assign letter=i

format fs=ntfs label=”oos06″ quick

create partition primary size=102400

assign letter=j

format fs=ntfs label=”oos07″ quick

create partition primary size=500000

assign letter=k

format fs=ntfs label=”dda01″ quick

create partition primary size=500000

assign letter=l

format fs=exfat label=”dda02″ quick

List part

exit

分区后还有185GB空间没有分区。

再建两个diskpart批处理文件,addB.txt和removeB.txt添加和移除方便esp盘符b:。

二、安装grub2

在esp分区中,有grub和efi子目录,grub有目录grub模块、字体、主题等文件,grub.cfg该目录还包含配置文件;efi各种操作系统的指导文件存储在目录中,Boot下放grub的启动文件bootx64.efi,还有Windows由管理器生成\\\\efi\\\\microsoft\\\\boot\\\\下的Windows启动文件bootmgfw.efi。Windows安装时会把bootx64.efi替换成bootmgfw.efi的内容。

用diskpart /s .\\\\addB.txt添加esp的盘符b:

list disk

sele disk 1

sele part 2

assign letter=b

exit

2、cd到grub-2.06-for-windows在安装目录中,用命令wmic diskdrive list brief检查要安装的磁盘是否正确\\\\\\\\.\\\\PHYSICALDRIVE1。

3、然后运行grub-install.exe –target=x86_64-efi –efi-directory=b: –boot-directory=b: \\\\\\\\.\\\\PHYSICALDRIVE1 –removable,在 EFI 下会生成 boot 目录,目录中有一份文件bootx64.efi。

将配置好grub启动配置文件grubok.cfg拷贝到b:\\\\grub中。

将配置好grub启动配置文件grubok.cfg拷贝到b:\\\\grub中。copy .\\\\grubok.cfg b:\\\\grub\\\\grub.cfg5、用diskpart /s .\\\\removeB.txt删除esp的盘符

b:。

list disk

sele disk 1

sele part 2

remove letter=b

exit

三、安装Windows

挂载Windows的iso文件到x:。

Windows10.在微软官网下载制作安装介质(USB 闪存驱动器或 DVD、ISO文件)工具MediaCreationTool21H2.exe。

Windows10.在微软官网下载制作安装介质(USB 闪存驱动器或 DVD、ISO文件)工具MediaCreationTool21H2.exe。打开后创建一个iso文件。将ISO文件挂载成光驱X,找到里面的文件source\\\\install.esd或source\\\\install.wim。

Windows可直接在官网下载ios镜像文件,选择Windows11(multi-edition ISO),找到里面的文件source\\\\install.esd或source\\\\install.wim。

检查一下ESP的分区盘符B:可用。检查一下ios文件中挂载的盘符是否为X:。运行

DISM.exe /Get-ImageInfo /ImageFile:X:\\\\sources\\\\install.esd,看看要安装的版本序号。

三、管理员权限cmd,运行DISM.exe /Apply-Image /ImageFile:X:\\\\sources\\\\install.esd /Index:4 /ApplyDir:D:将X:\\\\sources\\\\install.esd解压到要存放操作系统的oos分区D盘。做了批处理文件addiso.bat。一次可以将windows10和windows11加载到d:-h:的5个盘中。

rem add windows10 and windows11 iso file to d:-h: 5 diskpart

rem first should put windows10 iso to cd-rom M:,put windows11 iso to cd-rom N:
rem d:\\\\e:\\\\i: is windows10, f:\\\\h: is windows11

DISM.exe /Apply-Image /ImageFile:M:\\\\sources\\\\install.esd /Index:4 /ApplyDir:d:
DISM.exe /Apply-Image /ImageFile:M:\\\\sources\\\\install.esd /Index:4 /ApplyDir:e:

DISM.exe /Apply-Image /ImageFile:N:\\\\sources\\\\install.esd /Index:4 /ApplyDir:f:

DISM.exe /Apply-Image /ImageFile:N:\\\\sources\\\\install.esd /Index:4 /ApplyDir:g:

DISM.exe /Apply-Image /ImageFile:M:\\\\sources\\\\install.esd /Index:4 /ApplyDir:h:

4、运行diskpart /s .\\\\addb.txt,给esp添加盘符b:。再运行bcdboot.exe D:\\\\Windows /s B:。再运行bcdboot.exe D:\\\\Windows /s B:。在B:盘中生成Windows的UEFI引导文件Bootmgfw.efi,告诉计算机真正的系统是什么D:\\\\Windows它还会被修改d:盘bcd保存相应信息的文件。最后运行diskpart /s .\\\\removeb.txt,给esp移去盘符b:。做了一个批处理文件addbcd.bat完成这些工作。

rem add d:/e:/f:/g:/h: bcd to esp b:
diskpart /s .\\\\addb.txt
bcdboot.exe D:\\\\Windows /s B:
bcdboot.exe E:\\\\Windows /s B:
bcdboot.exe F:\\\\Windows /s B:

bcdboot.exe G:\\\\Windows /s B:

bcdboot.exe H:\\\\Windows /s B:

diskpart /s .\\\\removeb.txt

5.参照上述操作安装其他操作Windows系统。

四、安装Linux等待其他系统(待续)

本站部分文章来自网络或用户投稿,如无特殊说明或标注,均为本站原创发布。涉及资源下载的,本站旨在共享仅供大家学习与参考,如您想商用请获取官网版权,如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
投稿

优盘无法格式化怎么回事啊(优盘无法格式化怎么回事)

2022-8-14 10:32:03

投稿

win10文件找不到了怎么办(win10文件找不到)

2022-8-14 10:32:12

搜索