3

While setting up this home Windows installation some months back I managed to end up without a recovery partition for complicated reasons I won't get into, but I'd like to have it back. I have ~1000MBish unallocated at the end of my main drive to turn into the RE partition.

I have seen a lot of suggestions to just do an in-place upgrade from installation media, which is supposed to conjure up a recovery partition on its own, but I've also seen reports that this doesn't always work and I am just not willing to chance it.

I can enable/disable RE on C: using reagentc /enable and reagentc /disable which happily moves Winre.wim between ..\System32\Recovery\ when disabled and C:\Recovery\WindowsRE\ when enabled.

I have, in preparation, created a partition in the unallocated space as such:

> diskpart
> create partition primary
> format quick fs=ntfs label="Windows RE tools"
> assign letter="R"

My problem is I am unsure how to tell reagentc to deploy the files to this partition when enabling. (and will removing the drive letter then break it or will it use the internal GUID?)

I have found this excellent answer here that tells us all about ensuring that proper ID and attributes are set on the partition, which is great for once the RE is actually in the right place.

For clarity this is a GPT disk, currently there is a ~3720GB C: part, a 260MB EFI partition, and the new R: on the end.

Side Q: can I delete C:\Recovery dir when recovery is on a separate partition, or does Windows throw a tantrum?

6
  • 1
    You can use DISM to apply the Windows image to the partition.
    – Ramhound
    Commented Jan 6 at 4:19
  • @Ramhound could you explain further? I don't know how to do that. Is the result the same the recovery partition you'd normally have in a fresh install?
    – ch4rl1e97
    Commented Jan 6 at 4:21
  • 1
    Does this answer your question? Windows 10 lacks partitions and WinRe options
    – JW0914
    Commented Jan 12 at 13:26
  • No better than my answer, I don't think. I really don't like how they choose to manually take several steps that REAgentC is designed to do automatically. If you have extremely specific needs then I imagine it is helpful, but for the majority of home use cases my answer here involves far fewer steps and less legwork e.g. manually moving files around and creating the structure by hand. There is no need to personally access the partition afaik unless you're doing something very niche or something has gone very wrong. Linking to that answer could certainly help people in dire straits however.
    – ch4rl1e97
    Commented Jan 13 at 2:15
  • @ch4rl1e97 It's about this question being a direct duplicate of another
    – JW0914
    Commented Jan 13 at 12:30

1 Answer 1

1

Right, turns out I was very close.

After creating my extra space at the end and formatting/naming it, the only job remaining is to just set the ID. REAgentC will automatically detect it when enabling! That's what I missed.

Here are full steps with explanations and example output. Skip down to part 8 if you already have freed up some space (At least 700MB-ish).

  1. Open an elevated cmd.exe prompt and type...
  2. diskpart
  3. list disk

Outputs:

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online         1863 GB  2048 KB   *    *
  Disk 1    Online         3726 GB      0 B        *

In my case, my main drive is Disk 1, so I used:

  1. select disk 1

  2. list partition

Outputs:

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Reserved            16 MB  1024 KB
  Partition 2    System             260 MB  3723 GB
  Partition 3    Reserved          1000 MB  3724 GB
  Partition 4    Primary           3723 GB    17 MB

You will inevitably have different partitions in a different order and different sizes, doesn't matter. You need to identify the largest sized one. this will probably be your main drive (e.g. C:\) that you store things on, so check you have at least a few GB free on your main drive and free some if you don't, or the next step may not work. In this example we will pick number 4, don't blindly copy this.

  1. select partition 4
  2. shrink desired=700

This will reduce the size of the partition by 700MB, which seems to be a recommended size as of this writing. You can check with list partition that there should be 700MB unallocated.

  1. create partition primary

Outputs:

DiskPart succeeded in creating the specified partition
  1. format quick fs=ntfs label="winRE"

Outputs:

DiskPart successfully formatted the volume

We've filled the empty space (it will use all available space automatically) and formatted it how it needs to be, and given it a nice name. Note when you create a new partition it will automatically select the new partition, so we skipped doing select partition ... again.

  1. set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac

This is a magic ID that tells it that this is a recovery partition. if you now do list partition then you will see the "Type" of our new partition is set to "Recovery"!

  1. gpt attributes=0x8000000000000001

This is two attributes combined, 0x8000000000000000 "specifies that the partition won't receive a drive letter by default when the disk is moved to another computer, or when the disk is seen for the first time by a computer." Meanwhile 0x0000000000000001 "specifies that the partition is required by the computer to function properly." (source on attributes)

  1. We're done with DiskPart! Type exit.

  2. reagentc /disable

  3. reagentc /enable

This will turn off and on again the recovery. If you didn't already have it enabled then the first command will tell you, but it's worth checking. REAgentC will automatically detect our new Recovery partition when we /enable it and will install the recovery partition in there, instead of on your C:\ drive. Let's double check its in the right place:

  1. reagentc /info

Outputs (something like):

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Enabled
    Windows RE location:       \\?\GLOBALROOT\device\harddisk1\partition5\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: b52d9340-ac37-11ee-b25e-38d57a9b2c2e
    Recovery image location:
    Recovery image index:      0
    Custom image location:
    Custom image index:        0

REAGENTC.EXE: Operation Successful.

We're looking to make sure that in the long bit of text near the top, we see harddisk1 (or whatever disk number you picked earlier, usually 0 for most people), and then partition5 (the number of our new partition)

7
  • 1
    Where is the winre.wim? ReAgentC /enable won't enable WinRE without the correct folder structure and winre.wim on the WinRE partition
    – JW0914
    Commented Jan 12 at 13:29
  • If you didn't notice I answered my own question here, this worked, it is in place, REAgentC appears to have generated the structure as required, hence the Recovery\WindowsRE directory structure present in partition5 in the above example under "Windows RE location:". winre.wim, when RE is disabled, lives in `%systemroot%\System32\Recovery`. You can watch it appear and disappear when you disable/enable it.
    – ch4rl1e97
    Commented Jan 13 at 1:52
  • I've just triple checked for you and realised I still have a drive letter assigned. With some permissions wrangling I can see that winre.wim is present and correct in R:\Recovery\WindowsRE! And further, I am able to boot into the recovery environment via the usual advanced boot options.
    – ch4rl1e97
    Commented Jan 13 at 2:40
  • 1
    AFAIK, winre.wim does not usually get copied back to %WinDir%\System32\Recovery, unless Microsoft changed this recently, which is why it's recommended to copy it before disabling WinRE. This answer is also missing the correct GPT attributes for the WinRE partition set via DiskPart
    – JW0914
    Commented Jan 13 at 12:36
  • 1
    Its' definitely the case as of recent at the very least, test it out yourself if you like. See learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/… Most of the references I've read on this say the same thing and that's going back at least a few years. Perhaps introduced with Win10 or one of the major updates? I don't have an old machine available to test. Good point about GPT attributes, I'll add that in (though it seems to work without, it will complete the answer)
    – ch4rl1e97
    Commented Jan 13 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .