Re: Tutorial how to install Delphi Community Edition 10.4 in Windows 11 in Virtual Machine
skybuck2000 <[email protected]> Mon, 1 Nov 2021 21:23:11 -0700 (PDT)
| Newsgroups | alt.comp.lang.borland-delphi |
|---|---|
| Message-ID | <[email protected]> |
Next day, Skybuck here, yesteday couldnt post anymore but this is what happened:
Some Java and Android kits where installed on C: causing the 20 GB C: harddisk to run out of space. I didn't like this so delete the whole bunch.
I decided to resize the system C: drive, this required to delete the recovery partition and to re-create it, cause it was in the way.
Only black free space directly to the right of a partition can be used, and that is where this partition got in the way.
Extending or shrinking a partition works by putting in the increment or decrement number, not the total size of the drive this was somewhat confusing.
Anyway here was a very good tutorial how to do that:
Only thing I had to do was use E: or F: because R: was already used by the second drive.
http://woshub.com/extend-volume-blocked-by-windows-recovery-partition/
Here is a text version of this tutorial:
How to Move Recovery and Extend System Partition on UEFI-based Computer?
On my virtual machine, Windows 10 is installed in UEFI mode (Partition style: GPT).
check the partition table (GPT or MBR)
As you can see on the screenshot below, the “Extend Volume” button is inactive (gray). You can extend the partition using the Windows built-in tools if it has an unallocated space to the right of it (Windows 10 cannot extend primary partition to the right into unallocated space). In my case, I cannot extend the C: drive because it is blocked by the recovery partition (Windows RE). So, prior to extending the size of the system partition, I will have to delete the recovery partition.
Extend Volume option is grayed out on WIndows 10
On the screenshot, you can see that there are two recovery partitions (Recovery and Windows RE). To understand, which of them is used by Windows as an active recovery partition, you must assign the drive letters to your partitions. For example, you can assign a drive letters E: and R: using the the Disk Management or Diskpart.exe: select disk 0 -> select part 1 -> assign letter r: . To check the active recovery partition, run the command:
Skybuck here: this command can only be run from ms-dos/cmd.exe not diskpart:
bcdedit /enum all
Please pay attention to the following sections:
Windows Boot Manager (it indicates the partition where the BCD bootloader is located). In my case, the bootloader is on the EFI partition:
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume2
path \EFI\Microsoft\Boot\bootmgfw.efi
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
resumeobject {dbaf5561-4424-11e9-b766-b7001b047795}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30
check Windows Boot Manager configuration
Now look at the values in the Windows Boot Loader section. The Winre.wim image file (recovery environment) is located on the second partition with the Windows RE volume label.
Windows Boot Loader
-------------------
identifier {dbaf5563-4424-11e9-b766-b7001b047795}
device ramdisk=[E:]\Recovery\WindowsRE\Winre.wim,{dbaf5564-4424-11e9-b766-b7001b047795}
path \windows\system32\winload.efi
description Windows RE
locale en-us
inherit {bootloadersettings}
displaymessage Windows RE
osdevice ramdisk=[E:]\Recovery\WindowsRE\Winre.wim,{dbaf5564-4424-11e9-b766-b7001b047795}
systemroot \windows
nx OptIn
bootmenupolicy Standard
winpe Yes
To expand the size of the main Windows volume, we will have to delete the recovery partition to the right of it, extend the volume and recreate the recovery partition.
Instead of re-creating the recovery partition, in most cases it will be enough to move the recovery environment files to the drive C:. Then you will be able to completely refuse from using a separate 500MB WinRE partition. The recovery environment file will then be stored on the partition where Windows is installed.
To copy the Winre.wim file to the system volume and set new the WinRE.wim file location, run these commands:
reagentc /disable
md c:\Recovery\WinRE
xcopy e:\Recovery\WindowsRE\Winre.wim c:\Recovery\WinRE /h
reagentc /setreimage /path c:\Recovery\WinRE /target C:\Windows
reagentc /enable
If you try to delete the recovery partition from the Disk Management GUI by clicking Delete Volume (sometimes the disk properties are not available at all), the following error will appear:
Delete recovery partition on windows 10
Virtual Disk Manager
Cannot delete a protected partition without the force protected parameter set.
Cannot delete a protected partition without the force protected parameter set.
You can delete such a protected partition only using the diskpart tool. Open the elevated command prompt and run the diskpart command. Select the partition you want to delete (note the results of your commands, since the numbers of disks and partitions may vary).
DISKPART> rescan
DISKPART> list disk
DISKPART> select disk 0
DISKPART> list part
DISKPART> select part 5
DISKPART> delete partition override
DiskPart successfully deleted the selected partition.
DISKPART> Rescan
The override parameter allows diskpart to delete any partition regardless of its type (whether it is an active, system, or boot partition).
DISKPART> delete partition override
Now you can open the Disk Management and extend the system partition (the Extend Volume option is now available). If you want to recreate the recovery partition (it is recommended to save it or move it to the system partition as described above), leave 500MB of unallocated space on your drive. In the screenshot below, I am extending my Windows partition by 1.5GB and leaving 500MB at the end of the drive.
If there are any other vendor recovery partitions on the disk that prevent you from extending the main volume, check the article “How to Delete an OEM Partition?”.
Extend Windows 10 system partition with Disk Management
After extending the main partition, I have 500MB free space left for WinRE recovery partition.
unallocated space is to the right of primary windows 10 partition
Windows detects the recovery partition by the special labels: GUID — de94bba4-06d1-4d40-a16a-bfd50179d6ac and the GPT attribute 0x8000000000000001.
Let’s create a new partition and assign these attributes to it:
DISKPART> create part primary
DISKPART> format quick fs=ntfs label="WinRE"
DISKPART> assign letter="R"
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.
Exit
diskpart assigning recovery partition attributes
Then copy WinRE files from the Windows 10 installation disk (image) to your new recovery partition.
Mount the install.wim file from your Windows 10 install ISO image and extract the WinRE file (Winre.wim) from it:
md C:\WinISO
md C:\WinISO\mount
dism /mount-wim /wimfile:F:\sources\install.wim /index:1 /mountdir:C:\WinISO\mount /readonly
md R:\Recovery\WinRE
copy C:\WinISO\mount\Windows\System32\Recovery\Winre.wim R:\Recovery\WinRE\
dism /unmount-wim /mountdir:C:\WinISO\mount /discard
Then just move the WinRE file to the recovery partition and update the bootloader configuration:
reagentc /disable
reagentc /setreimage /path R:\Recovery\WinRE /target C:\Windows
reagentc /enable
Here you can find the full article about WinRE environment in Windows.
copy Winre.wim file and enable WInRE
So, we have recreated the recovery partition and registered a new path to the WinRE image. If you have any Windows boot problems, your recovery environment will boot automatically.
If you have any issues with your EFI bootloader or the EFI partition, follow the links to read the related articles.
How to Delete the Recovery Partition and Move the BCD on BIOS-based PC?
If your computer is based on BIOS (not UEFI), you can move the Windows boot manager (BCD) and the recovery environment files to the C: volume prior to deleting the recovery partition as follows.
First of all, you have to move BCD files from drive E: to drive C: (I have assigned this drive letter to my recovery partition):
Reg unload HKLM\BCD00000000
robocopy e:\ c:\ bootmgr
robocopy e:\boot c:\boot /s
bcdedit /store c:\boot\bcd /set {bootmgr} device partition=C:
bcdedit /store c:\boot\bcd /set {memdiag} device partition=C:
In case of any BCD problems, you can rebuild the BCD file and Master Boot Record (MBR) as described in this instruction.
Then move the recovery wim image:
reagentc /disable
md c:\Recovery\WinRE
xcopy e:\Recovery\WindowsRE\Winre.wim c:\Recovery\WinRE /h
reagentc /setreimage /path c:\Recovery\WinRE /target C:\Windows
reagentc /enable
Now you can remove the recovery partition using diskpart (as shown above) and extend your system partition successfully.
Bye and Goodluck,
Skybuck.
P.S.: I tested it and it worked for me, I did have to do it twice thus E: and F: cause E: was previous failed attempt and E: was not realized or something.
I gave this recovery partition 500 MB but it was not enough it had to be 510 MB after all is said and done, it seems like eventually it only takes up 6 MB of used space ?!? maybe hidden files, I don't know, maybe I did something wrong, but when I re-booted, after second re-boot attempt and hitting F6, F7, F8, F9, F10, F11, F12 I did manage to get into the windows advanced repair menu.
I am not sure if it actually works, because I didn't try to repair anything, maybe the software is missing not sure.
For a real harddisk installation it would be recommendable to re-do the windows 11 installation, this can also be done from within vm to a real harddisk.
However copieing/burning it to a real harddisk and then resizing the C: drive can also be done with this tutorial above which could be handy and cool, especially for virtualizing older systems and moving them to bigger systems.
Bottom line is I never really had to use windows advaned recovery, maybe only once, but probably not... in my experience it never was that usefull, maybe this new one is usefull.
Time may tell if it works out...
Would be great if somebody had a way to verify if the advanced windows recovery partition is indeed correctly working... maybe some verification program for it.
Delphi installed overnight, there was still a small exception on start up, but so far it seems to be working.
40 GB of space was used for the C: drive enough for windows 11 and Delphi 10.4 !
Bye for now,
Skybuck.