Solved Recover Partitions from diskpart -> clean command

rgirish

New Member
Messages
14
Hi Guys,

I was trying to install windows 7 on my windows 8.1 laptop (UEFI, samsung ATIV book 6) and when it didnt allow me to install Windows 7 on partitioned drive I followed some YouTube video foolishly from my phone and fired diskpart - clean command. everything gone after rebooted the system. Luckily I didnt do anything after that and referred one of the thread on sevenforums. followed some of the suggestions and was able to see all the partitions using partition wizard and it showed me correct list of partitions including recovery partitions. I used partition wizard to restore them. Then I tried to boot the laptop and it didnt boot into windows and gave me error

Your PC needs to be repaired.

File:\Windows\System32\winload.efi
Error code: 0xc0000225

I found following instructions by googling and I followed them, but it didnt seem to work
sad.gif


-----------------------------------------------------
Diskpart
List Volume
Select Volume=2 (change the "2" with a number that shows the ESP value.
Assign letter=Z
Exit
Bcdboot C:\windows /s Z: /f UEFI (change the C: with the drive letler of your OS)
4. Restart your computer.
------------------------------------------------------------------

Then I followed the instructions at https://neosmart.net/wiki/0xc0000225/ and it still didnt do much.

checked bcdedit and it was showing correct boot setting.

meanwhile I was going through the BIOS setting and I noticed that there are two options in the boot order. and I changed the boot order from windows boot manager to the option that is showing HDD name and bingo the system booted into my previous state.

Now I am not sure which one of MBR rebuild from above worked because obviously my boot order was wrong and thats why system was not booting into windows.

Now here is my problem
with Fast BIOS disabled , Secure boot disabled, OS mode is CSM and UEFI and HDD in boot order system perfectly boots into the windows 8.1

But it does not with Fast BIOS enabled, Secure boot enabled, OS mode UEFI and default windows boot manager in boot order for UEFI.

Because of this I am unable to go back to the state where I was before doing that stupid mistake of diskpart command.

I also see that previous restore points also gone missing :(

Any suggestions or help would appreciated.

Thanks
Girish
 

My Computer

System One

  • OS
    Windows 8.1
If you can boot with the Hard Drive as the primary boot device, you are not booting into UEFI.

Partition Wizard does not have a UEFI boot option. But if you use it to recovery from a Clean command, you would have needed to make sure it knew the Hard Drive was configured as GPT. I normally that using Diskpart and convert to GPT. Then Partition Wizard knows how to recover the partitions. If you did not take this step, the drive was probably recovered as a MBR configuration, and depending on how many partitions were on the drive, it may also have been converted to Dynamic.

Maybe supplying a snipping tool picture of your Disk Management window will help explain your situation. Attach using the paperclip on the Advance Replies.
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
It does appear you have the situation I predicted. The drive has been converted to MBR and the Logical partitions were created to account for the number of partitions on the drive. Luckily it was not converted to a Dynamic drive.

If this was me, I would do anything I could to safeguard the data on the drive, which might mean imaging the current configuration, or cloning the drive to another drive, or whatever would be possible.

Anything I might suggest will lead to the possibility of your loosing your install, except living with what you have. Looks like it is decision time.

Any Factory (OEM) process would probably result in your data being lost since it would reset the drive back to factory specs. You could try a Factory Reset to get the system back to the original configuration, but I don't believe that will work with a drive in the current situation. You might be able to get recovery media from the OEM which might allow you to wipe the entire drive and start over.

You could have a new drive in an external enclosure already configured as GPT and then copy the partitions over. But not sure the logical partitions would copy to a GPT drive. If you had a backup drive and could clone to it, that would be a good option for safety

What I would do, after having cloned the drive or backed up everything I could, would be to go back to where this started. Use the Diskpart command to clean the drive again, and then convert the drive to GPT. After doing that, you could then use Partition Wizard to recover the partitions.

After recovering the partitions, you would still need to make some changes to the install which might involve recreating the MSR partition, and re-designating the Recovery partitions and System partition using the correct Partition Type ID. These things are not hard to do using Diskpart again. We can help with the Diskpart commands, but will need to use the list disk, select disk and select partition commands along with the create partition and setid command for GPT installs.

I will look for some utility to convert a MBR drive to a GPT drive, but most of those will wipe the drive to do so. Maybe someone else would know of one which could do that safely and not remove the current install.
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Thanks for the reply saltgrass, looks like a very complicated process. looks like system is also not going into recovery partition. If I do the factory reset will it change the disk into GPT? do you think I can follow these instructions and convert the disk into GPT? Convert MBR Disk to GPT Disk with MiniTool Partition Wizard.

on the another note if I use diskpart or any other tool to convert the disk to GPT, I think I will lose the factory recovery partition right? the system did not come with installable windows disk.

Also if I copy the windows recovery partition on external hard drive, will I be able to install windows from there?
 

My Computer

System One

  • OS
    Windows 8.1
You are sort of unchartered territory. Since I have not used that procedure, if you think it will be safe, try it and see. But I cannot really predict how each type of partition will be handled.

If you copy the Factory Image to another drive, and have the information concerning the path and index of the image you should be able to recover reset. The information you would need is usually kept in a Reagent.xml file in the Recovery Tools partition or on a Recovery Drive. Let's hope you will not need to do that. You may also need the Winre.wim file in the Recovery Tools partition.

If you use Diskpart to convert a drive it may not actually remove the partition, but they would have to be recovered as you did before. Maybe the process used in Partition Wizard includes both tasks and automatically recovers the partitions.... we will know after you finish. :D
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Thanks Saltgrass !!! It worked. So I used bootable minitool partition wizard and convert the disk partitions to GPT as shown in video. System failed to start but I fired following commands from recovery boot and now I am able to boot in fast bios and secure boot mode. Thanks a lot again.

now that I noticed that my hard drive is failing after copying essential data ..next I m going to explore if I can restore factory image from external drive. That will be handy If I replaced this Hard Drive with SSD.

----------------------------------------------------
Diskpart
List Volume
Select Volume=2 (change the "2" with a number that shows the ESP value.
Assign letter=Z
Exit
Bcdboot C:\windows /s Z: /f UEFI (change the C: with the drive letter of your OS)
------------------------------------------------------------------
 

My Computer

System One

  • OS
    Windows 8.1
OK, don't do anything yet. How about another Disk Management Window picture.

Did you do the follow up I suggested as far as the EFI and Recovery Partitions? Partition Wizard does not recognize certain UEFI configuration requirements.
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Okay, here it is. I think something is still wrong with the system because it doesn't boot into recovery or advanced boot options. If I boot using recovery USB boot created from other laptop and select option for reset to factory image it gives me error saying recovery drive is missing.

dskmgmtnew.JPG
 

My Computer

System One

  • OS
    Windows 8.1
It looks like you need to set up the EFI system partition. It is Fat32, but not designated correctly. This is the most important partition and needs to be configured correctly.

Below is what the EFI partition should look like. You will probably need to use the Diskpart commands as follows to set the partition correctly. You can copy and paste in an administrative command prompt. Make sure and select the correct disk and partition for your system, and the EFI partition should be partititon 2.

set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b

gpt attributes=0x8000000000000000

C:\Windows\system32>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: AIO
DISKPART> lis dis

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 931 GB 1024 KB *
Disk 1 Online 232 GB 0 B *

DISKPART> sel dis 1

Disk 1 is now the selected disk.

DISKPART> list par

Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 500 MB 1024 KB
Partition 2 OEM 40 MB 501 MB
Partition 3 Reserved 128 MB 541 MB
Partition 4 Recovery 750 MB 669 MB
Partition 5 Primary 221 GB 1419 MB
Partition 6 Recovery 9 GB 223 GB

DISKPART> sel par 1

Partition 1 is now the selected partition.

DISKPART> det par

Partition 1
Type : c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Hidden : Yes
Required: No
Attrib : 0X8000000000000000
Offset in Bytes: 1048576
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 5 ESP FAT32 Partition 500 MB Healthy System
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Using Diskpart, select the correct drive and then the correct partition and use the commands I gave you.

list disk
sel disk 0
list par
sel par 2
set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
gpt attributes=0x8000000000000000

It should end up looking like the one I posted. It is still a FAT32 partition, just a different Type ID.

If it doesn't work, the drive may not be set to the GPT configuration. The List Disk should show the asterisk if it is Gpt.
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Thanks again, yes I figured out set id command but somehow attributes=0x8000000000000000 command was not working...gpt was missing. I followed the instructions and here is the dis management snapshot. BTW why there are 2 options in the select OS?


 

Attachments

  • dskmgmtnew 1.JPG
    dskmgmtnew 1.JPG
    89.3 KB · Views: 86

My Computer

System One

  • OS
    Windows 8.1
OK, to boot to a UEFI configuration, you need to boot to a Windows Boot Manager. In some bioses it is identified by the drive also, but not all bioses do that.

If you ran the bcdboot command you showed earlier, it might have messed with the boot files. On a UEFI system, the correct way to run the command is the basic version. You do not need to set any drive with a letter since it is a System partition. You may not need to do this, but just in case it is not booting using the Windows Boot Manager.

bcdboot c:\windows

Next we need to set the Recovery Partitions. Select those partitions and use these commands for each. The 349 MB partition is also a Recovery partition placed there by an 8 to 8.1 update.

set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
gpt attributes=0x8000000000000001

The last thing to do is to set the MSR partition. The following command will create an MSR partition in the unallocated space. Hopefully it will use the first 128 MB of space, but you do have the last 1 GB of unallocated space, which you can format as a simple partition or wait to see if the MSR partition is created correctly. I would probably format the 1 GB, since it is larger, to make sure the MSR partition was placed in the correct position. We can deal with the 1 GB partition partition later.

In Diskpart, make sure you have selected the disk and then use this command. If you want to do this while you are doing the other commands, it might be easier.

create par msr
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Hi Saltgrass,

sorry for the late reply as I got into some other high priority stuff at work. Just to understand this clear, you mean to say is select all those three partition from above diagram (349MB ,SAMSUNG_REC2 & WINDOWS_RE_TOOLS ) each and then fire the commands you have given? BTW aren't these partitions supposed to be hidden in windows explorer?
 

My Computer

System One

  • OS
    Windows 8.1
The commands set the partition as Recovery and to not acquire a drive letter. If they show up with a drive letter after the commands are successful we may have to remove it.

After you get that all set up, you can check the recovery system by running the command below in an Admin Command prompt. Copy and paste the readout.

reagentc /info
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Hi Saltgrass,

Thanks , I fired those commands and those partitions are hidden now. Here is the output of command reagentc /info but this was same before executing those commands as well. I rebooted laptop few times with various combinations in the bios like fast bios disabled , secure boot disabled etc. Tried F4, F10 etc but system still does not go into recovery menu. :(

C:\windows\system32>reagentc /info
Windows Recovery Environment (Windows RE) and system reset configuration
Information:


Windows RE status: Enabled
Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE
Boot Configuration Data (BCD) identifier: 852a8a4e-6a0a-11e4-bf5d-c8f733d37d7b
Recovery image location: \\?\GLOBALROOT\device\harddisk0\partition6\RecoveryImage
Recovery image index: 1
Custom image location:
Custom image index: 0


REAGENTC.EXE: Operation Successful.
 

My Computer

System One

  • OS
    Windows 8.1
Do you know for a fact the Recovery Tools are in the OS partition? The last version of the 8 to 8.1 update placed them there and in the 350 partition before that. If the Recovery options are not working, you may not yet have the correct path set.

Check C: \Recovery\WindowsRE and see if you have a WinRE.wim file.

When you get the tools working, we can work on the Recovery Image, which may not work with Windows 8.1. It took a special configuration for that to reset to refresh back to Windows 8.

Somewhere you may need to replace the MSR partition since that may effect how the partitions are counted. Again, format the 1 GB partition then use diskpart from an Administrative command prompt to run the following command after selecting the correct disk.

create par msr

Once you get this all done, you will be back in the position of many other Windows 8 users who upgraded to 8.1 in that the system may not work correctly, but the tools should at least start.
 

My Computer

System One

  • OS
    Windows 8.1 x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Grown
    CPU
    i7 3770K
    Motherboard
    ASUS P8Z77 -v Pro, Z87-Expert
    Memory
    16 G
    Graphics Card(s)
    EVGA GTX 680 Classified (2)
    Hard Drives
    Kingston SSD 240 GB
Hi Saltgrass,

sorry again for the late reply as I got too busy at work. Yes I can confirm that there is WinRE.wim file at C: \Recovery\WindowsRE.

somehow that 1GB Unallocated partition gone missing an its not there anymore and I remember I didnt do anything with it. I think it vanished after I followed the instruction from post #14. I did fire command create par msr during that time as well. here is the screen shot of diskmgmt now.



 

Attachments

  • diskmgmt1.JPG
    diskmgmt1.JPG
    87.6 KB · Views: 82

My Computer

System One

  • OS
    Windows 8.1
Should I do the create par msr and try again? BTW If I add dummy entry of windows 8.1 in BCD using rebuildbcd then below the OS selection menu I get that to go to recovery tools option. When I remove it using easybcd then I dont get to go into recovery tools
 

My Computer

System One

  • OS
    Windows 8.1
Back
Top