Windows 10 Remove-PhysicalDisk for disk which is marked retired fails

Sanath Kumar

New Member
Joined
Jul 27, 2022
Below error is seen sometimes when I try to remove a disk from storagepool.
Remove-PhysicalDisk : One or more physical disks could not be removed because they are still in use.

Extended information:
The storage pool could not relocate data from one or more physical disks.

Physical Disks:
{0aa97094-5f62-4ef8-fb76-8eb66f1c11f7}

Activity ID: {9030d143-747c-4ce3-a45c-9c4e76481ac9}
At line:1 char:1
+ Remove-PhysicalDisk -PhysicalDisks (Get-PhysicalDisk -UniqueId '60022 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..


Following is the sequence of commands that I run to remove a physicaldisk:
Set-PhysicalDisk -UniqueId '' -Usage Retired
Repair-VirtualDisk -FriendlyName LucidityVD1
Remove-PhysicalDisk -StoragePoolFriendlyName 'testSP1' -PhysicalDisks (Get-PhysicalDisk -UniqueId '' ) -Confirm:$false

This works most of the time, But sometimes fails. I am not able to find the reason why this fails.
Please Let me know the possible reasons why this could fail.
 
As it states in the error the disk is still in use. If it's just been marked retired you may just need to wait a bit, or you'll need to determine what has an open handle to it and clear the handles up. Windows does lazy writes which means even after a file copy appears to be complete it may not have actually completed. Common issue when trying to eject USB drives too
 
As it states in the error the disk is still in use. If it's just been marked retired you may just need to wait a bit, or you'll need to determine what has an open handle to it and clear the handles up. Windows does lazy writes which means even after a file copy appears to be complete it may not have actually completed. Common issue when trying to eject USB drives too
Thank you for the response.
How do I make sure that I clear all the handles to this disk so that I forcefully remove this disk? Is there some powershell command to clear all the handles?
 
Below error is seen sometimes when I try to remove a disk from storagepool.
Remove-PhysicalDisk : One or more physical disks could not be removed because they are still in use.

Extended information:
The storage pool could not relocate data from one or more physical disks.

Physical Disks:
{0aa97094-5f62-4ef8-fb76-8eb66f1c11f7}

Activity ID: {9030d143-747c-4ce3-a45c-9c4e76481ac9}
At line:1 char:1
+ Remove-PhysicalDisk -PhysicalDisks (Get-PhysicalDisk -UniqueId '60022 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..


Following is the sequence of commands that I run to remove a physicaldisk:
Set-PhysicalDisk -UniqueId '' -Usage Retired
Repair-VirtualDisk -FriendlyName LucidityVD1
Remove-PhysicalDisk -StoragePoolFriendlyName 'testSP1' -PhysicalDisks (Get-PhysicalDisk -UniqueId '' ) -Confirm:$false

This works most of the time, But sometimes fails. I am not able to find the reason why this fails.
Please Let me know the possible reasons why this could fail.
Disable storage pool and then remove disk.
 
Below error is seen sometimes when I try to remove a disk from storagepool.
Remove-PhysicalDisk : One or more physical disks could not be removed because they are still in use.

Extended information:
The storage pool could not relocate data from one or more physical disks.

Physical Disks:
{0aa97094-5f62-4ef8-fb76-8eb66f1c11f7}

Activity ID: {9030d143-747c-4ce3-a45c-9c4e76481ac9}
At line:1 char:1
+ Remove-PhysicalDisk -PhysicalDisks (Get-PhysicalDisk -UniqueId '60022 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..


Following is the sequence of commands that I run to remove a physicaldisk:
Set-PhysicalDisk -UniqueId '' -Usage Retired
Repair-VirtualDisk -FriendlyName LucidityVD1
Remove-PhysicalDisk -StoragePoolFriendlyName 'testSP1' -PhysicalDisks (Get-PhysicalDisk -UniqueId '' ) -Confirm:$false

This works most of the time, But sometimes fails. I am not able to find the reason why this fails.
Please Let me know the possible reasons why this could fail.
Disable storage pool and then remove disk
 
Back
Top Bottom