Is there a way to determine which VMFS LUNs are native VMFS5 and which are upgraded from a previous version?
I can think of 2 possible ways to determine if a volume was upgraded or natively formatted with VMFS5.
First, check the VMFS blocksize. If you see a blocksize greater than 1MB for VMFS5, you instantly know the volume was upgraded. You can use the regular vSphere Client GUI to check your Datastore or use this powercli snippet to list all your Datastores and their VMFS version:
Get-Datastore | %{ (Get-View $_).Info.Vmfs | select Name, BlocksizeMb, Version }
Name BlockSizeMb Version
---- ----------- -------
UPGRADED_VMFS5 8 5.54
OLD_VMFS3 8 3.46
PROBABLY_NATIVE_VMFS5 1 5.54
This of course doesn't tell if a 1MB blocksize VMFS3 was upgraded or not.
The 2nd way is to check is if the disk device is using a GPT instead of MBR partition table. Upgraded volumes will retain MBR while new ones are created with GPT. There is one corner-case scenario though: An upgraded VMFS3 volume will also change to GPT if you extend the VMFS beyond 2TB after the upgrade. This behavior is described here:
http://blogs.vmware.com/vsphere/2011/12/upgraded-vmfs-5-automatic-partition-format-change.html
http://kb.vmware.com/kb/2003813
If you don't have LUNs larger than 2TB or you are sure to have never extended volumes like this, this should be a surefire way to tell from the ESXi shell:
~ # partedUtil getptbl [Disk Device Path]
~ # partedUtil getptbl /vmfs/devices/disks/naa.600508b40010439a0000b00000360000
gpt
19581 255 63 314572800
1 128 314568764 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
The following snippet will run against all VMFS volumes active on the host being executed on:
~ # esxcfg-scsidevs -m | awk {'print $1'} | sed -e 's/\:1//' | while read device; do echo -e "\n$device"; partedUtil getptbl /vmfs/devices/disks/$device ; done;
I can think of 2 possible ways to determine if a volume was upgraded or natively formatted with VMFS5.
First, check the VMFS blocksize. If you see a blocksize greater than 1MB for VMFS5, you instantly know the volume was upgraded. You can use the regular vSphere Client GUI to check your Datastore or use this powercli snippet to list all your Datastores and their VMFS version:
Get-Datastore | %{ (Get-View $_).Info.Vmfs | select Name, BlocksizeMb, Version }
Name BlockSizeMb Version
---- ----------- -------
UPGRADED_VMFS5 8 5.54
OLD_VMFS3 8 3.46
PROBABLY_NATIVE_VMFS5 1 5.54
This of course doesn't tell if a 1MB blocksize VMFS3 was upgraded or not.
The 2nd way is to check is if the disk device is using a GPT instead of MBR partition table. Upgraded volumes will retain MBR while new ones are created with GPT. There is one corner-case scenario though: An upgraded VMFS3 volume will also change to GPT if you extend the VMFS beyond 2TB after the upgrade. This behavior is described here:
http://blogs.vmware.com/vsphere/2011/12/upgraded-vmfs-5-automatic-partition-format-change.html
http://kb.vmware.com/kb/2003813
If you don't have LUNs larger than 2TB or you are sure to have never extended volumes like this, this should be a surefire way to tell from the ESXi shell:
~ # partedUtil getptbl [Disk Device Path]
~ # partedUtil getptbl /vmfs/devices/disks/naa.600508b40010439a0000b00000360000
gpt
19581 255 63 314572800
1 128 314568764 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
The following snippet will run against all VMFS volumes active on the host being executed on:
~ # esxcfg-scsidevs -m | awk {'print $1'} | sed -e 's/\:1//' | while read device; do echo -e "\n$device"; partedUtil getptbl /vmfs/devices/disks/$device ; done;
MKGuy, the second way is the only sure fire way of veryifying if a VMFS Datastore in Native VMFS5 or has been upgraded, remember VMFS 3 had a 1MB block ability too, with Datastores less than 256GB.
Yes, that's why I mentioned that the first way does not tell anything about volumes that initially already used a 1MB blocksize at the time of the upgrade.
And remember, the blocksize affected the maximum file size only and not the datastore size 🙂 .
agreed
Thanks for that! Much appreciated!
Hey, got bored so here's a oneliner to be executed on an ESXi bash via ssh, to show Name, VMFS version and if it is VMFS 5 if it was upgraded or is native. Native and Upgraded differ in the max file value. Have fun
esxcfg-scsidevs -m |awk {'print $5'}|while read volume;do VMFSv=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep VMFS | awk {'print $1'}); max=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep Files | awk {'print $3'} | cut -d "/" -f1);if [ $(echo $VMFSv | cut -c 6) == "5" ];then if [ "$max" -eq "30720" ];then version="Upgraded VMFS 5";else version="Native VMFS 5";fi;else version="";fi; echo -e "$volume $VMFSv $version";done
You must have been bored LOL Nice script though
schepp when I run this script this is just showing the vmfs version and not showing whether it is upgraded or not. Have a look at my output
~ # esxcfg-scsidevs -m |awk {'print $5'}|while read volume;do VMFSv=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep VMFS | awk {'print $1'}); max=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep F
iles | awk {'print $3'} | cut -d "/" -f1);if [ "$VMFSv" == "VMFS-5.54" ];then if [ "$max" -eq "30720" ];then version="Upgraded VMFS 5";else version="Native VMFS 5";fi;else version="";fi; echo -e "$
volume $VMFSv $version";done
datastore_1 VMFS-5.60
FCdatastore VMFS-3.60
~ # esxcfg-scsidevs -m |awk {'print $5'}|while read volume;do VMFSv=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep VMFS | awk {'print $1'}); max=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep F
iles | awk {'print $3'} | cut -d "/" -f1);if [ "$VMFSv" == "VMFS-5.54" ];then if [ "$max" -eq "30720" ];then version="Upgraded VMFS 5";else version="Native VMFS 5";fi;else version="";fi; echo -e "$
volume $VMFSv $version";done
datastore_1 VMFS-5.60
FCdatastore VMFS-5.60
In the above case I have upgraded FCdatastore vmfs version to 5 but it just show the name and version.
Alex Thomas yes it was only looking for that specific minor version of VMFS 5.
Changed it to work with all 5.X version:
esxcfg-scsidevs -m |awk {'print $5'}|while read volume;do VMFSv=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep VMFS | awk {'print $1'}); max=$(vmkfstools -Pv 10 /vmfs/volumes/$volume | grep Files | awk {'print $3'} | cut -d "/" -f1);if [ $(echo $VMFSv | cut -c 6) == "5" ];then if [ "$max" -eq "30720" ];then version="Upgraded VMFS 5";else version="Native VMFS 5";fi;else version="";fi; echo -e "$volume $VMFSv $version";done
Awesome, thats great, working fine now thanks