Problem Setting Recovery Partition after Moving Partitions

Page 1 of 2 12 LastLast

  1. Posts : 7,901
    Windows 11 Pro 64 bit
       #1

    Problem Setting Recovery Partition after Moving Partitions


    I just used Partition Magic to reconfigure my partitions as shown below:

    Attachment 227390
    The 925GB recovery partition is no longer recognised - see the reagentc reconfiguration command below:

    C:\WINDOWS\system32>reagentc /setreimage /path \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE
    REAGENTC.EXE: The Windows RE image cannot be stored in the specified volume. Use the RETAIN command in DISKPART to prepare the volume and try again.

    How do I proceed from here to restore a working recovery partition?
    Last edited by Steve C; 15 Mar 2019 at 07:29.
      My Computers


  2. Posts : 5,478
    2004
       #2

    check the partition type. In diskpart
    • select disk 0
    • select partition 4
    • detail partition

    Id should be DE94BBA4-06D1-4D40-A16A-BFD50179D6AC and gpt attributes 0x8000000000000001 (see UEFI/GPT-based hard drive partitions | Microsoft Docs and Capture and Apply Windows, System, and Recovery Partitions | Microsoft Docs)

    According to the same link your 925MB partition has enough free space but you could also making it much bigger (4GB perhaps) as a test to rule that out as a cause.

    Edit : Just another thought - may be an idea to mount it and check you do have winre.wim in \Recovery\WindowsRE\ although from used space I guess you do.
    Last edited by lx07; 15 Mar 2019 at 04:37.
      My Computer


  3. Posts : 7,901
    Windows 11 Pro 64 bit
    Thread Starter
       #3

    lx07 said:
    check the partition type. In diskpart
    • select disk 0
    • select partition 4
    • detail partition

    Id should be DE94BBA4-06D1-4D40-A16A-BFD50179D6AC and gpt attributes 0x8000000000000001 (see UEFI/GPT-based hard drive partitions | Microsoft Docs and Capture and Apply Windows, System, and Recovery Partitions | Microsoft Docs)

    According to the same link your 925MB partition has enough free space but you could also making it much bigger (4GB perhaps) as a test to rule that out as a cause.

    Edit : Just another thought - may be an idea to mount it and check you do have winre.wim in \Recovery\WindowsRE\ although from used space I guess you do.
    Thanks. The partition had the correct ID.

    I fixed it by assigning a drive letter to the partition then running the reagentc command pointing to that drive and WinRE path. The recovery drive has now been set and remains so having removed the drive letter (see enclosed). Windows 10 recovery options work as expected. Go figure!
    Attachment 227402
      My Computers


  4. Posts : 5,478
    2004
       #4

    Steve C said:
    I fixed it by assigning a drive letter to the partition then running the reagentc command pointing to that drive and WinRE path.
    I just tried with \\?\GLOBALROOT format and it doesn't like it for me either so it seems you are right. The log in C:\Windows\Logs\ReAgent says it couldn't find it. Like you when I mounted the partition it worked OK.
      My Computer


  5. Posts : 7,901
    Windows 11 Pro 64 bit
    Thread Starter
       #5

    lx07 said:
    I just tried with \\?\GLOBALROOT format and it doesn't like it for me either so it seems you are right. The log in C:\Windows\Logs\ReAgent says it couldn't find it. Like you when I mounted the partition it worked OK.
    The original command I used obtained from the forum was:
    C:\WINDOWS\system32>reagentc /setreimage /path \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE

    It seems this syntax may no longer be correct. Is a different command now needed for the latest version of Windows?
      My Computers


  6. Posts : 5,478
    2004
       #6

    What worked was to assign letter=R in diskpart then this :

    reagentc /setreimage /path R:\Recovery\WindowsRE

    What is peculiar is now I've done that this command, the same as yours, works also (when it didn't before) :

    reagentc /setreimage /path \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE

    I'm not sure now really why mine didn't work before but I've done too many disable/enable to make any sense of my log file. Sorry I can't be any help but it seems setting the path to \\?\GLOBALROOT\ *is* still valid. Just not always...
      My Computer


  7. Posts : 7,901
    Windows 11 Pro 64 bit
    Thread Starter
       #7

    lx07 said:
    What worked was to assign letter=R in diskpart then this :

    reagentc /setreimage /path R:\Recovery\WindowsRE

    What is peculiar is now I've done that this command, the same as yours, works also (when it didn't before) :

    reagentc /setreimage /path \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE

    I'm not sure now really why mine didn't work before but I've done too many disable/enable to make any sense of my log file. Sorry I can't be any help but it seems setting the path to \\?\GLOBALROOT\ *is* still valid. Just not always...
    Behold the wonders of Microsoft software engineering!
      My Computers


  8. Posts : 5
    Windows 10
       #8

    Steve C said:
    I just used Partition Magic to reconfigure my partitions as shown below:

    Attachment 227390
    The 925GB recovery partition is no longer recognised - see the reagentc reconfiguration command below:

    C:\WINDOWS\system32>reagentc /setreimage /path \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE
    REAGENTC.EXE: The Windows RE image cannot be stored in the specified volume. Use the RETAIN command in DISKPART to prepare the volume and try again.

    How do I proceed from here to restore a working recovery partition?
    I had the same issue, the message is misleading. It is only happening because your recovery is not recognized as a recovery partition. To fix this, you need to give it the right ID (DE94BBA4-06D1-4D40-A16A-BFD50179D6AC for GPT disks or 07 for MBR risks) and attributes (0x8000000000000001). Once you have done this, you can do the diskpart setreimage instruction again and it will work. Below is an example on how to set the ID and attribute of your recovery partition for GPT disks.
    Code:
    DISKPART> select disk 0
    
    Disk 0 is now the selected disk.
    
    DISKPART> list partition
    
    Partition ### Type Size Offset
    ------------- ---------------- ------- -------
    Partition 1 System 100 MB 1024 KB
    Partition 2 Reserved 16 MB 101 MB
    Partition 3 Primary 930 GB 117 MB
    Partition 4 Recovery 1024 MB 930 GB
    
    DISKPART> select partition 4
    
    Partition 4 is now the selected partition.
    
    DISKPART> set id=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
    
    DiskPart successfully set the partition ID.
    
    DISKPART> gpt attributes=0x8000000000000001
    
    DiskPart successfully assigned the attributes to the selected GPT partition.
    
    DISKPART> exit
    - - - Updated - - -

    Steve C said:
    Thanks. The partition had the correct ID.

    I fixed it by assigning a drive letter to the partition then running the reagentc command pointing to that drive and WinRE path. The recovery drive has now been set and remains so having removed the drive letter (see enclosed). Windows 10 recovery options work as expected. Go figure!
    Attachment 227402
    You must have set the attributes to 0x8000000000000001. If you do that it will always work on first try because the recovery is recognized as a recovery. This is particularly important if you add a primary partition as it will usually break recovery pointers, so by reassigning attributes it usually allows for reagentc to go smoothly.
      My Computer


  9. Posts : 5
    Windows 10
       #9

    Boot repair script


    realmaze said:
    I had the same issue, the message is misleading. It is only happening because your recovery is not recognized as a recovery partition. To fix this, you need to give it the right ID (DE94BBA4-06D1-4D40-A16A-BFD50179D6AC for GPT disks or 07 for MBR risks) and attributes (0x8000000000000001). Once you have done this, you can do the diskpart setreimage instruction again and it will work. Below is an example on how to set the ID and attribute of your recovery partition for GPT disks.
    You must have set the attributes to 0x8000000000000001. If you do that it will always work on first try because the recovery is recognized as a recovery. This is particularly important if you add a primary partition as it will usually break recovery pointers, so by reassigning attributes it usually allows for reagentc to go smoothly.
    I created a cmd script you can use to do those changes as well as other repair actions directly from the command line.
    Note:
    • Plug into a text file as save it as script.cmd or download the attached and change the extension to cmd
    • Run as administrator
    • Please be careful not to select the wrong partition on the wrong disk when you mark a partition as a recovery!

    Code:
    @echo off
    
    :: Define functions
    :menu
    echo.
    echo Select which components of the script to execute:
    echo.
    echo 1. Repair system files using SFC command
    echo 2. Check and fix disk errors through CHKDSK command
    echo 3. Bcdboot - Use this option to create or repair the system partition files
    echo 4. Fixboot - Use this option to repair boot errors on a specific partition
    echo 5. Bootrec - Use this option to repair boot errors on the system partition (MBR only)
    echo 6. Use Diskpart to mark a partition as a recovery partition (GPT only)
    echo 7. Access the System Restore with Command Prompt
    echo 8. Exit
    echo.
    set /p selection=Enter your selection (default is 1-9):
    if "%selection%"=="" set selection=1-9
    
    if "%selection%"=="1" (
        echo.
        echo Performing SFC...
        echo.
        sfc /scannow
        goto menu
    )
    
    if "%selection%"=="2" (
        echo.
        echo Performing CHKDSK...
        echo.
        chkdsk /f /r
        goto menu
    )
    
    if "%selection%"=="3" (
       set /p partition=Enter the drive letter of the partition you want to use:
    
       echo.
       echo Performing Bcdboot...
       echo.
       bcdboot %systemroot% /s %partition%
       goto menu
    
    )
    
    if "%selection%"=="4" (
        set /p partition=Enter the drive letter of the partition you want to use:
        
        echo.
        echo Performing Fixboot...
        echo.
        fixboot %partition%
        goto menu
    )
    
    if "%selection%"=="5" (
        echo.
        echo Performing Bootrec...
        echo.
    
        bootrec /scanos
        bootrec /fixmbr
        bootrec /fixboot
        bootrec /rebuildbcd
        goto menu
    )
    
    if "%selection%"=="6" (
        call :use_diskpart_to_mark_a_partition_as_a_recovery_partition
        goto menu
    )
    
    if "%selection%"=="7" (
       rstrui.exe
       goto menu
    )
    
    if "%selection%"=="8" (
       exit /b 0
    )
    
    :: Use Diskpart to mark a partition as a recovery partition
    :use_diskpart_to_mark_a_partition_as_a_recovery_partition
    
        @echo off
        (
        echo Rescan 
        echo List Disk
        ) | diskpart
    
        set /p disk=Enter the number of the disk you want to use:
    
        (
        echo Rescan 
        echo Select Disk %disk%
        echo List Partition 
        ) | diskpart
    
        set /p partition=Enter the number of the partition you want to mark as a recovery partition:
    
        (
        echo Rescan 
        echo Select Disk %disk%
        echo Select Partition %partition%
        echo Assign Letter=R
        echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
        echo gpt attributes=0x8000000000000001
        echo Detail Partition 
        echo exit
        ) > script.txt
    
        diskpart /s script.txt
    
        echo.
        echo Successfully marked partition %partition% as a recovery:
        echo.
        
        set /p YN=Do you want to use reagentc to connect your recovery to the GPT boot record (Y/N)?:
        
        if "%YN%"=="Y" (
        reagentc /setreimage /path R:\Recovery\WindowsRE
    
        echo.
        echo Note: If this failed, your recovery partition probably does not have a Recovery\WindowsRE folder with the right files, you need to use a different method
        echo.
        )
        pause
    Problem Setting Recovery Partition after Moving Partitions Attached Files
    Last edited by realmaze; 14 Jul 2023 at 16:12.
      My Computer


  10. Posts : 4,569
    several
       #10

    You would be better off using %systemdrive% in your cmd file. Contrary to popular belief the osletter is not always C
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:24.
Find Us




Windows 10 Forums