Such a task does not appear often, but still, you need to convert an already installed system that is loaded in BIOS (or UEFI mode) into UEFI mode (in BIOS, respectively).
To whom it is interesting, we read further:
Fortunately, Windows 7 and older, initially ready to boot in any of the modes, you only need to change the partition structure and bootloader.
For this we need:
- Windows installation disk (or any other working installation media).
- systemrescuecd
- New disk to which we will migrate (you will convert yourself if there is no disk)
Boot from systemrescuecd and browse our disks:
fdisk -l
Your situation may differ slightly, in my case, / dev / sda is the source disk, and / dev / sdb to which we will transfer the system.
Let's start creating partitions (use gdisk for markup in gpt, and fdisk for mbr):
gdisk /dev/sdb
Slightly compress our original filesystem on the / dev / sda2 partition (so that it exactly fits into the new partition).
ntfsresize -s 126G -f /dev/sda2
Clone a partition and expand it to all available space:
partclone.ntfs -b -I -s /dev/sda2 -o /dev/sdb4 ntfsresize -f /dev/sdb4
Now we will boot from the Windows installation media in UEFI mode, select System Restore, and launch the command line.
The diskpart utility will help us find our disks:
Be careful, choosing the wrong drive, you can make it very painful and offensive.
In my case, the new disk has the number 1. Select it, select the second partition and format it in FAT32 (for the UEFI system partition), at the end assign it the drive letter S:
format quick fs=fat32 label="EFI" assign letter="S"
More difficult with sections where Windows is installed. After cloning, the labels of the volume are the same (it was possible to change them in Linux). But diskpart will help us again, we will simply select a volume and see its detailed parameters.
Choose a disk with a copy of Windows We have an interesting section with the letter E, you need to install the boot files on it:
bcdboot E:\Windows /ss: /f UEFI
Then, check that the boot loader configuration is correct, and if this is not the case, write the correct data (in my case, the download indicated the wrong volume, and I redefined it, in the example the identifier starting at 586).
That's all, after restarting, the system should boot.
From UEFI to BIOS
In the opposite direction, everything is approximately the same (remember about the types of markup), but you need to create one boot partition with NTFS (100 meters) and a partition for the system itself. Make the boot partition active and then install the boot loader and boot information on it (we have the boot partition with the letter S):
bcdboot E:\Windows /ss: /f BIOS bootsect /nt60 s: /mbr
Next rule boot configuration, and all.