Commands to find the free space within the EFI and Recovery partitions


zbook

Well-known member
Guru
VIP
Local time
5:26 AM
Posts
5,679
OS
Windows 10
When troubleshooting Windows upgrade failures the failure log files may report blocks due to deficient free space.

There may deficient space errors in one or more of these partitions:

EFI
system-reserved-partition
Primary
Recovery

The deficient space for the error message we-couldn-t-update-system-reserved-partition is frequently 3 MB.



Diskpart is useful for the primary partition.


What commands can be used before an upgrade attempt to determine the free space (MB) for each of these partitions?

EFI
system-reserved-partition
Recovery
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
The Notebook I'm on now has 4 partitions and small unallocated space, DM gives space info only for 3 of the partitions. Some of the small partitions do not allow user access to them.

1741050506211.webp
When needing to manipulate them I do it by booting a Linux Mint LiveUSB and using the included GPARTED program to make resize changes without losing data.
 

My Computers

System One System Two

  • OS
    Win11 Pro RTM Version 24H2 Build 26100.4202
    Computer type
    Laptop
    Manufacturer/Model
    Dell Vostro 3400
    CPU
    Intel Core i5 11th Gen. 2.40GHz
    Memory
    12GB
    Hard Drives
    256GB SSD NVMe M.2
  • Operating System
    Win11 Pro RTM Version 24H2 Build 26100.4202
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Vostro 5890
    CPU
    Intel Core i5 10th Gen. 2.90GHz
    Memory
    16GB
    Graphics card(s)
    Onboard, no VGA, using a DisplayPort-to-VGA adapter
    Monitor(s) Displays
    24" Dell
    Hard Drives
    512GB SSD NVMe, 4TB Seagate HDD
    Browser
    Firefox, Edge
    Antivirus
    Windows Defender/Microsoft Security
You could use this to get partitions, then use the GPT types to get space information for each one.

Powershell:
Get-Partition | Format-Table -AutoSize -Property @('DiskNumber', 'Type', 'GptType', 'Guid')

Get-Partition | Where-Object { $_.GptType -eq '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' } | Get-Volume | Format-Table -AutoSize -Property @('Size', 'SizeRemaining')
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4351]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
There are scripts such as healthcheck and whynotwin 11 that can be used for screening.

However these do not check free space.

I'm looking for commands to check the partition free space before the upgrades.
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
Which numbers are for the free space for each

system-reserved-partition
Primary
Recovery





Code:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\WINDOWS\system32> Get-Partition | Format-Table -AutoSize -Property @('DiskNumber', 'Type', 'GptType', 'Guid')

DiskNumber Type     GptType                                Guid
---------- ----     -------                                ----
         0 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac} {d7da621b-1b7b-416c-bd23-49efbe24b66a}
         0 System   {c12a7328-f81f-11d2-ba4b-00a0c93ec93b} {0080d238-4ff5-42f9-bf68-9b9c80f5c2a1}
         0 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae} {1e5456a1-7daf-43d9-9ac1-e014c63f4f82}
         0 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} {16d3a9d3-9279-435b-9141-c65a6520f8d1}
         0 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac} {f22829ed-1f6d-4638-8b3f-8602d8a2a5f8}


PS C:\WINDOWS\system32> Get-Partition | Where-Object { $_.GptType -eq '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' } | Get-Volume | Format-Table -AutoSize -Property @('Size', 'SizeRemaining')

     Size SizeRemaining
     ---- -------------
100663296      17553408


PS C:\WINDOWS\system32>
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
This is a little better...


Powershell:
Get-Partition | Format-Table -AutoSize -Property @('DiskNumber', 'Type', 'GptType', @{Name = 'SizeRemaining'; Expr = { (Get-Volume -UniqueId "\\?\Volume$($_.Guid)\").SizeRemaining }}, @{Name = 'Size'; Expr = { (Get-Volume -UniqueId "\\?\Volume$($_.Guid)\").Size }})

Code:
DiskNumber Type     GptType                                SizeRemaining Size
---------- ----     -------                                ------------- ----
         0 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}
         0 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} 1866624196608 2000381014016
         1 System   {c12a7328-f81f-11d2-ba4b-00a0c93ec93b} 233250816     268435456
         1 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}
         1 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} 900102602752  998762344448
         1 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac} 313319424     1033891840
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4351]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
can the results be reported in specific units?

MB or GB?
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
Powershell:
Get-Partition | Format-Table -AutoSize -Property @('DiskNumber', 'Type', 'GptType', @{Name = 'SizeRemainingGB'; Expr = { (Get-Volume -UniqueId "\\?\Volume$($_.Guid)\").SizeRemaining / 1GB }; FormatString = "{0:N2}"}, @{Name = 'SizeGB'; Expr = { (Get-Volume -UniqueId "\\?\Volume$($_.Guid)\").Size / 1GB }; FormatString = "{0:N2}"})

Code:
DiskNumber Type     GptType                                SizeRemainingGB SizeGB
---------- ----     -------                                --------------- ------
         0 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}
         0 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} 1,738.43        1,863.00
         1 System   {c12a7328-f81f-11d2-ba4b-00a0c93ec93b} 0.22            0.25
         1 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}
         1 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} 838.28          930.17
         1 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac} 0.29            0.96
 

My Computer

System One

  • OS
    Windows 11 Pro 24H2 [rev. 4351]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Intel NUC12WSHi7
    CPU
    12th Gen Intel Core i7-1260P, 2100 MHz
    Motherboard
    NUC12WSBi7
    Memory
    64 GB
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    built-in Realtek HD audio
    Monitor(s) Displays
    Dell U3219Q
    Screen Resolution
    3840x2160 @ 60Hz
    Hard Drives
    Samsung SSD 990 PRO 1TB
    Keyboard
    CODE 104-Key Mechanical with Cherry MX Clears
    Antivirus
    Microsoft Defender
Sorry, it's not a one-liner...
Code:
function DiskSize {
    param ([uint64]$Number)

    if ($Number -ge 1GB) { return ('{0:f2} GB' -f ($Number/1GB)) }
    if ($Number -ge 1MB) { return ('{0:f2} MB' -f ($Number/1MB)) }
    return ('{0:f1} KB' -f ($Number/1KB))
}

$SystemDisk = (Get-Disk | Where-Object {$_.IsSystem -eq $true}).Number
"Disk $SystemDisk (System Disk)"

Get-Partition -DiskNumber $SystemDisk |% {
    $Volume = Get-Volume -UniqueId "\\?\Volume$($_.Guid)\"

    [PSCustomObject]@{
        Partition = $_.PartitionNumber
        Type = $_.Type
        FileSystem = $(if ($_.Type -eq 'Reserved') { 'FAT32' } else { $Volume.FileSystemType })
        Health = $Volume.HealthStatus
        Status = $Volume.OperationalStatus
        Free = $(if ($_.Type -ne 'Reserved') { DiskSize $Volume.SizeRemaining } else { $null })
        Size = DiskSize $_.Size
    }
} | Format-Table -Property @{Label='Partition';Expression={$_.Partition};Alignment='Left'},Type,FileSystem,Health,Status,@{Label='Free';Expression={$_.Free};Alignment='Right'},@{Label='Size';Expression={$_.Size};Alignment='Right'}

Code:
Disk 0 (System Disk)

Partition Type     FileSystem Health  Status      Free      Size
--------- ----     ---------- ------  ------      ----      ----
1         System   FAT32      Healthy OK     222.54 MB 260.00 MB
2         Reserved FAT32                                16.00 MB
3         Recovery NTFS       Healthy OK     174.69 MB 700.00 MB
4         Basic    NTFS       Healthy OK      19.06 GB  53.04 GB
 

My Computer

System One

  • OS
    Windows 7
Code:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\WINDOWS\system32> function DiskSize {
>>     param ([uint64]$Number)
>>
>>     if ($Number -ge 1GB) { return ('{0:f2} GB' -f ($Number/1GB)) }
>>     if ($Number -ge 1MB) { return ('{0:f2} MB' -f ($Number/1MB)) }
>>     return ('{0:f1} KB' -f ($Number/1KB))
>> }
>>
>> $SystemDisk = (Get-Disk | Where-Object {$_.IsSystem -eq $true}).Number
>> "Disk $SystemDisk (System Disk)"
>>
>> Get-Partition -DiskNumber $SystemDisk |% {
>>     $Volume = Get-Volume -UniqueId "\\?\Volume$($_.Guid)\"
>>
>>     [PSCustomObject]@{
>>         Partition = $_.PartitionNumber
>>         Type = $_.Type
>>         FileSystem = $(if ($_.Type -eq 'Reserved') { 'FAT32' } else { $Volume.FileSystemType })
>>         Health = $Volume.HealthStatus
>>         Status = $Volume.OperationalStatus
>>         Free = $(if ($_.Type -ne 'Reserved') { DiskSize $Volume.SizeRemaining } else { $null })
>>         Size = DiskSize $_.Size
>>     }
>> } | Format-Table -Property @{Label='Partition';Expression={$_.Partition};Alignment='Left'},Type,FileSystem,Health,Status,@{Label='Free';Expression={$_.Free};Alignment='Right'},@{Label='Size';Expression={$_.Size};Alignment='Right'}
Disk 0 (System Disk)

Partition Type     FileSystem Health  Status      Free      Size
--------- ----     ---------- ------  ------      ----      ----
1         Recovery NTFS       Healthy OK     434.60 MB 450.00 MB
2         System   FAT32      Healthy OK      16.74 MB 100.00 MB
3         Reserved FAT32                                16.00 MB
4         Basic    NTFS       Healthy OK      34.64 GB 237.05 GB
5         Recovery NTFS       Healthy OK     244.52 MB 885.00 MB


PS C:\WINDOWS\system32>
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
EFI 0.22 or 16.74 MB

Recovery 0.29 or 244.52 MB
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
So basically you want to check the currently active partitions (via BCD) if there's more than one created?
 

My Computer

System One

  • OS
    Windows 7
If an upgrade is attempted and fails the failure may be identified in the failure log files.

Code:
2025-02-18 08:35:28, Info                  CONX   CFreeSystemPartitionDiskSpaceChecker: checked InsufficientSystemPartitionDiskSpace, found HardBlock.Not enough space on partition [\\?\GLOBALROOT\Device\HarddiskVolume1\] Required: 15 MB. Available: 12 MB.

This was insufficient by 3 MB.

If the partition size free spaces was able to be checked before upgrades there may be reduced upgrade failures.

So I'm looking for methods to check the free space in the four default partitions.
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
Powershell:
Get-Partition | Format-Table -AutoSize -Property @('DiskNumber', 'Type', 'GptType', @{Name = 'SizeRemainingGB'; Expr = { (Get-Volume -UniqueId "\\?\Volume$($_.Guid)\").SizeRemaining / 1GB }; FormatString = "{0:N2}"}, @{Name = 'SizeGB'; Expr = { (Get-Volume -UniqueId "\\?\Volume$($_.Guid)\").Size / 1GB }; FormatString = "{0:N2}"})

Code:
DiskNumber Type     GptType                                SizeRemainingGB SizeGB
---------- ----     -------                                --------------- ------
         0 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}
         0 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} 1,738.43        1,863.00
         1 System   {c12a7328-f81f-11d2-ba4b-00a0c93ec93b} 0.22            0.25
         1 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}
         1 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7} 838.28          930.17
         1 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac} 0.29            0.96

If there are thread upgrade failure I'll see if command results and failure logs are available.

For garlin I'd like to try the same but I'm wondering if OP will copy and paste the script?
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
I updated the script to allow you to define a Minimum Free (space) threshold for System, Windows and Recovery volumes. Don't see the point of checking Reserved since almost nobody tampers with it (except by accident).

Code:
$MinFree_System = 1GB
$MinFree_Windows = 100GB
$MinFree_Recovery = 1GB

function DiskSize {
    param ([uint64]$Number)

    if ($Number -ge 1GB) { return ('{0:f2} GB' -f ($Number/1GB)) }
    if ($Number -ge 1MB) { return ('{0:f2} MB' -f ($Number/1MB)) }
    return ('{0:f1} KB' -f ($Number/1KB))
}

$SystemDisk = (Get-Disk | Where-Object {$_.IsSystem -eq $true}).Number
"Disk $SystemDisk (System Disk)"

$BootVolume = (Get-WmiObject Win32_Volume | Where-Object {$_.BootVolume}).DeviceID
$RecoveryVolume = reagentc /info | Select-String 'RE location'

Get-Partition -DiskNumber $SystemDisk |% {
    $Volume = Get-Volume -UniqueId "\\?\Volume$($_.Guid)\"

    [PSCustomObject]@{
        Partition = $_.PartitionNumber
        Type = $_.Type
        FileSystem = $(if ($_.Type -eq 'Reserved') { 'FAT32' } else { $Volume.FileSystemType })
        Health = $Volume.HealthStatus
        Status = $Volume.OperationalStatus
        Free = $(if ($_.Type -ne 'Reserved') { DiskSize $Volume.SizeRemaining } else { $null })
        Size = DiskSize $_.Size
        Active = $(switch ($_.Type) {
                'Basic' { if ($BootVolume -match $_.Guid) { '*' } }
                'Recovery' { if ($RecoveryVolume -match $_.Guid) { '*' } }
            }
        )
        Comments = $(switch ($_.Type) {
                'System' { if ($Volume.SizeRemaining -lt $MinFree_System) { "Requires $(DiskSize $MinFree_System) free to update" } }
                'Basic' { if ($BootVolume -match $_.Guid -and $Volume.SizeRemaining -lt $MinFree_Windows) { "Requires $(DiskSize $MinFree_Windows) free to update" } }
                'Recovery' { if ($Volume.SizeRemaining -lt $MinFree_Recovery) { "Requires $(DiskSize $MinFree_Recovery) free to update" } }
            }
        )
    }
} | Format-Table -Property @{Label='Partition';Expression={$_.Partition};Alignment='Right'},@{Label='Active';Expression={$_.Active};Alignment='Right'},`Type,FileSystem,`
Health,Status,@{Label='Volume Free';Expression={$_.Free};Alignment='Right'},@{Label='Volume Size';Expression={$_.Size};Alignment='Right'},Comments -AutoSize

Right now the minimum space thresholds are set as too large, to better demonstrate the free space checks. Adjust the first 3 variables as needed.
Code:
Disk 0 (System Disk)

Partition Active Type     FileSystem Health  Status Volume Free Volume Size Comments                         
--------- ------ ----     ---------- ------  ------ ----------- ----------- --------                         
        1        System   FAT32      Healthy OK       222.54 MB   260.00 MB Requires 1.00 GB free to update  
        2        Reserved FAT32                                    16.00 MB                                  
        3      * Recovery NTFS       Healthy OK       174.69 MB   700.00 MB Requires 1.00 GB free to update  
        4      * Basic    NTFS       Healthy OK        18.97 GB    53.04 GB Requires 100.00 GB free to update
 

My Computer

System One

  • OS
    Windows 7
Powershell:
[console]::WindowWidth=180;[console]::WindowHeight=40;[console]::BufferWidth=[console]::WindowWidth

$Kernel32=Add-Type -Name 'Kernel32' -Namespace '' -PassThru -MemberDefinition @"
  [DllImport("kernel32")]
  public static extern int QueryDosDevice(string name, System.Text.StringBuilder path, int pathMaxLength);
"@
$GetDevicePath={
  $DevicePath=New-Object System.Text.StringBuilder(255)
  $Kernel32::QueryDosDevice($_.UniqueId.TrimStart('\\?\').TrimEnd('\'),$DevicePath,$DevicePath.Capacity)|Out-Null
  $DevicePath}
$v=(Get-Volume|select UniqueId,FileSystemLabel,@{n='DevicePath';e=$GetDevicePath},SizeRemaining)
$arr1=
  @{n='DevicePath ==> Guid';e={}},
  @{n='AccessPaths';e={}},
  @{n='Offset';e={}},
  @{n='Size (B)';e={}},
  @{n='Size';e={}},
  @{n='D';e={}},
  @{n='P';e={}},
  @{n='Type';e={}},
  @{n='L';e={}},
  @{n='VolLabel';e={}}
$arr4=@()+$arr1
$arr1[0]=@{n='DevicePath ==> Guid';e={"  $($d) ==>"}}
$arr4[1]=@{n='AccessPaths';e={$b}}
$arr2=
  @{n='DevicePath ==> Guid';e={if($p.Guid -eq $null){'none'}else{$p.Guid}}},
  @{n='AccessPaths';e={}},
  @{n='Offset';e={$p.Offset}},
  @{n='Size (B)';e={$p.Size}},
  @{n='Size';e={
    $decimalPlaces=2
    $scaledSize=switch($p.Size){
      {$_ -ge 1pb}{$_/1pb;$suffix='PB';break}
      {$_ -ge 1tb}{$_/1tb;$suffix='TB';break}
      {$_ -ge 1gb}{$_/1gb;$suffix='GB';break}
      {$_ -ge 1mb}{$_/1mb;$suffix='MB';break}
      {$_ -ge 1kb}{$_/1kb;$suffix='KB';break}
      default{$_;$suffix='B';$decimalPlaces=0}}
    "{0:N${decimalPlaces}} $suffix" -f $scaledSize}},
  @{n='D';e={$p.DiskNumber}},
  @{n='P';e={$p.PartitionNumber}},
  @{n='Type';e={$p.Type}},
  @{n='L';e={$p.DriveLetter}},
  @{n='VolLabel';e={}}
$arr3=@()+$arr2
$arr2[1]=@{n='AccessPaths';e={$a[0]}}
$arr2[9]=@{n='VolLabel';e={$l}}
(Get-Partition|%{
  $a=$_.AccessPaths;$d='';$l='';$p=$_
  $a|%{$av=$_;$v|%{if($_.UniqueId -eq $av){$l=$_.FileSystemLabel;$d=$_.DevicePath;$f=$_.SizeRemaining}}}

  if($d -eq ''){
    $DevicePath=New-Object System.Text.StringBuilder(255)
    $a|%{if($_){$Kernel32::QueryDosDevice($_.TrimStart('\\?\').TrimEnd('\'),$DevicePath,$DevicePath.Capacity)|Out-Null;$d=$DevicePath}}
  }

  if($d -ne '') {$p|select $arr1}
  if($a.Count -gt 0){$p|select $arr2} else {$p|select $arr3}
  if($a.Count -gt 1){$i=2;$a|select -Skip 1|%{$b=$_;$p|select $arr4;$i++}}
  $decimalPlaces=2
  $scaledSize=switch($f){
    {$_ -ge 1pb}{$_/1pb;$suffix='PB';break}
    {$_ -ge 1tb}{$_/1tb;$suffix='TB';break}
    {$_ -ge 1gb}{$_/1gb;$suffix='GB';break}
    {$_ -ge 1mb}{$_/1mb;$suffix='MB';break}
    {$_ -ge 1kb}{$_/1kb;$suffix='KB';break}
    {$_ -eq $null}{$null;$suffix='N/A ';break}
    default{$_;$suffix='B';$decimalPlaces=0}}
  "  Free space: {0} ({1:N${decimalPlaces}} $suffix)`r`n" -f $f,$scaledSize
}|ft -Wrap -Auto|Out-String -Width 4095).TrimEnd()|Tee-Object "$((Get-Location).Path)\list partitions.txt"
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
Results today:

hdmi


Code:
DevicePath ==> Guid                    AccessPaths                                       Offset       Size (B)     Size      D P Type     L VolLabel
-------------------                    -----------                                       ------       --------     ----      - - ----     - --------
  \Device\HarddiskVolume1 ==>
{d7da621b-1b7b-416c-bd23-49efbe24b66a} P:\                                               1048576      471859200    450.00 MB 0 1 Recovery P Recovery
                                       \\?\Volume{d7da621b-1b7b-416c-bd23-49efbe24b66a}\
  Free space: 455708672 (434.60 MB)

  \Device\HarddiskVolume2 ==>
{0080d238-4ff5-42f9-bf68-9b9c80f5c2a1} \\?\Volume{0080d238-4ff5-42f9-bf68-9b9c80f5c2a1}\ 472907776    104857600    100.00 MB 0 2 System
  Free space: 455708672 (434.60 MB)

{1e5456a1-7daf-43d9-9ac1-e014c63f4f82}                                                   577765376    16777216     16.00 MB  0 3 Reserved
  Free space: 455708672 (434.60 MB)

  \Device\HarddiskVolume4 ==>
{16d3a9d3-9279-435b-9141-c65a6520f8d1} C:\                                               594542592    254535772672 237.05 GB 0 4 Basic    C
                                       \\?\Volume{16d3a9d3-9279-435b-9141-c65a6520f8d1}\
  Free space: 38682079232 (36.03 GB)

  \Device\HarddiskVolume5 ==>
{f22829ed-1f6d-4638-8b3f-8602d8a2a5f8} Q:\                                               255131123712 927989760    885.00 MB 0 5 Recovery Q
                                       \\?\Volume{f22829ed-1f6d-4638-8b3f-8602d8a2a5f8}\
  Free space: 256401408 (244.52 MB)




pseymour


Code:
DiskNumber Type     GptType                                SizeRemainingGB SizeGB
---------- ----     -------                                --------------- ------
         0 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac}            0.42   0.44
         0 System   {c12a7328-f81f-11d2-ba4b-00a0c93ec93b}            0.00   0.00
         0 Reserved {e3c9e316-0b5c-4db8-817d-f92df00215ae}            0.00   0.00
         0 Basic    {ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}           36.02 237.05
         0 Recovery {de94bba4-06d1-4d40-a16a-bfd50179d6ac}            0.24   0.86




garlin


Code:
Disk 0 (System Disk)
REAGENTC.EXE: Operation failed: 5

REAGENTC.EXE: An error has occurred.


Partition Active Type     FileSystem Health  Status Volume Free Volume Size Comments
--------- ------ ----     ---------- ------  ------ ----------- ----------- --------
        1        Recovery NTFS       Healthy OK       434.60 MB   450.00 MB Requires 1.00 GB free to update
        2        System                                  0.0 KB   100.00 MB Requires 1.00 GB free to update
        3        Reserved FAT32                                    16.00 MB
        4      * Basic    NTFS       Healthy OK        36.02 GB   237.05 GB Requires 100.00 GB free to update
        5        Recovery NTFS       Healthy OK       244.52 MB   885.00 MB Requires 1.00 GB free to update
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
When troubleshooting Windows upgrade failures the failure log files may report blocks due to deficient free space.

There may deficient space errors in one or more of these partitions:

EFI
system-reserved-partition
Primary
Recovery

The deficient space for the error message we-couldn-t-update-system-reserved-partition is frequently 3 MB.



Diskpart is useful for the primary partition.


What commands can be used before an upgrade attempt to determine the free space (MB) for each of these partitions?

EFI
system-reserved-partition
Recovery
I cheat and use MiniTool Partition Wizard. I'm at the stage in my life that I prefer to do it the easy way.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    PowerSpec B746
    CPU
    Intel Core i7-10700K
    Motherboard
    ASRock Z490 Phantom Gaming 4/ax
    Memory
    16GB (8GB PC4-19200 DDR4 SDRAM x2)
    Graphics Card(s)
    NVIDIA GeForce GTX 1050 TI
    Sound Card
    Realtek Audio
    Monitor(s) Displays
    #1. LG ULTRAWIDE 34" #2. AOC Q32G2WG3 32"
    Screen Resolution
    #1. 3440 X 1440 #2. 1920 x 1080
    Hard Drives
    NVMe WDC WDS100T2B0C-00PXH0 1TB
    Samsung SSD 860 EVO 1TB
    PSU
    750 Watts (62.5A)
    Case
    PowerSpec/Lian Li ATX 205
    Keyboard
    Logitech K270
    Mouse
    Logitech M185
    Browser
    Microsoft Edge and Firefox
    Antivirus
    ESET Internet Security
  • Operating System
    Windows 11 Canary Channel
    Computer type
    PC/Desktop
    Manufacturer/Model
    PowerSpec G156
    CPU
    Intel Core i5-8400 CPU @ 2.80GHz
    Motherboard
    AsusTeK Prime B360M-S
    Memory
    16 MB DDR 4-2666
    Monitor(s) Displays
    23" Speptre HDMI 75Hz
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 970 EVO 500GB NVMe
    Keyboard
    Logitek K270
    Mouse
    Logitek M185
    Browser
    Firefox, Edge and Edge Canary
    Antivirus
    Windows Defender
After a failed upgrade the typical computer user has no idea what caused the failure and needs troubleshooting help.

Collecting applicable hidden log files can be done.

Interpreting them can be and often is challenging.


The free space checking before an upgrade attempt is very common on C:.


Free space in the EFI and Recovery partitions are rarely checked.

These are typically checked after upgrade failures.

If these can be easily checked before upgrading then there could be fewer upgrade failures.


Desired free space before an upgrade attempt:
Primary partition: at least 20 GB; prefer > 25 - 30 GB
EFI partition: at least 15 MB; prefer > 20 - 25 MB
Recovery partition: 100MB; prefer > 200 MB


Using MiniTool Partition Wizard assumes that you've interpreted the error code and / or message or upgrade failure logs and you know how to relocate and widen partitions when there is no nearby unallocated space.

The above is to be preemptive. This way a computer user can open a thread before an upgrade and ask for help perhaps with MiniTool Partition Wizard.
They wouldn't have to find help to find and interpret failed upgrade log files.
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
    Motherboard
    Product : 190A Version : KBC Version 94.56
    Memory
    16 GB Total: Manufacturer : Samsung MemoryType : DDR3 FormFactor : SODIMM Capacity : 8GB Speed : 1600
    Graphics Card(s)
    NVIDIA Quadro K3100M; Intel(R) HD Graphics 4600
    Sound Card
    IDT High Definition Audio CODEC; PNP Device ID HDAUDIO\FUNC_01&VEN_111D&DEV_76E0
    Hard Drives
    Model Hitachi HTS727575A9E364
    Antivirus
    Microsoft Defender
    Other Info
    Mobile Workstation
Error 5 will happen when you're not running as Admin.
Code:
C:\Users\GARLIN>reagentc /info
This command can only be executed from an elevated command prompt.

REAGENTC.EXE: Operation failed: 5

REAGENTC.EXE: An error has occurred.

Code:
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
    Start-Process powershell -ArgumentList "-nop -ep bypass -NoLogo -NoExit -f $($MyInvocation.MyCommand.Path)" -Verb RunAs
    exit 0
}

$MinFree_System = 20MB
$MinFree_Windows = 25GB
$MinFree_Recovery = 200MB

function DiskSize {
    param ([uint64]$Number)

    if ($Number -ge 1TB) { return ('{0:f2} TB' -f ($Number / 1TB)) }
    if ($Number -ge 1GB) { return ('{0:f2} GB' -f ($Number / 1GB)) }
    if ($Number -ge 1MB) { return ('{0:f1} MB' -f ($Number / 1MB)) }
    return ('{0:f1} KB' -f ($Number / 1KB))
}

$SystemDisk = (Get-Disk | Where-Object {$_.IsSystem -eq $true}).Number
$WinRE_Location = reagentc /info | Select-String 'RE location'

if ($WinRE_Location -match '(.+)(harddisk)(\d+)(\\)(partition)(\d+)(.+)') {
    $WinRE_Disk = $Matches[3]
    $WinRE_Partition = $Matches[6]
}

foreach ($Disk in (Get-Disk).Number) {
    "Disk ${Disk}:"
    $BootVolume = (Get-WmiObject Win32_Volume | Where-Object {$_.BootVolume}).DeviceID

    Get-Partition -DiskNumber $Disk | foreach {
        $Partition = $_.PartitionNumber
        $DriveLetter = $_.DriveLetter
        $GUID = $_.Guid

        $Volume = Get-Volume -UniqueId "\\?\Volume$($GUID)\"

        [PSCustomObject]@{
            Partition = $Partition
            Type = $_.Type
            Drive = $(if ($DriveLetter -match '[A-Z]') { $DriveLetter + ':' } else { $null })
            FileSystem = $(if ($_.Type -eq 'Reserved') { 'FAT32' } else { $Volume.FileSystemType })
            Health = $Volume.HealthStatus
            Status = $Volume.OperationalStatus
            Free = $(if ($_.Type -ne 'Reserved') { DiskSize $Volume.SizeRemaining } else { $null })
            Size = DiskSize $_.Size
            Active = $(
                switch ($_.Type) {
                    'System' { if ($Disk -eq $SystemDisk) {'*'} }
                    'Basic' { if ($BootVolume -match $GUID) {'*'} }
                    'Recovery' { if (($WinRE_Disk -eq $SystemDisk) -and ($Partition -eq $WinRE_Partition)) {'*'} }
                }
            )
            Comments = $(
                switch ($_.Type) {
                    'System' { if ($Volume.SizeRemaining -lt $MinFree_System) {
                            "Requires $(DiskSize $MinFree_System) free to update"
                        }
                    }
                    'Basic' { if (($BootVolume -match $GUID) -and ($Volume.SizeRemaining -lt $MinFree_Windows)) {
                            "Requires $(DiskSize $MinFree_Windows) free to update"
                        }
                    }
                    'Recovery' { if (($WinRE_Disk -eq $SystemDisk) -and ($Partition -eq $WinRE_Partition) -and ($Volume.SizeRemaining -lt $MinFree_Recovery)) {
                            "Requires $(DiskSize $MinFree_Recovery) free to update"
                        }
                    }
                }
            )
        }
    } | Format-Table -Property @{Label='Partition';Expression={$_.Partition};Alignment='Right'},@{Label='Drive';Expression={$_.Drive};Alignment='Right'},`
            Type,FileSystem,@{Label='Active';Expression={$_.Active}},Health,Status,@{Label='Volume Free';Expression={$_.Free};Alignment='Right'},`
            @{Label='Volume Size';Expression={$_.Size};Alignment='Right'},Comments -AutoSize
}
Code:
Disk 0:

Partition Drive Type     FileSystem Active Health  Status Volume Free Volume Size Comments                        
--------- ----- ----     ---------- ------ ------  ------ ----------- ----------- --------                        
        1       System   FAT32      *      Healthy OK        222.5 MB    260.0 MB                                 
        2       Reserved FAT32                                            16.0 MB                                 
        3       Recovery NTFS       *      Healthy OK        174.7 MB    700.0 MB Requires 200.0 MB free to update
        4    C: Basic    NTFS       *      Healthy OK        19.80 GB    52.30 GB Requires 25.00 GB free to update
        5    E: Basic    NTFS              Healthy OK        345.6 MB    359.0 MB                                 
        6       Recovery NTFS              Healthy OK        386.2 MB    400.0 MB                                 


Disk 1:

Partition Drive Type     FileSystem Active Health  Status Volume Free Volume Size Comments
--------- ----- ----     ---------- ------ ------  ------ ----------- ----------- --------
        1       Reserved FAT32                                            16.0 MB         
        2    F: Basic    NTFS              Healthy OK         1.56 GB     1.98 GB
 

My Computer

System One

  • OS
    Windows 7
Back
Top Bottom