Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk with Number 'X' is already initialized with MBR. #165

Open
cmptscpeacock opened this issue Aug 31, 2018 · 34 comments
Open

Disk with Number 'X' is already initialized with MBR. #165

cmptscpeacock opened this issue Aug 31, 2018 · 34 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@cmptscpeacock
Copy link

Hi,

I'm using this DSC to deploy an Azure VM from an ARM template:

Import-DscResource -ModuleName StorageDsc, xComputerManagement, xNetworking

Node localhost
{

    LocalConfigurationManager
    {
        RebootNodeIfNeeded = $true
        ConfigurationMode = "ApplyOnly"
    }

    WaitForDisk Disk2
    {
        DiskId = 2
        RetryIntervalSec =$RetryIntervalSec
        RetryCount = $RetryCount
    }

    Disk ADDataDisk {
        DiskId = 2
        DriveLetter = "F"
        DependsOn = "[WaitForDisk]Disk2"
    }	

The first time it deploys fine. If you redeploy over the top I get the following. Is it a bug? By design? I don't want to initialise the disks once they've been done so it should skip really:

"message": "VM has reported a failure when processing extension 'mfa'. Error message: "DSC Configuration 'XXX' completed with error(s). Following are the first few: PowerShell DSC resource MSFT_Disk failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Disk with Number '2' is already initialized with MBR. The SendConfigurationApply function did not succeed."."

@johlju
Copy link
Member

johlju commented Sep 3, 2018

@cmptscpeacock Is it possible you could run the configuration manually on the target node so you can get the verbose output and submit it here? The verbose output will show more in detail what is going on.

@johlju johlju added the needs more information The issue needs more information from the author or the community. label Sep 3, 2018
@cmptscpeacock
Copy link
Author

cmptscpeacock commented Sep 3, 2018

@johlju Is this enough for you? I've got debug mode on whilst running manually...

PS C:\temp\dsc> Start-DscConfiguration .\mfa -Wait -Verbose -Force

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSC
LocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer COMPUTERNAME with user sid SID.
VERBOSE: The -Force option was specified with the Stop operation. The current configuration has been successfully cancelled.
VERBOSE: An LCM method call arrived from computer COMPUTERNAME with user sid SID.
VERBOSE: [COMPUTERNAME]: LCM:  [ Start  Set      ]
WARNING: [COMPUTERNAME]:                            [DSCEngine] Warning LCM is in Debug 'ResourceScriptBreakAll' mode.  Resource sc
ript processing will be stopped to wait for PowerShell script debugger to attach.
VERBOSE: [COMPUTERNAME]:                            [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\Sto
rageDsc\4.0.0.0\DscResources\MSFT_WaitForDisk\MSFT_WaitForDisk.psm1 in force mode.
VERBOSE: [COMPUTERNAME]:                            [DSCEngine] Importing the module C:\Program Files\WindowsPowerShell\Modules\Sto
rageDsc\4.0.0.0\DscResources\MSFT_Disk\MSFT_Disk.psm1 in force mode.
VERBOSE: [COMPUTERNAME]: LCM:  [ Start  Resource ]  [[WaitForDisk]Disk2]
VERBOSE: [COMPUTERNAME]: LCM:  [ Start  Test     ]  [[WaitForDisk]Disk2]
VERBOSE: [COMPUTERNAME]:                            [[WaitForDisk]Disk2] Importing the module MSFT_WaitForDisk in force mode.
WARNING: [COMPUTERNAME]:                            [[WaitForDisk]Disk2] Resource is waiting for PowerShell script debugger to atta
ch.  Use the following commands to begin debugging this resource script:
Enter-PSSession -ComputerName COMPUTERNAME -Credential <credentials>
Enter-PSHostProcess -Id 420 -AppDomainName DscPsPluginWkr_AppDomain
Debug-Runspace -Id 16
VERBOSE: [COMPUTERNAME]:                            [[WaitForDisk]Disk2] Test-TargetResource: Checking for disk with Number '2'.
VERBOSE: [COMPUTERNAME]:                            [[WaitForDisk]Disk2] Test-TargetResource: Found disk with Number '2' named 'Virtual HD'.
VERBOSE: [COMPUTERNAME]: LCM:  [ End    Test     ]  [[WaitForDisk]Disk2]  in 71.4340 seconds.
VERBOSE: [COMPUTERNAME]: LCM:  [ Skip   Set      ]  [[WaitForDisk]Disk2]
VERBOSE: [COMPUTERNAME]: LCM:  [ End    Resource ]  [[WaitForDisk]Disk2]
VERBOSE: [COMPUTERNAME]: LCM:  [ Start  Resource ]  [[Disk]ADDataDisk]
VERBOSE: [COMPUTERNAME]: LCM:  [ Start  Test     ]  [[Disk]ADDataDisk]
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Importing the module MSFT_Disk in force mode.
WARNING: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Resource is waiting for PowerShell script debugger to attach
.  Use the following commands to begin debugging this resource script:
Enter-PSSession -ComputerName COMPUTERNAME -Credential <credentials>
Enter-PSHostProcess -Id 420 -AppDomainName DscPsPluginWkr_AppDomain
Debug-Runspace -Id 16
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Test-TargetResource: Testing disk with Number '2' status for drive letter 'F'.
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Test-TargetResource: Checking if disk with Number '2' is initialized.
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Test-TargetResource: Disk with Number '2' is initialized with 'MBR' partition style. GPT required.
VERBOSE: [COMPUTERNAME]: LCM:  [ End    Test     ]  [[Disk]ADDataDisk]  in 2.2180 seconds.
VERBOSE: [COMPUTERNAME]: LCM:  [ Start  Set      ]  [[Disk]ADDataDisk]
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Importing the module MSFT_Disk in force mode.
WARNING: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Resource is waiting for PowerShell script debugger to attach
.  Use the following commands to begin debugging this resource script:
Enter-PSSession -ComputerName COMPUTERNAME -Credential <credentials>
Enter-PSHostProcess -Id 420 -AppDomainName DscPsPluginWkr_AppDomain
Debug-Runspace -Id 16
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Set-TargetResource: Setting disk with Number '2' status for drive letter 'F'.
VERBOSE: [COMPUTERNAME]:                            [[Disk]ADDataDisk] Set-TargetResource: Checking disk with Number '2' partition style.
VERBOSE: [COMPUTERNAME]: LCM:  [ End    Set      ]  [[Disk]ADDataDisk]  in 0.6410 seconds.
PowerShell DSC resource MSFT_Disk  failed to execute Set-TargetResource functionality with error message: 
System.InvalidOperationException: Disk with Number '2' is already initialized with MBR. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost
 
VERBOSE: [COMPUTERNAME]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 74.789 seconds

PS C:\temp\dsc> 

Is this a clue?

Disk with Number '2' is initialized with 'MBR' partition style. GPT required.

Thanks

@johlju
Copy link
Member

johlju commented Sep 4, 2018

@cmptscpeacock Thanks for the verbose output, that will help I'm sure.

Disk with Number '2' is initialized with 'MBR' partition style. GPT required.

Not sure why it says that GPT is required, looks like the Test function always does this
https://github.com/PowerShell/StorageDsc/blob/8a6869665ed6e2c4551edfa5de0574ba533b6c03/Modules/StorageDsc/DSCResources/MSFT_Disk/MSFT_Disk.psm1#L749-L757
So maybe it just an unclear verbose message, not actually a problem unless you expect the disk to be GPT.
Or maybe GPT is required.

@PlagueHO This is out of my depth, can you provide any feedback here?

@cmptscpeacock
Copy link
Author

Is anyone available to respond?

@PlagueHO ?

@PlagueHO
Copy link
Member

PlagueHO commented Sep 7, 2018

Hi @cmptscpeacock - I'll take a look at this first thing tomorrow. Sorry taken so long - I've been traveling for work.

@PlagueHO
Copy link
Member

PlagueHO commented Sep 7, 2018

Hi @cmptscpeacock - the Disk resource doesn't actually support disks with the MBR partition style. There is currently a request open to allow choosing of the Disk format:
#137

What I suspect is happening is the additional data disks that are being attached to the VM are already formatted with a partition style of MBR.

Are you creating this data disk as Managed or Unmanaged? Also, are you able to drop the ARM template in here (if there is nothing sensitive in it) so that I can apply it to my Azure Account and see what the Disk looks like after being freshly provisioned?

I'm running some tests at the moment to investigate this in my Azure account.

This is probably going to accelerate the need for the #137 change - so I'll get this done today I think.

@PlagueHO
Copy link
Member

PlagueHO commented Sep 8, 2018

I just provisioned an Azure VM (manually via the portal) and attached a managed data disk and it does appear to create this as RAW. So it should be correctly formatted with GPT the first time the DSC Config runs.
image

Is it possible there is some other process that runs that prepares the partition table as MBR on this disk before the DSC can get to it?

In the mean time I'll work on getting #137 through so that MBR partition formats are supported.

@cmptscpeacock
Copy link
Author

If it helps, this is the ARM template that adds the data disk:

      "dataDisks": [
        {
          "name": "[concat('dsk-',parameters('vmName1'),'-data1')]",
          "diskSizeGB": "[parameters('vmName1DataDisk1')]",
          "lun": 0,
          "createOption": "Empty"
        }

Nothing too involved. It really does come down to what the DSC script does in terms of formatting, and then what causes it to error the 2nd time it runs, with the same script.

@mwtilton
Copy link

mwtilton commented Sep 14, 2018

I just wanted to add that I am running into a similar issue but not an Azure based VM and also the error is repeatable from first attempt onward.

I have made attempts to force convert gpt at installation but that doesn't hold once you actually log into the VM, also attempted to change it from diskpart after login and it runs into a pagesys file error and from my research it looks like the pagesys file needs to be moved to another drive, then convert the partition, then delete the extra drive.

Still working on fully testing this process but it would be nice to allow MBR thus bypassing these workarounds.

Let me know if you need further screenshots/error logs or anything else.

@PlagueHO PlagueHO added enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone. and removed needs more information The issue needs more information from the author or the community. labels Sep 14, 2018
@PlagueHO
Copy link
Member

@mwtilton - there is a new feature going through review at the moment that adds MBR support (#170). Should be through soon (hopefully 😁) .

@cmptscpeacock
Copy link
Author

Thanks for the update and progress. This will be very useful going forward. Many thanks

@mwtilton
Copy link

mwtilton commented Sep 16, 2018

@PlagueHO Awesome! I noticed that it was set to be worked on in #170 just wanted to throw in my two cents in case someone else came by and saw the original post stating:

The first time it deploys fine.

Looks like you got it under control, thanks! 👍

@PlagueHO
Copy link
Member

This PR has gone through now so it should be released to the PS Gallery in the next Resource Kit release. Will close this once that has gone out and the problem has been confirmed to be resolved.

@johlju johlju added resolved in dev A fix has been merged into the dev-branch but the issue is still open and awaits next release. and removed in progress The issue is being actively worked on by someone. labels Sep 25, 2018
@johlju
Copy link
Member

johlju commented Sep 25, 2018

I labeled it 'resolved in dev', and remove 'in progress' label.

@CPeacockSoltec
Copy link

any update on this? is the new version ready for production?

@johlju
Copy link
Member

johlju commented Oct 19, 2018

I think the next release of DSC Resource Kit will be somewhere before end of October, but not certain, I don’t know of an exact date.

@bradwilliamson
Copy link

bradwilliamson commented Nov 12, 2018

I start getting this error message as well. Seems to have worked fine and just started breaking on my hourly jobs that enforce config management. I believed we used the same module to partition these disks. I updated from 4.1.0.0 to 4.2.0.0 to see if that fixed it. So is GPT a requirement as opposed to MBR? I don't see an option to enforce GPT in this module when creating from raw disk.

msg": "PowerShell DSC resource MSFTDSC_Disk failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Disk with Number '1' is already initialized with partition style '' but 'GPT' is required. Set AllowDestructive and ClearDisk to $true to allow disk to be reinitialized. ",

@martinjosephogorman
Copy link

I'm also getting this error when redeployed on an Azure Managed disk. Using 4.3.0.0

@PlagueHO
Copy link
Member

We added MBR support to the Disk resource in 4.3.0.0, but I couldn't get Azure to pre-format the disk with MBR. However the errors seemed to indicate that an empty value (instead of RAW) is being returned when detecting the disk format.

I'll try some experimentation later on today to see if I can figure this out once and for all.

@PlagueHO
Copy link
Member

PlagueHO commented Dec 1, 2018

I'm not having any luck replicating this problem in Azure. I'm using an ARM template (including an empty 1023GB data disk) to provision the VM. I'm then logging in using RDP and applying the following configuration manually. I'm using Push Mode:

Configuration Storage
{
    Import-DSCResource -ModuleName StorageDsc

    Node localhost
    {
        WaitForDisk Disk2
        {
             DiskId = 2
             RetryIntervalSec = 60
             RetryCount = 60
        }

        Disk EVolume
        {
             DiskId = 2
             DriveLetter = 'F'
             DependsOn = '[WaitForDisk]Disk2'
        }
    }
}

Install-Module StorageDsc
Storage -OutputPath . -Verbose
Start-DscConfiguration -Wait -Force -Path .\Storage -ComputerName Localhost -Verbose

image

I can reapply the configuration over and over and it reports no problem:
image

However, there is something wrong with the maximum partition size evaluation being reported by the disk. That should be treated as a different issue (which I'll raise).

@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. and removed enhancement The issue is an enhancement request. resolved in dev A fix has been merged into the dev-branch but the issue is still open and awaits next release. labels Dec 1, 2018
@martinjosephogorman
Copy link

Thank you for looking at this I'm specifically using Azure Automation DSC to apply the DSC. I must admin when I run locally I do not get the same issue. I will attempt to get further logs shortly

@martinjosephogorman
Copy link

I'm afraid I don't have details logs above, but I do have the errors.

Job {*******} :
This event indicates that failure happens when LCM is processing the configuration. Error Id is 0x1. Error Detail is The SendConfigurationApply function did not succeed.. Resource Id is [Disk]GVolume and Source Info is ::17::9::Disk. Error Message is The PowerShell DSC resource '[Disk]GVolume' with SourceInfo '::17::9::Disk' threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details..

Job {*******} :
MIResult: 1
Error Message: Invalid Parameter
Activity ID: {fdfd423a-df9a-4e61-9136-46dab523a64c}
Message ID: StorageWMI 5,Get-PartitionSupportedSize
Error Category: 5
Error Code: 5
Error Type: MI

@Onibus
Copy link

Onibus commented Jan 11, 2019

+1, having issues using xDisk when deploying via Azure State Configuration (DSC). I attached a new disk to a VM and modified my configuration to use the disk #. After deploying, it fails with the following:
PowerShell DSC resource MSFT_xDisk failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Disk with Number '1' is already initialized with MBR.

@PlagueHO
Copy link
Member

@Onibus , @martinjosephogorman - is it possible to paste some screenshots of the Azure State Configuration settings for the Storage Resource? Anything I can use to replicate this issue in Azure.

@Onibus
Copy link

Onibus commented Jan 14, 2019

@PlagueHO Here you are.
Snippet of xDisk code used. This is against Server 2019 Core. The configuration only contains xDisk. Note that I changed the configuration to use DiskID 0 which is C: for the purpose of testing.

[...]
Import-DscResource -ModuleName 'xStorage'
[...]
xWaitforDisk DiskADVol
    {
        DiskId = 0
        RetryIntervalSec = 10
        RetryCount = 10
    }
    
    xDisk DiskADVol
    {
        DiskId = 0
        DriveLetter = 'C'
        DependsOn = '[xWaitforDisk]DiskADVol'
    }

I uploaded the DSC config to my Automation Account and compiled it, which was successful. I then added the node to State Configuration.

After the node picked up and applied the configuration, it failed with the following.
image

From the Azure portal, xDisk > DiskADVol spat out the following JSON error

{
    "Exception":  {
                      "Message":  "PowerShell DSC resource MSFT_xDisk  failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Disk with Number \u00270\u0027 is already initialized with MBR. ",
                      "Data":  {

                               },
                      "InnerException":  {
                                             "ErrorRecord":  "System.InvalidOperationException: Disk with Number \u00270\u0027 is already initialized with MBR.",
                                             "WasThrownFromThrowStatement":  true,
                                             "Message":  "System.InvalidOperationException: Disk with Number \u00270\u0027 is already initialized with MBR.",
                                             "Data":  "System.Collections.ListDictionaryInternal",
                                             "InnerException":  "System.Exception: System.InvalidOperationException: Disk with Number \u00270\u0027 is already initialized with MBR.",
                                             "TargetSite":  "System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject] Invoke(System.Collections.IEnumerable)",
                                             "StackTrace":  "   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)\r\n   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)\r\n   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)\r\n   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\r\n   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\r\n   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)\r\n   at Microsoft.PowerShell.DesiredStateConfiguration.Internal.ResourceProviderAdapter.ExecuteCommand(PowerShell powerShell, ResourceModuleInfo resInfo, String operationCmd, List`1 acceptedProperties, CimInstance nonResourcePropeties, CimInstance resourceConfiguration, LCMDebugMode debugMode, PSInvocationSettings pSInvocationSettings, UInt32\u0026 resultStatusHandle, Collection`1\u0026 result, ErrorRecord\u0026 errorRecord, PSModuleInfo localRunSpaceModuleInfo)",
                                             "HelpLink":  null,
                                             "Source":  "System.Management.Automation",
                                             "HResult":  -2146233087
                                         },
                      "TargetSite":  null,
                      "StackTrace":  null,
                      "HelpLink":  null,
                      "Source":  null,
                      "HResult":  -2146233079
                  },
    "TargetObject":  null,
    "CategoryInfo":  {
                         "Category":  7,
                         "Activity":  "",
                         "Reason":  "InvalidOperationException",
                         "TargetName":  "",
                         "TargetType":  ""
                     },
    "FullyQualifiedErrorId":  "ProviderOperationExecutionFailure",
    "ErrorDetails":  null,
    "InvocationInfo":  null,
    "ScriptStackTrace":  null,
    "PipelineIterationInfo":  [

                              ]
}

Pulling the DSC logs show the following
> Get-WinEvent -LogName "Microsoft-Windows-Dsc/Operational" |?{$_.timecreated -gt $( (get-date).addhours(-1)) -and $_.leveldisplayname -match '(Error|Warning)'} |select timecreated, message | select -first 7 | fl
image

Get-DSCConfiguration returned the following:

PS C:\windows\system32> Get-DscConfiguration
WARNING: [SERVERNAME]:                            [] The GET operation will be carried against a pending
configuration since the latest configuration has not converged yet.

ConfigurationName    : xDiskConfig
DependsOn            :
ModuleName           : xStorage
ModuleVersion        : 3.4.0.0
PsDscRunAsCredential :
ResourceId           : [xWaitForDisk]DiskADVol
SourceInfo           :
DiskId               : 0
DiskIdType           : Number
RetryCount           : 10
RetryIntervalSec     : 10
PSComputerName       :
CimClassName         : MSFT_xWaitForDisk

ConfigurationName    : xDiskConfig
DependsOn            : {[xWaitforDisk]DiskADVol}
ModuleName           : xStorage
ModuleVersion        : 3.4.0.0
PsDscRunAsCredential :
ResourceId           : [xDisk]DiskADVol
SourceInfo           :
AllocationUnitSize   : 4096
AllowDestructive     :
ClearDisk            :
DiskId               : 0
DiskIdType           : Number
DriveLetter          : C
FSFormat             : NTFS
FSLabel              : Windows
Size                 : 135838826496
PSComputerName       :
CimClassName         : MSFT_xDisk

Get-DscConfigurationStatus shows failure

Status     StartDate                 Type            Mode  RebootRequested      NumberOfResources
------     ---------                 ----            ----  ---------------      -----------------
Failure    1/14/2019 8:39:24 PM      Initial         Pull  False                2

Poking around, I found the DSC logs in C:\WindowsAzure\logs\Plugins\Microsoft.Powershell.DSC\2.77.0.0. Below is a snippet of where xDisk fails.

VERBOSE: [2019-01-14 21:30:46Z] Executing Update-DscConfiguration ...
VERBOSE: [2019-01-14 21:30:46Z] Settings handler status to 'transitioning' 
(C:\Packages\Plugins\Microsoft.Powershell.DSC\2.77.0.0\Status\6.status)
VERBOSE: [2019-01-14 21:30:46Z] [VERBOSE] Perform operation 'Invoke CimMethod' with following parameters, ''methodName'
 = PerformRequiredConfigurationChecks,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = 
root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] An LCM method call arrived from computer SERVERNAME with user sid 
S-1-5-18.
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]:                            [] Executing Get-Action with 
configuration (null)'s checksum: .
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]:                            [] Executing Get-Action with 
configuration 's checksum returned result status: GetConfiguration.
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]:                            [] Checksum is different. LCM 
will execute GetConfiguration to pull configuration .
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]:                            [] Executing GetConfiguration 
succeeded. Configuration  was pulled from server.
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]:                            [] Applying the new 
configuration(s) pulled.
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]: LCM:  [ Start  Resource ]  [[xWaitForDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]: LCM:  [ Start  Test     ]  [[xWaitForDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:48Z] [VERBOSE] [SERVERNAME]:                            [[xWaitForDisk]DiskADVol] 
Test-TargetResource: Checking for disk with Number '0'.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]:                            [[xWaitForDisk]DiskADVol] 
Test-TargetResource: Found disk with Number '0' named 'Virtual HD'.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ End    Test     ]  [[xWaitForDisk]DiskADVol]  in 
2.1430 seconds.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ Skip   Set      ]  [[xWaitForDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ End    Resource ]  [[xWaitForDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ Start  Resource ]  [[xDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ Start  Test     ]  [[xDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]:                            [[xDisk]DiskADVol] 
Test-TargetResource: Testing disk with Number '0' status for drive letter 'C'.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]:                            [[xDisk]DiskADVol] 
Test-TargetResource: Checking if disk with Number '0' is initialized.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]:                            [[xDisk]DiskADVol] 
Test-TargetResource: Disk with Number '0' is initialized with 'MBR' partition style. GPT required.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ End    Test     ]  [[xDisk]DiskADVol]  in 0.1720 
seconds.
VERBOSE: [2019-01-14 21:30:50Z] [VERBOSE] [SERVERNAME]: LCM:  [ Start  Set      ]  [[xDisk]DiskADVol]
VERBOSE: [2019-01-14 21:30:51Z] [VERBOSE] [SERVERNAME]:                            [[xDisk]DiskADVol] 
Set-TargetResource: Setting disk with Number '0' status for drive letter 'C'.
VERBOSE: [2019-01-14 21:30:51Z] [VERBOSE] [SERVERNAME]:                            [[xDisk]DiskADVol] 
Set-TargetResource: Checking disk with Number '0' partition style.
VERBOSE: [2019-01-14 21:30:51Z] [VERBOSE] [SERVERNAME]: LCM:  [ End    Set      ]  [[xDisk]DiskADVol]  in 0.1250 
seconds.
VERBOSE: [2019-01-14 21:30:51Z] [ERROR] PowerShell DSC resource MSFT_xDisk  failed to execute Set-TargetResource 
functionality with error message: System.InvalidOperationException: Disk with Number '0' is already initialized with 
MBR. 
VERBOSE: [2019-01-14 21:30:51Z] [ERROR] The SendConfigurationApply function did not succeed.
VERBOSE: [2019-01-14 21:30:51Z] [VERBOSE] Operation 'Invoke CimMethod' complete.
VERBOSE: [2019-01-14 21:30:51Z] [VERBOSE] Time taken for configuration job to complete is 4.137 seconds
VERBOSE: [2019-01-14 21:30:52Z] Settings handler status to 'transitioning' 
(C:\Packages\Plugins\Microsoft.Powershell.DSC\2.77.0.0\Status\6.status)
VERBOSE: [2019-01-14 21:30:52Z] Updating execution status (HKLM:\SOFTWARE\Microsoft\Azure\DSC\2.77.0.0\Status)
VERBOSE: [2019-01-14 21:30:52Z] DSC configuration completed.
VERBOSE: [2019-01-14 21:30:52Z] No meta mof back up file exist to restore ...
VERBOSE: [2019-01-14 21:30:52Z] Settings handler status to 'error' 

@PlagueHO
Copy link
Member

Very awesome info @Onibus ! Thank you. That will allow me to have a go at replicating it. I'm travelling for work the next few days but will get onto this as soon as I can.

@hasangural
Copy link

hasangural commented Mar 8, 2019

+1 having same issue when I was trying to use DSC to deploy an Azure VM from an ARM template. Did you find the solution for this issue? @PlagueHO

@PlagueHO
Copy link
Member

PlagueHO commented Mar 8, 2019

Hi @hasangural - I'm still catching up on issues so haven't managed to replicate this one yet. Sorry about that.

However, I've just noticed that @Onibus was having this issue with the old xStorage resource instead of this newer StorageDsc module.

@hasangural - were you getting this problem with the latest StorageDsc module?

@martinjosephogorman
Copy link

@plague I was having the issue on StroageDSc and xStroage

@hasangural
Copy link

hasangural commented Apr 11, 2019

@martinjosephogorman , Hi, If you are using Azure VM and DSC extension, please be aware of the diskId. I used to use like that; it is still working.

$getDisks = Get-Disk

xWaitforDisk Disk2
        {
            DiskIdType = 'UniqueId'
            DiskId = ($getDisks | Where-Object {$_.Path -like '*disk#000000#*'}).UniqueId
            RetryIntervalSec =$RetryIntervalSec
            RetryCount = $RetryCount
        }

        xDisk ADDataDisk {
            DiskIdType = 'UniqueId'
            DiskId = ($getDisks | Where-Object {$_.Path -like '*disk#000000#*'}).UniqueId
            DriveLetter = "F"
            FSLabel = "Database"
            DependsOn = "[xWaitForDisk]Disk2"
        }

@martinjosephogorman
Copy link

Thank you @hasangural will try it out.

@SteveL-MSFT SteveL-MSFT added this to Help Wanted in powershell/dscresources May 14, 2019
@SteveL-MSFT SteveL-MSFT removed this from Help Wanted in powershell/dscresources Nov 27, 2019
@BorysMariusz
Copy link

I still face the issue with preview0002 version. Could someone guide me how to fix it ?

Error: Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'dscScript'. Error message: "DSC Configuration 'DscConfig' completed with error(s). Following are the first few: PowerShell DSC resource DSC_Disk failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Disk with Number '2' is already initialized with partition style '' but 'GPT' is required. Set AllowDestructive and ClearDisk to $true to allow disk to be reinitialized. PowerShell DSC resource MSFT_xVirtualMemory failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Drive D:\ is not ready. Please ensure that the drive exists and is available. The system cannot find the path specified. The related file/directory is: F:\. The related ResourceID is [File]Ceridian."\r\n\r\nMore information on troubleshooting is available at https://aka.ms/VMExtensionDSCWindowsTroubleshoot "

@PlagueHO
Copy link
Member

PlagueHO commented Feb 7, 2023

Hi @mayoness83 ,

Can you post your config in here?

Are you also able to post the output from running Get-Disk | Fl * on the disk?

@BorysMariusz
Copy link

@PlagueHO thank you for feedback. I will gather requested files tomorrow and add it here. What solve our issue was switching from VM SKU Standard_D16s_v5 to Standard_D16ds_v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

10 participants