0

I had an old Windows XP (Dual booted with Ubuntu) running on my computer and then I decided to move on and installed Windows 7 in another logical drive. Now the Windows XP is corrupted and I want to format that Windows XP drive, which is the Primary partition and make use the space for other purposes.

The current bcdedit screenshot is as below:

bcdedit result

What I can see from this image is that Windows Boot Manager is defined in the drive where Windows XP is installed.

Now the partitions are as below.

Partitions Screenshot

The highlighted partitions are Windows XP (D:) and Windows 7 (C:).

I have two questions:

  1. Is it safe to format/delete the Windows XP (D:) primary partition, in which the Windows Boot manager is defined?
  2. is it possible to format/delete the Windows XP (D:) primary partition? if yes, how?
0

Is it safe to format/delete the Windows XP (D:) primary partition, in which the Windows Boot manager is defined?

Yes, however you computer will be in an unbootable state after you format the partition. You will need to recreate the Windows 7 boot files yourself.

To do this, after you format the XP partition as NTFS, do these commands from Windows 7.

First, just to be safe, put a valid MBR and PBR in place:

bootsect /nt60 D: /force /mbr
bootsect /nt60 D: /force

Now, you need the boot files to be properly located on the partition XP used to be on (which is your boot partition).

 md D:\boot
 robocopy C:\Windows\boot\PCAT\ D:\boot\ /MIR

Finally, we need a BCD for windows to boot properly.

 bcdedit /createstore D:\boot\BCD
 bcdedit /import D:\boot\BCD
 bcdedit /create {bootmgr}
 bcdedit /set {bootmgr} device boot
 bcdedit /timeout 7
 bcdedit /create /d "Windows 7" /application osloader

At this point you should have a long GUID number returned. (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) You'll want to use that number in the place of GUID

 bcdedit /default {*GUID*}
 bcdedit /set {default} device partition=d:
 bcdedit /set {default} osdevice partition=c:
 bcdedit /set {default} path \Windows\System32\winload.exe
 bcdedit /set {default} systemroot \Windows
 bcdedit /set {default} detecthal yes
 bcdedot /displayorder {default} addlast

Ideally however you should create a dedicated boot partition like windows does by default. This way you don't have to worry about this sort of thing.

Delete the XP partition, and create a ~100MB primary NTFS partition, then a second primary partition. Treat that 100MB partition as the XP partition when following steps above.

is it possible to format/delete the Windows XP (D:) primary partition? if yes, how?

These commands will format it. You may need to boot from a Windows recovery/installation media (usb/cdrom) to perform them though if Windows complains about it being the only primary or the only boot partition.

(Please note, the commands below are specific to this question only. If you are reading this looking for help, and are NOT the original poster, please carefully determine the proper disk numbers and partition numbers to apply to your specific disk configuration)

To format:

 diskpart
 select disk 0
 select par 1
 format fs=ntfs quick
 act

To delete, then create, format, and assign a drive letter.

 diskpart
 select disk 0
 select par 1
 delete
 create par pri
 act
 format fs=ntfs quick
 assign letter=d
  • Thanks for your elaborated feedback. Now, given that my system is Ubuntu - Windows dual boot, is this procedures will effect it, in anyway? – user177641 Feb 14 '16 at 13:26
  • It will render Ubuntu unbootable unfortunately, if you want to boot with GRUB you'll need to ignore the lines with the bootsect command. – Hydranix Feb 25 '16 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.