Unable to bring cloned LUN online in cluster

After using NAS/SAN to restore/clone a LUN, you might be unable to bring it online. Using diskpart to clear it like this :

DISKPART> Select disk 5
DISKPART>attrib disk clear readonly
DISKPART> Failed to clear disk attributes.

This can be caused by duplicate disk ID, in this case Disk 5 is a clone of Disk 3 :

DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 465 GB 1024 KB
Disk 1 Reserved 435 GB 0 B *
Disk 2 Reserved 700 GB 1024 KB *
Disk 3 Reserved 450 GB 0 B *
Disk 4 Reserved 10 GB 1024 KB
Disk 5 Reserved 450 GB 0 B *

DISKPART> select disk 5
Disk 5 is now the selected disk.
DISKPART> uniqueid disk
Disk ID: {2D6F9758-E08C-4FB4-B8EA-868695BBCBE3}
DISKPART> select disk 3
Disk 3 is now the selected disk.
DISKPART> uniqueid disk
Disk ID: {2D6F9758-E08C-4FB4-B8EA-868695BBCBE3}

Since the disk cannot be brought online cause of the duplicate ID, the solution is to do it on a different server, where there is no duplicate disk ID.

Detach the disk on the cluster setup.
Attach it on the new server.
Use Powershell to generate a new ID :
PS C:\> [guid]::NewGuid()
fb0b17eb-4c4f-445c-8888-9f2538b0c61d (it doesn’t matter GUID is lowercase)
Run diskpart :

DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 60 GB 0 B
Disk 1 Online 600 GB 0 B *
Disk 2 Online 450 GB 0 B *
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> uniqueid disk
Disk ID: {2D6F9758-E08C-4FB4-B8EA-868695BBCBE3}
DISKPART> uniqueid disk ID=fb0b17eb-4c4f-445c-8888-9f2538b0c61d using the new ID generated with Powershell.

DISKPART> uniqueid disk
Disk ID: {FB0B17EB-4C4F-445C-8888-9F2538B0C61D}

Detach the disk from this server, reattach to cluster nodes.

In diskpart run :

DISKPART> rescan
Please wait while DiskPart scans your configuration…
DiskPart has finished scanning your configuration.
DISKPART> select disk 5
Disk 5 is now the selected disk.
DISKPART> uniqueid disk
Disk ID: {FB0B17EB-4C4F-445C-8888-9F2538B0C61D}
DISKPART> attributes disk

Current Read-only State : Yes
Read-only : Yes
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : Yes

DISKPART> attributes disk clear readonly
Disk attributes cleared successfully.

You should now be able to add the disk in the cluster.