admin管理员组

文章数量:1130349

事情是这样的,我重装系统的时候把所有分区都删了,包括EFI系统分区和保留分区。导致我的Windows 11把Windows boot manager 放在了我的USB移动硬盘的EFI分区,它是一个ventoy EFI 分区。导致我拔下移动硬盘后就无法启动Windows。

解决方法是我手动创建EFI分区,之后直接进入Windows系统运行cmd命令失败,得到了一个没用的错误提示,重启后进入进入 WinRE(Windows 恢复环境)运行cmd命令失败,但得到了有用的错误提示,之后用cmd重新设置了分区类型,BIOS才识别它是Windows Boot Manager,之后再次重启进入普通系统,手动分配驱动器号,手动挂载。最后通过管理员cmd成功创建启动文件。

1. 手动创建EFI分区:

这一步我踩坑了。我是用Ubuntu系统创建的EFI分区导致BIOS不识别,运行 bcdboot C:\Windows /s S: /f UEFI 这个命令也失败了。

sudo apt update
sudo apt install gparted

sudo gparted

1. Install GParted (if not already installed):
Open a terminal (Ctrl+Alt+T) and run:

bash

sudo apt update
sudo apt install gparted

2. Launch GParted:
You can find it in your application menu or run:

bash

sudo gparted

(You need sudo rights to modify partitions)

3. Select the Correct Disk:
Use the dropdown menu in the top-right corner to select the target disk (e.g., /dev/sda or /dev/nvme0n1). BE VERY CAREFUL to select the correct empty disk to avoid data loss.

4. Create a New Partition Table (GPT):
This is required for UEFI.

  • Click Device > Create Partition Table...

  • In the dialog box, select gpt from the list.

  • Click Apply. This will initialize the disk with a GPT scheme, wiping any existing data.

5. Create the EFI System Partition (ESP):

  • Right-click on the "unallocated" space and select New.

  • Set the following parameters:

    • New size: 500 MiB (Microsoft recommends 100MB, but 500MB is safer for future updates and multiple OSes).

    • File system: fat32.

    • Label: You can set this to ESP or EFI (for easy identification).

  • Click Add. You will see the new partition in the queue.

6. Set the Partition Flags:
This is a crucial step to mark the partition as the ESP.

  • Right-click on the new fat32 partition you just created and select Manage Flags.

  • Check the boxes for boot and esp. The esp flag might automatically check the boot flag.

  • Close the flags window.

7. Create the Main Partition for Windows:

  • Right-click on the remaining "unallocated" space and select New.

  • Leave the size as the maximum available.

  • Set the File system: to ntfs.

  • You can set a Label: like Windows or leave it blank (Windows will set it during installation).

  • Click Add.

8. Apply All Operations:

  • Review the operations pending in the bottom pane. It should look like this:

    1. Create partition table (msdos => gpt)

    2. Create new partition #1 (fat32, 500 MiB) [with boot,esp flags]

    3. Create new partition #2 (ntfs, rest of the disk)

  • If everything looks correct, click the ** green checkmark (Apply All Operations)**.

  • A confirmation window will pop up. Click Apply to write the changes to the disk.

You're done! The disk is now perfectly prepared for a Windows UEFI installation.

2. 直接进入Windows系统运行cmd命令失败:

直接进入Windows系统运行cmd命令失败,得到了一个没用的错误提示。

bcdboot C:\Windows /s S: /f UEFI
初始化库系统卷失败

3. 重启后进入进入 WinRE(Windows 恢复环境)改正分区类型,BIOS成功识别:

  • 重启电脑并进入 WinRE(Windows 恢复环境)
    ① 重启时连续按 F8 或 Shift+重启(现代系统)。
    ② 选择 “疑难解答”→“高级选项”→“命令提示符”。

重启后进入进入 WinRE(Windows 恢复环境)运行cmd命令失败,但得到了有用的错误提示,之后用cmd重新设置了分区类型,BIOS才识别它是Windows Boot Manager。

bcdboot C:\Windows /s S: /f UEFI 

BFSVC Error: Failed to set element application device. Status = [c00000bb]
BFSVC Error: Failed to populate BCD store. Status = [c00000bb]

把错误复制,问ChatGPT。

diskpart
list disk
select disk 0         (⚠️ Replace with your SSD number)
list partition
select partition X     (⚠️ Replace with the EFI partition number you made)
set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
gpt attributes=0x8000000000000001
exit

我认为 set id 和 gpt attributes 这两条命令成功设置了EFI分区的类型,让BIOS识别它是ESP分区。

set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
gpt attributes=0x8000000000000001

4. 手动分配驱动器号,手动挂载。最后通过管理员cmd成功创建启动文件:

再次重启进入普通系统,手动分配驱动器号,手动挂载。最后通过管理员cmd成功创建启动文件。

bcdboot C:\Windows /s S: /f UEFI

C:\Windows\System32>diskpart

Microsoft DiskPart 版本 10.0.26100.1150

Copyright (C) Microsoft Corporation.
在计算机上: DESKTOP-8ECEFJ3

DISKPART> list volume

  卷 ###      LTR  标签         FS     类型        大小     状态       信息
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  卷     0     C                NTFS   磁盘分区         475 GB  正常         启动
  卷     1                      FAT32  磁盘分区         500 MB  正常         已隐藏
  卷     2                      NTFS   磁盘分区         704 MB  正常         已隐藏
  卷     3                      NTFS   磁盘分区         931 GB  正常
  卷     4     D   Newsmy       NTFS   磁盘分区         298 GB  正常
  卷     5     E   Ventoy       NTFS   磁盘分区         148 GB  正常
  卷     6                      FAT    磁盘分区         287 MB  正常         已隐藏

DISKPART> select volume 1

卷 1 是所选卷。

DISKPART> assign letter=S

DiskPart 成功地分配了驱动器号或装载点。

DISKPART> exit

退出 DiskPart...

C:\Windows\System32>bcdboot C:\Windows /s S: /f UEFI
已成功创建启动文件。

C:\Windows\System32>

事情是这样的,我重装系统的时候把所有分区都删了,包括EFI系统分区和保留分区。导致我的Windows 11把Windows boot manager 放在了我的USB移动硬盘的EFI分区,它是一个ventoy EFI 分区。导致我拔下移动硬盘后就无法启动Windows。

解决方法是我手动创建EFI分区,之后直接进入Windows系统运行cmd命令失败,得到了一个没用的错误提示,重启后进入进入 WinRE(Windows 恢复环境)运行cmd命令失败,但得到了有用的错误提示,之后用cmd重新设置了分区类型,BIOS才识别它是Windows Boot Manager,之后再次重启进入普通系统,手动分配驱动器号,手动挂载。最后通过管理员cmd成功创建启动文件。

1. 手动创建EFI分区:

这一步我踩坑了。我是用Ubuntu系统创建的EFI分区导致BIOS不识别,运行 bcdboot C:\Windows /s S: /f UEFI 这个命令也失败了。

sudo apt update
sudo apt install gparted

sudo gparted

1. Install GParted (if not already installed):
Open a terminal (Ctrl+Alt+T) and run:

bash

sudo apt update
sudo apt install gparted

2. Launch GParted:
You can find it in your application menu or run:

bash

sudo gparted

(You need sudo rights to modify partitions)

3. Select the Correct Disk:
Use the dropdown menu in the top-right corner to select the target disk (e.g., /dev/sda or /dev/nvme0n1). BE VERY CAREFUL to select the correct empty disk to avoid data loss.

4. Create a New Partition Table (GPT):
This is required for UEFI.

  • Click Device > Create Partition Table...

  • In the dialog box, select gpt from the list.

  • Click Apply. This will initialize the disk with a GPT scheme, wiping any existing data.

5. Create the EFI System Partition (ESP):

  • Right-click on the "unallocated" space and select New.

  • Set the following parameters:

    • New size: 500 MiB (Microsoft recommends 100MB, but 500MB is safer for future updates and multiple OSes).

    • File system: fat32.

    • Label: You can set this to ESP or EFI (for easy identification).

  • Click Add. You will see the new partition in the queue.

6. Set the Partition Flags:
This is a crucial step to mark the partition as the ESP.

  • Right-click on the new fat32 partition you just created and select Manage Flags.

  • Check the boxes for boot and esp. The esp flag might automatically check the boot flag.

  • Close the flags window.

7. Create the Main Partition for Windows:

  • Right-click on the remaining "unallocated" space and select New.

  • Leave the size as the maximum available.

  • Set the File system: to ntfs.

  • You can set a Label: like Windows or leave it blank (Windows will set it during installation).

  • Click Add.

8. Apply All Operations:

  • Review the operations pending in the bottom pane. It should look like this:

    1. Create partition table (msdos => gpt)

    2. Create new partition #1 (fat32, 500 MiB) [with boot,esp flags]

    3. Create new partition #2 (ntfs, rest of the disk)

  • If everything looks correct, click the ** green checkmark (Apply All Operations)**.

  • A confirmation window will pop up. Click Apply to write the changes to the disk.

You're done! The disk is now perfectly prepared for a Windows UEFI installation.

2. 直接进入Windows系统运行cmd命令失败:

直接进入Windows系统运行cmd命令失败,得到了一个没用的错误提示。

bcdboot C:\Windows /s S: /f UEFI
初始化库系统卷失败

3. 重启后进入进入 WinRE(Windows 恢复环境)改正分区类型,BIOS成功识别:

  • 重启电脑并进入 WinRE(Windows 恢复环境)
    ① 重启时连续按 F8 或 Shift+重启(现代系统)。
    ② 选择 “疑难解答”→“高级选项”→“命令提示符”。

重启后进入进入 WinRE(Windows 恢复环境)运行cmd命令失败,但得到了有用的错误提示,之后用cmd重新设置了分区类型,BIOS才识别它是Windows Boot Manager。

bcdboot C:\Windows /s S: /f UEFI 

BFSVC Error: Failed to set element application device. Status = [c00000bb]
BFSVC Error: Failed to populate BCD store. Status = [c00000bb]

把错误复制,问ChatGPT。

diskpart
list disk
select disk 0         (⚠️ Replace with your SSD number)
list partition
select partition X     (⚠️ Replace with the EFI partition number you made)
set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
gpt attributes=0x8000000000000001
exit

我认为 set id 和 gpt attributes 这两条命令成功设置了EFI分区的类型,让BIOS识别它是ESP分区。

set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
gpt attributes=0x8000000000000001

4. 手动分配驱动器号,手动挂载。最后通过管理员cmd成功创建启动文件:

再次重启进入普通系统,手动分配驱动器号,手动挂载。最后通过管理员cmd成功创建启动文件。

bcdboot C:\Windows /s S: /f UEFI

C:\Windows\System32>diskpart

Microsoft DiskPart 版本 10.0.26100.1150

Copyright (C) Microsoft Corporation.
在计算机上: DESKTOP-8ECEFJ3

DISKPART> list volume

  卷 ###      LTR  标签         FS     类型        大小     状态       信息
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  卷     0     C                NTFS   磁盘分区         475 GB  正常         启动
  卷     1                      FAT32  磁盘分区         500 MB  正常         已隐藏
  卷     2                      NTFS   磁盘分区         704 MB  正常         已隐藏
  卷     3                      NTFS   磁盘分区         931 GB  正常
  卷     4     D   Newsmy       NTFS   磁盘分区         298 GB  正常
  卷     5     E   Ventoy       NTFS   磁盘分区         148 GB  正常
  卷     6                      FAT    磁盘分区         287 MB  正常         已隐藏

DISKPART> select volume 1

卷 1 是所选卷。

DISKPART> assign letter=S

DiskPart 成功地分配了驱动器号或装载点。

DISKPART> exit

退出 DiskPart...

C:\Windows\System32>bcdboot C:\Windows /s S: /f UEFI
已成功创建启动文件。

C:\Windows\System32>

本文标签: 分区EFI