shellart
Contributor
Contributor

Script to find LUNs that are not in use

Dears,

Does anyone have any scripts to compare or identify LUNs / Devices like "naa.600507680c800590a0000000000000bc" format that are presented to hosts, but are not in use by any VM and that are not in use by any datastore?

Regards,

Artur

14 Replies
LucD
Leadership
Leadership

Have a look at my LUN Report – Datastore, RDM And Node Visibility post.

That produces a report showing which LUN is used for what or is free.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmk2014
Expert
Expert

LucD,

I ran the script and generated the LUN report but what does purple color represent here ?  Does it mean LUN not in use and we can unmap ?

still available

Thanks

V

0 Kudos
LucD
Leadership
Leadership

That is correct, such a LUN is visible on the node but not in use as a datastore or RDM.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vmk2014
Expert
Expert

LucD,

After sharing the report with Storage team, it was updated that LUN are mapped to multiple cluster groups from vmware end and as per the LUN not in use, it was showing empty or not mapped to any host. How can we avoid that so that the report is perfect. More accuracy.

Example - 5 Cluster names which shares a same LUN ids ( eg : 

naa.6006016173204700a3d58f5a426c6e9a

Shares 5 ClusterNames

Thanks

V

5 Cluster names which shares a same LUN ids ( eg :

naa.6006016073204700a3d58f5a426c6e7a


Shares 5 ClusterNames

Thanks

V

0 Kudos
LucD
Leadership
Leadership

Not sure what you mean here?

If a LUN is visible on an ESXi node and is not used by a datastore or as an RDM, it is marked as unused.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmk2014
Expert
Expert

LucD,

What i was trying to say that when i executed the script i got 87 LUN ID which as per script shows not mapped to any host, hence i informed the storage team to reclaim back these LUN, but as per the storage team that most of the LUN ID doesn't exist at all from storage end and also they found 1 LUN ID (marked in yellow color in earlier thread)  is mapped to multiple cluster which contradict the purpose of the script. Also, we did compare these 87 LUN ID from RV tools and none of them shows in RV tools.

Let me know if i'm  unable to explain.

Thanks

V

0 Kudos
LucD
Leadership
Leadership

I don't know what kind of storage you are using, but for me, and others, the script works.

To explain what you are seeing, I would need to investigate in your environment.


The script reports the LUNs from the point of view from the ESXi nodes.

If an ESXi node reports a LUN which does not exist on your storage, it might mean that there are some ghost LUNs on the ESXi node(s).

Note that the script is intended to run against a cluster and show which LUNs are visible and used/not used in that cluster.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vmk2014
Expert
Expert

Hi LucD,

I agree with you and we are using the EMC VMAX/Powermax/VNX and Unity storage. Yes, our storage team did confirmed that they are seeing storage Zero utilization, but only concerns was one of the LUN ID/NAA ID when i ran the script was showing not in use and when i asked storage to confirm they said it's mapped to multiple cluster.

Also, how i can mark the answer correct.

Thanks

V

0 Kudos
LucD
Leadership
Leadership

Since you didn't create this thread, I don't think you can use the <Correct Answer> button.

I think you can only use the <Like> button


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vmk2014
Expert
Expert

Hi LucD,

Is there other way or option to reclaim the storage from vmware environment apart from Orphaned/Snapshot and ghost lun ?

Thanks

V

0 Kudos
LucD
Leadership
Leadership

I'm not 100% sure what you mean by that.
Are you looking to free up any unused or non-critical files/folders?

Something like described in Storage Space Reclamation


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmk2014
Expert
Expert

Thank you LucD, shared url is good knowledge perspective,  Actually, i'm looking what are other method to reclaim wastage storage like powered-off vm deletions/Orphaned file cleanup/snapshot/ Lun not in use etc.

Thanks

V

0 Kudos
LucD
Leadership
Leadership

I would suggest starting a new thread for that question.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vmk2014
Expert
Expert

Sure, LucD. will do that.

Thanks

V

0 Kudos