VMware Cloud Community
abdobl
Contributor
Contributor

esxcli commanad to display Disk or LUNs available to add on ESXi?

Hello,

I want to know any esxcli command or path* that i can cheek the LUN that available(Not been added as datastore yet) to add  ESXi Host without using vSphere client or web client?

(I mean by Path* for Ex :-/vmfs/devices/disk)

pastedImage_0.png

6 Replies
arathore
Enthusiast
Enthusiast

try this

esxcli storage filesystem list

abdobl
Contributor
Contributor

hello arathore,Smiley Happy

I tried that as you can see the result just show the datastore which already added to esxi host  .

what i want is to show the Disk\LUN been presented from storage side to ESXi Host but not added to it yet.  

~ # esxcli storage filesystem list

Mount Point                                        Volume Name                   UUID

-------------------------------------------------  ----------------------------  -------------------------------

/vmfs/volumes/52c2a759-95d455c2-776a-5cf9dd36dd69  VLSMTJR01                     52c2a759-95d455c2-776a-5cf9dd36

/vmfs/volumes/52ce537b-18ce5d77-899e-5cf9dd36dd69  VMAXTJR01                     52ce537b-18ce5d77-899e-5cf9dd36

/vmfs/volumes/536fe2d2-65b03058-005d-5cf9dd36dd76  VLEFTJR01                     536fe2d2-65b03058-005d-5cf9dd36

Reply
0 Kudos
admin
Immortal
Immortal

Try this: esxcli storage core  device partition showguid | grep -i n/a

Reply
0 Kudos
MKguy
Virtuoso
Virtuoso

Check if the following snippet of shell code does the job for you:

esxcli storage core device list | egrep '^[^ ]+' | while read disk

do

  esxcfg-scsidevs --vmfs | if ! grep -q "$disk"

  then

    echo -e "$disk is not mapped to any VMFS"

  fi

done

Edit: Faulty VMFS-check logic has been amended.

It just rotates through every block storage device and checks if it's mapped to an existing VMFS volume.

-- http://alpacapowered.wordpress.com
Reply
0 Kudos
abdobl
Contributor
Contributor

Apparently there is no such operation Smiley Sad

Reply
0 Kudos
hussainbte
Expert
Expert

This should work.

create a below .sh script and execute

esxcfg-scsidevs -c|awk '{print $1}'|cut -d"." -f2|grep -v Device >/var/tmp/all_disks

esxcfg-scsidevs --vmfs>/var/tmp/assigned_disks

for i in `cat /var/tmp/all_disks`

  do

  cat /var/tmp/assigned_disks|grep -q $i

    F=$?

     if [ $F -gt 0 ]

     then

     echo $i

     fi

  done

If you found my answers useful please consider marking them as Correct OR Helpful Regards, Hussain https://virtualcubes.wordpress.com/
Reply
0 Kudos