Friday 29 July 2016

Identify and tag SSD Devices







You can use PSA SATP claim rules to tag SSD devices that are not detected automatically.
Only devices that are consumed by the PSA Native Multipathing (NMP) plugin can be tagged.
Procedure
First find all your relevant information
  • Identify the drive to be tagged and its SATP.
  • For example our drive is called (naa.600605b008f362e01c91d3154a908da1):1
  • Type esxcli storage nmp device list -d naa.600605b008f362e01c91d3154a908da1
  • The command results in the following information.
SSDTagging
  • Note down the SATP associated with the device.
  • You can also run the following to get extra information and you can see that Is SSD is marked false when it should be true
  • esxcli storage core device list -d naa.600605b008f362e01c91d3154a908da1
SSDTagging2
Create a new SATP Rule
  • Add a PSA claim rule to mark the device as SSD.
  • There are several ways to do this
  • You can add a claim rule by specifying the device name.
  • esxcli storage nmp satp rule add -s VMW_SATP_CX -d naa.600605b008f362e01c91d3154a908da1 -o enable_ssd
SSDTagging4
  • You can add a claim rule by specifying the vendor name and the model name.
    esxcli storage nmp satp rule add -s VMW_SATP_CX -V vendor_name -M model_name –option=enable_ssd
  • You can add a claim rule based on the transport protocol.
  • esxcli storage nmp satp rule add -s VMW_SATP_CX  –transport transport_protocol –option=enable_ssd
  • You can add a claim rule based on the driver name.
  • esxcli storage nmp satp rule add -s VMW_SATP_CX  –driver driver_name –option=enable_ssd
Restart the host
  • You now need to restart the host
Unclaiming the device
  • You can now unclaim the device by specifying the device name.
  • esxcli storage core claiming unclaim –type device –device naa.600605b008f362e01c91d3154a908da1
SSDTagging5
  • You can unclaim the device by specifying the vendor name and the model name.
  • esxcli storage core claiming unclaim –type device -V vendor_name -M model_name
  • You can unclaim the device based on the transport protocol.
  • esxcli storage core claiming unclaim –type device –transport transport_protocol
  • You can unclaim the device based on the driver name.
  • esxcli storage core claiming unclaim –type device –driver driver_name
Reclaim the device by running the following commands.
  • esxcli storage core claimrule load
  • esxcli storage core claimrule run
  • esxcli storage core claiming reclaim -d naa.600605b008f362e01c91d3154a908da1
Verify if devices are tagged as SSD.
  • esxcli storage core device list -d device_name
  • or
  • esxcli storage core device list -d naa.600605b008f362e01c91d3154a908da1 |grep SSD
SSDTagging6
The command output indicates if a listed device is tagged as SSD.
  • Is SSD: true
What to do next
If the SSD device that you want to tag is shared among multiple hosts, make sure that you tag the device from all the hosts that share the device.

Thursday 28 July 2016

vifs for Command Line


What is vifs?
vifs allows you to perform file system operations on remote hosts. The command is supported against ESXi hosts but not against vCenter Server systems.
The vifs command performs common operations such as copy, remove, get, and put on files and directories. The command is supported against ESX/ESXi hosts but not against vCenter Server systems.
Note: While there are some similarities between vifs and DOS or Unix file system management utilities, there are also many differences. For example, vifs does not support wildcard characters or current directories and, as a result, relative path names. Use vifs only as documented.
Note: To use vifs, you will need vCLI installed on  either a Windows/Linux system or you may use VMware vMA
Options using vCLI
vifs
Examples
Note: On Windows, the extension .pl is required for vicfg- commands, but not for ESXCLI.
The following examples assume you are specifying connection options, either explicitly or, for example, by specifying the server, user name, and password. Run vifs –help or vifs.pl –help for a list of common options including connection options.
  • Copy a file to another location:
vifs – -server server01 -c “[StorageName] VM/VM.vmx” “[StorageName] VM_backup/VM.vmx”
  • List all the datastores:
vifs – -server server01 -S
  • List all the directories:
vifs – -server server01 -D “[StorageName] vm”
  • Upload a file to the remote datastore:
vifs – -server server01 -p “tmp/backup/VM.pl”
“[StorageName] VM/VM.txt” -Z “ha-datacenter”
  • Delete a file:
vifs – -server server01 -r “[StorageName] VM/VM.txt” -Z “ha-datacenter”
  • List the paths to all datacenters available in the server:
vifs – -server server01 -C
  • Download a file on the host to a local path:
vifs – -server server01 -g  “[StorageName] VM/VM.txt”
-Z “ha-datacenter” “tmp/backup/VM.txt”
  • Move a file to another location:
vifs – -server server01 -m  “[StorageName] VM/VM.vmx”
“[StorageName] vm/vm_backup.vmx” -Z “ha-datacenter”
  • Remove an existing directory:
vifs – -server server01 -R “[StorageName] VM/VM” -Z “ha-datacenter””
Note:
The vifs utility, in addition to providing datastore file management also provides an interface for manipulating files residing on a vSphere host. These interfaces are exposed as URLs:
  • https://esxi-host/host
  • https://esxi-host/folder
  • https://esxi-host/tmp