My VMware blog

To help others as others have helped me

How to add a new VMFS Datastore via PowerCLI

I recently wanted to know how to add a new iSCSI LUN as a new VMFS datastore via the PowerCLI. After some initial research and searching the online PowerCLI help I figured out the steps needed to complete such a task.

To add a new LUN as a new VMFS Datastore follow these instructions;

  1. Configure your storage system to present a LUN to the ESXi host
  2. Open PowerCLI
  3. Connect to your host
    Connect-VIServer -Server -User admin -Password pass
  4. First we need to rescan the iSCSI HBA for new storage
    Get-VMHostStorage -RescanAllHba
  5. After we have scanned we now need to list all the iSCSI storage available and to do this run the following command
  6. The previous command will return all the iSCSI storage you need to identify the newly added storage. (Size, vendor information may help)
  7. Copy the ID and type the following command
    $sLUN – Get-ScsiLun –ID {your ID here}
  8. Now that we have the iSCSI LUN information stored in our variable $sLUN we can use it in the following command to add the storage to our host
    New-Datastore –Name YourDatastoreName –Path $sLUN.CanonicalName –Vmfs
  9. Once the command has been run your host will recognise the new datastore.

For more information on the available parameters for the New-Datastore command can be found here.

, , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>