# Recovering a boot partition

### The first thing you need to do is insert a bootable USB flash drive with Windows installation files formatted in FAT32.

{% hint style="info" %}
You can create them from another device.
{% endhint %}

<div align="left"><figure><img src="/files/soZRbpu9ZsMRmaGIL4zo" alt=""><figcaption><p>The interface may vary.</p></figcaption></figure></div>

### Next, you need to enter the BIOS and boot by selecting this USB flash drive as the boot device.

<div align="left"><figure><img src="/files/TZFPwYFRoK0mYeYRIZHQ" alt=""><figcaption><p>The interface may vary.</p></figcaption></figure></div>

### After booting from the USB flash drive, you will see the "Windows Setup" window.

<div align="left"><figure><img src="/files/S1lNyX0GumpoSEqelP5e" alt=""><figcaption><p>The interface may vary.</p></figcaption></figure></div>

{% hint style="danger" %}
You don’t need to press anything, as we don’t need to go through the Windows installation process!
{% endhint %}

### We need to open the Command Prompt and execute the commands.

On the Windows setup screen, press **`SHIFT + F10`**.

The Command Prompt window will open.\
\
**In the Command Prompt, type:**

```
diskpart
```

{% hint style="info" %}
This will open the utility for managing disks and partitions.
{% endhint %}

**Next, type:**

```
list vol
```

{% hint style="info" %}

* A list of all volumes on the disk will appear.
* Find the boot EFI partition:
  * **Size:** approximately 100 MB
  * **File system:** FAT32
  * **Label:** SYSTEM, EFI, or it may have no name
  * **Note:** it usually does not have a drive letter.
    {% endhint %}

**Next, type:**

```
sel vol "5"
```

{% hint style="info" %}

* Replace `5` with the number of the volume that corresponds to your EFI partition.
* After this, all subsequent commands will be executed on this partition.
  {% endhint %}

**Next, type:**

```
format fs=fat32 quick
```

{% hint style="info" %}
A quick format of the selected volume is performed in the FAT32 file system, clearing its contents.
{% endhint %}

**Next, type:**

```
assign letter=Z
```

{% hint style="info" %}
The selected partition is assigned a temporary drive letter `Z:`, allowing it to be accessed from the Command Prompt.
{% endhint %}

**Next, type:**

```
exit
```

{% hint style="info" %}
We exit DiskPart and return to the Command Prompt.
{% endhint %}

**Next, type:**

```
bcdboot C:\Windows /s Z: /f all
```

{% hint style="info" %}

* `C:\Windows` — the path to your installed Windows (if the system drive has a different letter, replace it with the correct one).
* `/s Z:` — the partition where the boot files (EFI) will be copied.
* `/f all` — creates a bootloader for both UEFI and BIOS.
  {% endhint %}

{% hint style="success" %}
After executing the command, you should see the message:

```
Boot files successfully created.
```

{% endhint %}

\
Here’s an example of how it should look!

<figure><img src="/files/gcvN7INPgCDUVy1KrNeJ" alt=""><figcaption></figcaption></figure>

If all steps were completed correctly, turn off the computer, remove the USB flash drive, and turn it on again.

{% hint style="success" %}
Done! We have successfully restored the Windows bootpart
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stealth-3.gitbook.io/docs/problem/recovery.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
