按照说明找到这里和这里,我一直在尝试更换 Windows 存储池中出现故障的驱动器。以下是我在物理更换驱动器后采取的步骤。
运行时Get-PhysicalDisk
,我看到:
FriendlyName SerialNumber CanPool OperationalStatus HealthStatus Usage Size
------------ ------------ ------- ----------------- ------------ ----- ----
WDC WD1003FBYX-01Y7B1 WD-WCAW36848546 False OK Healthy Auto-Select 931.51 GB
WDC WD4000F9MZ-76NVPL0 WD-WCC131932768 False OK Healthy Auto-Select 3.64 TB
Generic Physical Disk False Lost Communication Warning Auto-Select 3.64 TB
WDC WD1003FBYX-01Y7B1 WD-WCAW36848210 False OK Healthy Auto-Select 931.51 GB
WDC WD4000F9MZ-76NVPL0 WD-WCC131962755 False OK Healthy Auto-Select 3.64 TB
WDC WD4000F9MZ-76NVPL0 WD-WCC131965649 False OK Healthy Auto-Select 3.64 TB
WDC WD4000F9YZ-09N20L0 WD-WCC130974882 False OK Healthy Auto-Select 3.64 TB
很明显哪个是坏驱动器。因此,我将坏磁盘设置为变量,
$badDisk = Get-PhysicalDisk | Where-Object { $_.OperationalStatus -eq 'Lost Communication' }
然后将其退休。
$badDisk | Set-PhysicalDisk -Usage Retired
从那里,我尝试移除磁盘。
Remove-PhysicalDisk -PhysicalDisks $badDisk -StoragePoolName DataStore1
Remove-PhysicalDisk : The requested object could not be found.
At line:1 char:1
+ Remove-PhysicalDisk -PhysicalDisks $badDisk -StoragePoolName Data ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (PS_StorageCmdlets:ROOT/Microsoft/..._StorageCmdlets) [Remove-PhysicalDi
sk], CimException
+ FullyQualifiedErrorId : MI RESULT 6,Remove-PhysicalDisk
哦...好嗎?
那么,先添加替换磁盘吗?
$replacementDisk = Get-PhysicalDisk –FriendlyName 'WDC WD4000F9YZ-09N20L0'
Add-PhysicalDisk –PhysicalDisks $replacementDisk –StoragePoolFriendlyName DataStore1
Add-PhysicalDisk : The requested object could not be found.
At line:1 char:1
+ Add-PhysicalDisk –PhysicalDisks $replacementDisk –StoragePoolFriendly ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (PS_StorageCmdlets:ROOT/Microsoft/..._StorageCmdlets) [Add-PhysicalDisk]
, CimException
+ FullyQualifiedErrorId : MI RESULT 6,Add-PhysicalDisk
我到底做错了什么?我知道我对 Powershell 的了解还不够多,但是……这里的一切看起来都相当简单。
答案1
不确定您是否解决了这个问题,但我遇到了完全相同的问题,并且刚刚在这里找到了解决方案: https://social.technet.microsoft.com/Forums/en-US/a7cdd6ce-db9c-47f8-b366-8d0b437a6bb8/removephysicaldisk-fails-with-failover-clustering-and-storage-spaces-in-windows-server-2016?forum=winserverfiles
我使用了以下 4 行(只需替换包含“YourXxxXxx”的 2 个参数):
$Clustername = "YourClusterName"
Get-CimInstance -Namespace root\mscluster -ComputerName $ClusterName -ClassName MScluster_ClusterService | Invoke-CimMethod -Name EnableHealth
Remove-PhysicalDisk -PhysicalDisks (Get-PhysicalDisk | ? OperationalStatus -eq ‘Lost Communication’) -StoragePoolFriendlyName YourStoragePoolName
Get-CimInstance -Namespace root\mscluster -ComputerName $ClusterName -ClassName MScluster_ClusterService | Invoke-CimMethod -Name DisableHealth