Moving the Windows C: Drive to the End of a Disk

19 min read

Introduction

When a disk is expanded, Disk Management cannot directly extend the C: drive if a recovery partition sits between C: and the new unallocated space.

Windows can still extend C: using only built-in tools if the recovery partition is deleted first. However, recreating the recovery partition at the end of the disk means that the same work will be necessary the next time the disk is expanded.

This article uses GParted Live to place the recovery partition before C: and move C: to the end of the disk. Future disk extensions can then be added to C: without recreating the recovery partition.

This procedure changes the disk’s partition layout. I do not provide individual support or accept inquiries concerning boot failures, system malfunctions, data loss, or other problems resulting from following this article.

Background

Disk Management and DiskPart can extend a volume only into unallocated space immediately following that volume.

If a recovery partition follows C:, expanding the disk produces the following layout.

[EFI][MSR][C:][Recovery][New unallocated space]

In this layout, the recovery partition prevents C: from being extended directly.

As described in the WebARENA support article, another option is to delete the recovery partition, extend C:, and then recreate the recovery partition at the end of the disk. The next disk extension, however, once again places the recovery partition between C: and the new unallocated space.

Instead, this article places the recovery partition before C: and moves C: to the end of the disk. Any space added by a future disk extension will then appear immediately after C:.

[EFI][MSR][Recovery][C:][New unallocated space]

Disk layout

The initial layout has a recovery partition immediately after C:.

[EFI][MSR][C:][Recovery]

The active recovery partition will be deleted, C: will be moved to the right, and a new 1 GB recovery partition will be created before C:. The resulting layout is:

[EFI][MSR][Recovery 1 GB][C: at end of disk]

This article applies to Windows installations using UEFI and GPT. Windows cannot move the starting boundary of a partition using built-in tools, so GParted Live is used to move C:.

The Windows Recovery Environment (WinRE) is normally stored in a recovery partition. In this article, recovery partition refers to the disk partition, while WinRE refers to the recovery environment stored in it.

Partition numbers can change during the procedure. Check the size, position, and type of each partition, and take care not to select the wrong target.

In GParted, move the NTFS partition containing C:. Do not attempt to move the unallocated space itself.

Pre-flight checks

Check WinRE

Open PowerShell as an administrator and check the location of the active WinRE installation.

reagentc /info

The output looks like this:

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Enabled
    Windows RE location:       \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: <environment-specific GUID>

REAGENTC.EXE: Operation Successful.

Confirm that Windows RE status is Enabled. In this example, Windows RE location shows that WinRE is on partition 4 of disk 0. Record the disk and partition numbers shown on your system.

Check the disk layout

Use DiskPart to inspect the OS disk. In the commands below, replace <OS disk number> with the number identified from reagentc /info and the disk capacity.

diskpart
list disk
select disk <OS disk number>
list partition
list volume
exit

list partition produces output similar to the following. Partition numbers and sizes vary by system.

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    System             100 MB  1024 KB
  Partition 2    Reserved            16 MB   101 MB
  Partition 3    Primary             99 GB   117 MB
  Partition 4    Recovery           700 MB    99 GB

Confirm that the partition recorded from reagentc /info has the type Recovery and is immediately after the Primary partition containing C:.

list volume produces output similar to the following:

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     C   Windows      NTFS   Partition     99 GB  Healthy    Boot
  Volume 1                      FAT32  Partition    100 MB  Healthy    System
  Volume 2                      NTFS   Partition    700 MB  Healthy    Hidden

The C: drive is the volume with C under Ltr, NTFS under Fs, and Boot under Info. The EFI system partition is shown as FAT32 and System. The MSR might not appear in list volume or Disk Management.

Check BitLocker

Check the BitLocker status of C:.

manage-bde -status C:

When the volume is fully decrypted, the output looks like this:

Volume C: [Windows]
[OS Volume]

    Size:                 <C: drive capacity>
    BitLocker Version:    None
    Conversion Status:    Fully Decrypted
    Percentage Encrypted: 0.0%
    Encryption Method:    None
    Protection Status:    Protection Off
    Lock Status:          Unlocked
    Key Protectors:       None Found

Confirm that Conversion Status is Fully Decrypted and Percentage Encrypted is 0.0%.

If the volume is encrypted, start decryption with the following commands:

manage-bde -off C:
manage-bde -status C:

While decryption is running, Conversion Status is shown as Decryption in Progress. Wait until it changes to Fully Decrypted.

Check the file system

Run an online NTFS scan.

chkdsk C: /scan

If no problems are found, the command ends with:

Windows has scanned the file system and found no problems.
No further action is required.

Confirm that these lines are displayed and that the command does not request a repair.

Procedure

Disable WinRE

Disable WinRE and check its status.

reagentc /disable
reagentc /info

Successful output looks like this:

REAGENTC.EXE: Operation Successful.

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Disabled
    Windows RE location:
    Boot Configuration Data (BCD) identifier: 00000000-0000-0000-0000-000000000000

REAGENTC.EXE: Operation Successful.

Confirm that Windows RE status is Disabled and Windows RE location is empty.

Next, verify that disabling WinRE returned the WinRE image to C:.

Get-Item -LiteralPath 'C:\Windows\System32\Recovery\Winre.wim' -Force |
    Format-List FullName,Length

If the file exists, its full path and size are displayed:

FullName : C:\Windows\System32\Recovery\Winre.wim
Length   : <environment-specific file size>

Confirm that FullName is C:\Windows\System32\Recovery\Winre.wim and that Length is greater than zero.

Delete the recovery partition

After confirming Winre.wim, delete the recovery partition immediately following C:. Delete the partition that was referenced by Windows RE location before WinRE was disabled.

Use detail partition to confirm that the selected partition is the recovery partition previously used by WinRE. Do not delete the EFI system partition, MSR, or C:.

diskpart
select disk <OS disk number>
list partition
select partition <recovery partition number>
detail partition
delete partition override
list partition
exit

Successful deletion produces:

DiskPart successfully deleted the selected partition.

The following list partition output no longer contains the Recovery partition.

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    System             100 MB  1024 KB
  Partition 2    Reserved            16 MB   101 MB
  Partition 3    Primary             99 GB   117 MB

At this point, the partition layout is:

[EFI][MSR][C:][Unallocated]

Shut down Windows.

Stop-Computer

Start GParted Live

Download a stable 64-bit GParted Live ISO named gparted-live-<version>-amd64.iso from the official GParted website.

For a virtual machine, attach the GParted Live ISO to its virtual CD/DVD drive through the virtualization platform. For a physical machine, create a bootable USB drive from the ISO.

With Windows fully shut down, select the ISO or USB drive from the UEFI boot menu. In the GParted Live menu, make the following selections:

  1. GParted Live (Default settings)
  2. The default keymap
  3. English
  4. Start the graphical environment

Move C: to the end of the disk

Start GParted and select the OS disk from the device selector in the upper-right corner. Compare its capacity and partition order with the information recorded in Windows.

[EFI FAT32][MSR][NTFS][Unallocated]

If C: is shown as bitlocker instead of ntfs, BitLocker decryption is not complete.

Right-click the NTFS partition containing C: and select Resize/Move. Enter:

Free space preceding: 1024 MiB
Free space following: 0 MiB
Align to: MiB

If the previous recovery partition was smaller than 1024 MiB, C: is reduced by the difference. The entire partition is moved to the right, leaving 1024 MiB of unallocated space before C:.

Select Resize/Move and confirm that the operation leaves 1024 MiB before C: and 0 MiB after it.

Select Apply All Operations and then Apply from the toolbar. Moving an NTFS partition can take some time. After the operation finishes, shut down GParted Live.

At this point, the partition layout is:

[EFI][MSR][Unallocated 1024 MiB][C: at end of disk]

Remove the GParted Live ISO or USB drive after the machine has shut down.

Check the unallocated space

Start Windows. If an automatic disk check begins, allow it to finish.

After signing in, open Disk Management and confirm that approximately 1 GB of unallocated space appears between the MSR and C:.

[EFI][MSR][Unallocated approximately 1 GB][C: at end of disk]

Create the recovery partition

Open PowerShell as an administrator and use DiskPart to create a 1 GB partition in the unallocated space.

diskpart
select disk <OS disk number>
list partition
create partition primary size=1024
format quick fs=ntfs label="Windows RE tools"
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac override
gpt attributes=0x8000000000000001
assign letter=R
list partition
exit

Successful commands produce the following messages:

DiskPart succeeded in creating the specified partition.

  100 percent completed

DiskPart successfully formatted the volume.
DiskPart successfully set the partition ID.
DiskPart successfully assigned the attributes to the selected GPT partition.
DiskPart successfully assigned the drive letter or mount point.

The final list partition output looks like this:

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    System             100 MB  1024 KB
  Partition 2    Reserved            16 MB   101 MB
  Partition 3    Recovery          1024 MB   117 MB
  Partition 4    Primary             99 GB  1141 MB

Confirm that the new partition has the type Recovery, a size of 1024 MB, and is immediately before the Primary partition containing C:.

Windows RE tools is the NTFS volume label. The subsequent set id and gpt attributes commands cause Windows to recognize the partition as a recovery partition.

At this point, the partition layout is:

[EFI][MSR][Recovery 1 GB][C: at end of disk]

Place the WinRE image

Copy the WinRE image to the new recovery partition.

New-Item -ItemType Directory -Path 'R:\Recovery\WindowsRE' -Force

Copy-Item `
  -LiteralPath 'C:\Windows\System32\Recovery\Winre.wim' `
  -Destination 'R:\Recovery\WindowsRE\Winre.wim' `
  -Force

Get-Item -LiteralPath 'R:\Recovery\WindowsRE\Winre.wim' -Force |
    Format-List FullName,Length

New-Item displays the directory it created. A successful Copy-Item command produces no output. The final Get-Item command displays:

FullName : R:\Recovery\WindowsRE\Winre.wim
Length   : <same file size as the source>

Confirm that FullName points to the destination and that Length matches the source Winre.wim.

Register WinRE

Register the copied WinRE image and enable it.

reagentc /setreimage /path R:\Recovery\WindowsRE
reagentc /enable
reagentc /info

Successful registration and activation produce:

Directory set to: \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE

REAGENTC.EXE: Operation Successful.

REAGENTC.EXE: Operation Successful.

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: <environment-specific GUID>

REAGENTC.EXE: Operation Successful.

Confirm that Windows RE status is Enabled. Also confirm that the partition number in Windows RE location matches the new 1 GB recovery partition.

Remove the drive letter

Remove the temporary drive letter from the recovery partition.

diskpart
select disk <OS disk number>
list partition
select partition <new 1 GB recovery partition number>
detail partition
remove letter=R
exit

Successful removal produces:

DiskPart successfully removed the drive letter or mount point.

Open File Explorer and confirm that drive R: is no longer displayed.

Verification

Start WinRE

Keep the virtual machine console or physical display open so that you can observe the next boot, and run:

reagentc /boottore
Restart-Computer

When reagentc /boottore succeeds, it displays:

REAGENTC.EXE: Operation Successful.

After the restart, confirm that the Windows Recovery Environment appears. Select Continue to return to Windows.

Check the system after Windows starts

After Windows starts, check WinRE and the file system.

reagentc /info
chkdsk C: /scan

Confirm the following two fields in the reagentc /info output:

Windows RE status:         Enabled
Windows RE location:       \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE

Confirm that chkdsk ends with:

Windows has scanned the file system and found no problems.
No further action is required.

Open Disk Management and confirm the final partition order.

[EFI][MSR][Recovery 1 GB][C: at end of disk]

Additional information

Recovery partition size

One gigabyte is not a fixed size mandated by Microsoft. Microsoft states that Winre.wim is typically 500–700 MB, and its custom-partition example recommends a partition of at least 990 MB with at least 250 MB of free space.

This procedure uses 1024 MiB to satisfy those recommendations and to keep the units used in GParted and DiskPart straightforward.

Microsoft’s standard recommendation is to place the recovery partition immediately after the Windows partition. This article prioritizes keeping C: at the physical end of the disk. If the recovery partition itself needs to be enlarged in the future, another partition move might be required.

Conclusion

GParted Live can move the starting boundary of C:, which Windows built-in tools cannot do. The key steps are to remove the old recovery partition, move C: to the right, and then place the recovery partition and WinRE in the space before C:.

Partition numbers can change during the procedure. Use list partition and detail partition to verify the size, type, and position of the selected target, and take care not to modify the wrong partition.

References