Skip to content

disk reformatting error #304

@heaivilin

Description

@heaivilin

Problem description

Having an issue with the StorageDSC 'DISK' command randomly reformatting drives after the initial formatting is completed.

After initial drive setup success on 7/8, 7 days later, on 7/15, the E drive reformatted without warning. This appears to be related to the DSC consistency check on the disk. The disk was expanded, but I wouldn't expect the DSC to reformat the disk on this expansion since I didn't specific a drive size. I'm not even sure where the drive sizes are coming from that it's complaining about.

Looking for the following:

  • Confirmation that this is indeed the reason for the refomatting.
  • if so, where are the drive sizes coming from.
  • what I need to do in my dsc config to prevent this in the future.

Appreciate the assistance

Verbose logs

{"time": "2025-07-15T14:33:48.008-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Resource ]  [[Disk]diskAdd_T]  "},
  {"time": "2025-07-15T14:33:48.008-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Test     ]  [[Disk]diskAdd_T]  "},
  {"time": "2025-07-15T14:33:48.008-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_T] Test-TargetResource: Testing disk with UniqueId '6000C29FA238E9FDF999831D6E7606DD' status for drive letter 'T'."},
  {"time": "2025-07-15T14:33:48.008-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_T] Test-TargetResource: Checking if disk with UniqueId '6000C29FA238E9FDF999831D6E7606DD' is initialized."},
  {"time": "2025-07-15T14:33:48.430-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_T] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT BlockSize from Win32_Volume WHERE DriveLetter = 'T:','queryDialect' = WQL,'namespaceName' = root\\cimv2'."},
  {"time": "2025-07-15T14:33:48.462-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_T] Operation 'Query CimInstances' complete."},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Test     ]  [[Disk]diskAdd_T]  in 0.6250 seconds."},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Skip   Set      ]  [[Disk]diskAdd_T]  "},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Resource ]  [[Disk]diskAdd_T]  "},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Resource ]  [[Disk]diskAdd_S]  "},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Test     ]  [[Disk]diskAdd_S]  "},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_S] Test-TargetResource: Testing disk with UniqueId '6000C29E2C602ABE0BDCB5C13BB4B85E' status for drive letter 'S'."},
  {"time": "2025-07-15T14:33:48.633-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_S] Test-TargetResource: Checking if disk with UniqueId '6000C29E2C602ABE0BDCB5C13BB4B85E' is initialized."},
  {"time": "2025-07-15T14:33:48.946-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_S] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT BlockSize from Win32_Volume WHERE DriveLetter = 'S:','queryDialect' = WQL,'namespaceName' = root\\cimv2'."},
  {"time": "2025-07-15T14:33:48.977-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_S] Operation 'Query CimInstances' complete."},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Test     ]  [[Disk]diskAdd_S]  in 0.5160 seconds."},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Skip   Set      ]  [[Disk]diskAdd_S]  "},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Resource ]  [[Disk]diskAdd_S]  "},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Resource ]  [[Disk]diskAdd_L]  "},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Test     ]  [[Disk]diskAdd_L]  "},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_L] Test-TargetResource: Testing disk with UniqueId '6000C299ACF0123791423510C7AD0F14' status for drive letter 'L'."},
  {"time": "2025-07-15T14:33:49.149-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_L] Test-TargetResource: Checking if disk with UniqueId '6000C299ACF0123791423510C7AD0F14' is initialized."},
  {"time": "2025-07-15T14:33:49.462-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_L] Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT BlockSize from Win32_Volume WHERE DriveLetter = 'L:','queryDialect' = WQL,'namespaceName' = root\\cimv2'."},
  {"time": "2025-07-15T14:33:49.477-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_L] Operation 'Query CimInstances' complete."},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Test     ]  [[Disk]diskAdd_L]  in 0.4840 seconds."},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Skip   Set      ]  [[Disk]diskAdd_L]  "},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Resource ]  [[Disk]diskAdd_L]  "},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Resource ]  [[Disk]diskAdd_E]  "},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Test     ]  [[Disk]diskAdd_E]  "},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Test-TargetResource: Testing disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' status for drive letter 'E'."},
  {"time": "2025-07-15T14:33:49.634-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Test-TargetResource: Checking if disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' is initialized."},
  {"time": "2025-07-15T14:33:49.931-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Test-TargetResource: Partition assigned to drive E has size 21455962112, which does not match expected size 21458042368."},
  {"time": "2025-07-15T14:33:49.931-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Test     ]  [[Disk]diskAdd_E]  in 0.2970 seconds."},
  {"time": "2025-07-15T14:33:49.931-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ Start  Set      ]  [[Disk]diskAdd_E]  "},
  {"time": "2025-07-15T14:33:49.931-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Setting disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' status for drive letter 'E'."},
  {"time": "2025-07-15T14:33:50.009-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Checking disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' partition style."},
  {"time": "2025-07-15T14:33:50.009-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Clearing disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' of all existing partitions and volumes."},
  {"time": "2025-07-15T14:33:52.775-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Initializing disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' as 'GPT'."},
  {"time": "2025-07-15T14:33:53.134-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' does not contain a partition assigned to drive letter 'E'."},
  {"time": "2025-07-15T14:33:53.134-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' already contains partitions, but size parameter is not specified."},
  {"time": "2025-07-15T14:33:53.150-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Creating partition on disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' with drive letter 'E' using all free space."},
  {"time": "2025-07-15T14:33:53.337-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: New partition '2' on disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' is readonly. Waiting for it to become writable."},
  {"time": "2025-07-15T14:33:54.431-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: New partition '2' on disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' is readonly. Waiting for it to become writable."},
  {"time": "2025-07-15T14:33:55.527-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: New partition '2' on disk with UniqueId '6000C29647B93F764D0BC8E01FB30EED' is readonly. Waiting for it to become writable."},
  {"time": "2025-07-15T14:33:56.840-5:00", "type": "verbose", "message": "[AP35SABODB02]:                            [[Disk]diskAdd_E] Set-TargetResource: Formatting the volume as 'NTFS'."},
  {"time": "2025-07-15T14:33:59.793-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Set      ]  [[Disk]diskAdd_E]  in 9.8630 seconds."},
  {"time": "2025-07-15T14:33:59.793-5:00", "type": "verbose", "message": "[AP35SABODB02]: LCM:  [ End    Resource ]  [[Disk]diskAdd_E]  "},

DSC configuration

node $AllNodes.NodeName {
  foreach ($disk in $OnlineDisk.GetEnumerator()) { 
	## we only want to do something to the SQL Disks, not anything else.  would be bad if we formatted the C drive as an exmaple.  :)
	if ($SQLDriveLetters.Contains($disk.name)) 	{
		disk "diskValidate_$($disk.name)" {
			 DiskIDType = 'UniqueID'
			 DiskId = "$($disk.Value)"
			 DriveLetter = "$($disk.Name)"
			 FSFormat = 'NTFS'
			 AllocationUnitSize = 64KB
			 FSLabel = $SQLDriveLetters[$($disk.name)]
			 AllowDestructive = $true
		}
	}
	$SQLDriveLetters.Remove($disk.name)
  }
}

## Now that we've gone throught he online disks, let's handle any offline disk if we still have drive letters to handle
node $AllNodes.NodeName {
  foreach ($disk in $OfflineDisk) {
   if ($SQLDriveLetters.Contains('E')) {$DriveLetter = 'E'}
   if ($SQLDriveLetters.Contains('L')) {$DriveLetter = 'L'}
   if ($SQLDriveLetters.Contains('S')) {$DriveLetter = 'S'}
   if ($SQLDriveLetters.Contains('T')) {$DriveLetter = 'T'}
   
   disk "diskAdd_$DriveLetter" {
		DiskIDType = 'UniqueID'
		DiskId = "$($Disk.UniqueID)"
		DriveLetter = "$DriveLetter"
		PartitionStyle = 'GPT'
		FSFormat = 'NTFS'
		AllocationUnitSize = 64KB
		FSLabel = $SQLDriveLetters[$DriveLetter]
		AllowDestructive = $true
		ClearDisk = $true
   }
   $SQLDriveLetters.Remove($DriveLetter)
  }
}

Suggested solution

no suggested solutions at this time as I'm not even sure it's the issue and if so, why it's an issue.

Operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17763.7434
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.7434
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

StorageDsc version

Name       Version Path
----       ------- ----
StorageDsc 6.0.0   C:\Program Files\WindowsPowerShell\Modules\StorageDsc\6.0.0\StorageDsc.psd1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions