1

So I was trying to install Windows 10 from a bootable USB and unfortunately without reading the error I have deleted the C partition and I got that error

Windows cannot be installed on this disk the selected disk has an MBR partition table, on EFI systems windows can only be installed on GPT disks`

I have been searching for two days now and have tried the following solution:

  1. burn the USB as GPT or MBR
  2. using gparted Live on USB (must delete the data)
  3. changing legacy mode to UEFI mode and disabling secure boot

Any other solutions either require third party (which I can't run because I don't have Windows), or uses the clean command to delete the whole hard disk.

So is there any way to do so without losing the other partitions or a way to access them and back them up (without taking the hard drive out)?

Also is this answer valid? Converting MBR to GPT during Windows installation without wiping the disk because after entering [w] to convert it says Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! which seems to me as it will erase everything

2
  • The simplest solution is to install Windows 10 in legacy mode then use MBR2GPT to convert to GPT.
    – Ramhound
    Commented Sep 23, 2021 at 14:51
  • 1
    phuclv, the success of the intended operation does not just depend on having a conversion tool ready but also on disk layout.
    – r2d3
    Commented Sep 23, 2021 at 19:56

3 Answers 3

4

From within any Linux system (including Gparted Live), open a terminal and run gdisk on the device representing your disk. For example, if lsblk -S says it's /dev/sda, use gdisk /dev/sda.

gdisk is a commonly used partitioning tool, similar to parted/GParted and to the Linux fdisk. The only difference is that it always writes out GPT partition tables – when it's run on a MBR-partitioned disk, it'll read the existing MBR partitions, but will always write the table in GPT format instead.

While in gdisk, don't do anything else (do not try to create or delete partitions), just directly use the w command to save the changes. (You don't need to create the EF00 partition; Windows Setup will do that anyway.)

Although if you want, you can use p to see the actual partition table and write down the start+length of each partition (in sectors) – if a partition is deleted but then re-created at exactly the same position, it'll still contain the same data as it did before (unless the partitioning tool deliberately cleans it out, which gdisk generally doesn't do).

After confirming the write, the old MBR partition table will be removed, and a GPT partition table containing the same partitions will be created.

(Yes, I realize this is mostly the same as in the linked post.)

2
  • Your post suggests that conversion is always possible. You are ignoring the possibility of an adverse layout and rely on gdisk will detect that.
    – r2d3
    Commented Sep 23, 2021 at 19:58
  • wiki.archlinux.org/title/GPT_fdisk To convert an MBR partition table to GPT using sgdisk, use the -g/--mbrtogpt option: # sgdisk -g /dev/sda To convert GPT to MBR use the -m/--gpttombr option. Note that it is not possible to convert more than four partitions from GPT to MBR. # sgdisk -m /dev/sda
    – schemacs
    Commented Apr 23 at 5:09
1

because I don't have Windows

But you're already running Windows. The message

"Windows cannot be installed on this disk the selected disk has an MBR partition table, on EFI systems windows can only be installed on GPT disks"

is output from the Windows installer which runs on Windows PE. It isn't the full-fledged Windows but still the same Windows kernel with almost the same capability

That Windows PE can run normal Windows exe files and more importantly contains MBR2GPT.EXE for the lossless conversion. So after booting the installation disk just press Shift+F10 and the command prompt will open for you to do anything you want. Now just run mbr2gpt to do the conversion, for example the below will convert disk 0 to GPT

MBR2GPT.EXE /convert /disk:0 /allowfullos

As long as your disk satisfies the requirements, it'll convert the disk from MBR to GPT without data loss

Command Prompt in Windows installer

See also Convert MBR to GPT - Without any OS

If it fails to convert then see Cannot convert from MBR to GPT for other solutions

For more information about Windows PE see Why is WinPE called an operating system?

0

First, I recommend being more precise in questions. "from a bootable USB" what is that referring to? A CD-Rom, A DVD-Rom, a USB-stick or a hard drive?

"changing legacy mode to EUFI mode and disabling secure boot" I don't kow what "EUFI" means. I can only guess that it's an error. You should take a little bit more care.

=========================================================

Regarding your question here is my answer:

Checking the risk of a MBR to GPT conversion:

A conversion from MBR to GPT can be considered as low risk when the conversion does not require moving or shrinking of partitions.

The need to move or shrink partitions arises from the fact that the GPT structure reside in well defined locations.

Look at the image in https://en.wikipedia.org/wiki/GUID_Partition_Table

The GPT structure requires the first 34 sectors of the disk (from sector 0 until 33) and the last 33 (because there is no backup of the protective MBR residing in sector 0).

If your partitions do not touch this area the GPT structure can be written as its just a defined list of pointers at the beginning and the end of the disk pointing to the beginning of the partitions inside of the disk.

If your partition starts in the supposed-to-be GPT area at the beginning of the disk it has to be moved forward into the direction to the end of the disk (towards higher LBA numbers). This moving operation is risky. Imagine what happens if you loose your power supply while doing that.

If moving makes the partition touch the last 33 sectors of the disk free space has to be created by moving one or a couple of partitions backwards (in the direction of sector number 0) assuming that there is still free space in between of the partitions or at least one partition has to be shrinked. If the partition to be shrinked is not the last one on the disk, moving is required as well. This process can also be considered as risky.

If the partitions inside do not touch the first 34 sectors you still will have to see if the partitions touch the last 33 sectors. This would require moving and/or shrinking to free those last 33 sectors.

Even when being in a low risk environment it is worth being paranoid and recording the current partition structure. I would recommend Testdisk for it. When going into drive analysis you have the possibility to backup the partition structure of the drive into a file labeled "backup.log" You can read that with a text editor.

Checking free space at the beginning of the disk

Having that information you can determine whether the operation is risky or not. The availability of free space at the beginning is visible directly when looking into "backup.log".

Checking free space at the end of the disk

To check the necessary free area at the end of the disk you either look at the disk housing where the number of sectors should be printed or you use a linux tool like hdparm.

Here is an example linked, what matters is the LBA48 figure on the picture:

https://www.geeksforgeeks.org/hdparm-command-in-linux-with-examples/

Calculate the last sector used of the last partition and check if there are still 33 free sectors remaining.

Conclusion

If the GPT area at the beginning of the disk or the end of the disk is occupied you are better of reinstalling a new disk instead of trying out a risky conversion.

All the above applies to a sector size of 512 bytes at the external side of the hard disk interface. This could be real 512 byte sectors or 512 byte emulated (typically internal 4096 bytes). In case of the harddisk in question has a sector size of 4096 bytes externally (1:1 pass through of internal sectors of 4096 bytes) the sector numbering changes.

You must log in to answer this question.

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