How To – Manage Disks & Datastores in vSphere

As a VMware Administrator, from time to time you will need to manage disks & datastores in vSphere. The following post is a quick reference guide on how to complete some common datastore and local disk management tasks in a VMware environment:

Pre-Requisites to remove a Datastore from vCenter:

Before removing a datastore (local or not) ensure the following criteria has been met:

  • If the LUN is being used as a VMFS datastore, all objects (such as virtual machines, snapshots, and templates) stored on the VMFS datastore are unregistered or moved to another datastore
  • The datastore is not used for vSphere HA heartbeat
  • The datastore is not part of a datastore cluster
  • The datastore is not managed by Storage DRS
  • Storage I/O Control is disabled for the datastore
  • No third-party scripts or utilities running on the ESXi host are or can access the LUN
  • If the LUN is being used as an RDM, remove the RDM from the virtual machine
  • The datastore is not configured as a diagnostic coredump partition (see below on how to remove a coredump partition)
  • The datastore is not being used as a scratch partition (see below on how to move the scratch partition)

How To – Remove a coredump partition from a datastore:

To remove one or more coredump partition from a datastore, complete the following:

  1. Start the SSH service on the ESXi host (Configuration >> Software >> Security Profile >> Services)
  2. SSH into host (using putty or something similar)
  3. Run esxcli system coredump file list to get the list of configured coredump partitions
  4. To remove the coredump partition run esxcli system coredump file remove --force
  5. If this is a shared datastore, then repeat the steps above for every ESXi host that uses the datastore as a coredump partition

How To – Move or change a scratch partition:

To change the scratch partition of an ESXi host, complete the following:

  1. Start the SSH service on the ESXi host (Configuration >> Software >> Security Profile >> Services)
  2. SSH into host (using putty or something similar)
  3. Make a new scratch partition directory by running mkdir /tmp/scratch
  4. Launch the vSphere Client
  5. Select ESXi Host >> Configuration >> Software >> Advanced Settings >> ScratchConfig
  6. Set ScratchConfig.ConfiguredScratchLocation to /tmp/scratch
  7. Click OK to save changes

How To – Unmount a Datastore

Prior to being able to deleting or removing a datastore, you need to unmount it. To do so, complete the following:

  1. Launch the vSphere Client
  2. ESXi Host >> Configuration >> Hardware >> Storage
  3. Select the datastore
  4. Right-Click >> Unmount
  5. Click OK to error (if it appears)
  6. Reboot Host

How To – Delete a Datastore

Once you have unmounted the datastore, you can delete it by completing the following steps:

  1. Launch the vSphere Client
  2. ESXi Host >> Configuration >> Hardware >> Storage
  3. Select unmounted datastore
  4. Right-Click >> Delete

Marking a local disk as SSD

Sometimes VMware doesn’t correctly detect an SSD disk and therefore you will need to mark it as SSD manually, especially when you require an SSD for a particular feature such as vSphere Flash Read Cache (VFRC) or Host Cache.

To manually mark a disk as a local SSD complete the following steps:

  1. Start the SSH service on the ESXi host (Configuration >> Software >> Security Profile >> Services)
  2. SSH into host (using putty or something similar)
  3. Get a list of all of the disks attached to the host by running esxcli storage nmp device list
  4. You will get a result similar to:
    
    naa.6006016015301d00167ce6e2ddb3de11
    Device Display Name: DGC Fibre Channel Disk (naa.6006016015301d00167ce6e2ddb3de11)
    Storage Array Type: VMW_SATP_CX
    Storage Array Type Device Config: {navireg ipfilter}
    Path Selection Policy: VMW_PSP_MRU
    Path Selection Policy Device Config: Current Path=vmhba4:C0:T0:L25
    Working Paths: vmhba4:C0:T0:L25
    
  5. For the disk you want to mark as an SSD, take a note of the Device ID and the SATP (Storage Array Type), similar to the example below:
    
    Device ID = naa.6006016015301d00167ce6e2ddb3de11
    SATP = VMW_SATP_CX
    
  6. Run the following command to mark the device as an SSD (replacing <SATP_TYPE> and <DEVICE_ID> with the details noted above): esxcli storage nmp satp rule add --satp=<SATP_TYPE> --device <DEVICE_ID> --option "enable_ssd"
    
    esxcli storage nmp satp rule add --satp=VMW_SATP_CX --device naa.6006016015301d00167ce6e2ddb3de11 --option "enable_ssd"
    
  7. Run the following to reclaim the device: esxcli storage core claiming reclaim -d <DEVICE_ID>
    
    esxcli storage core claiming reclaim -d naa.6006016015301d00167ce6e2ddb3de11
    
  8. Confirm the disk is set to SSD by running esxcli storage core device list -d <DEVICE_ID>. From the results confirm Is SSD is set to True
    
    esxcli storage core device list -d naa.6006016015301d00167ce6e2ddb3de11
    

Any questions, comments or additional information you think I should add to this post then let me know in the comments below.

Hope this makes things easier when managing disks and datastores in VMware.

Thanks
Luca

Comments

Leave a Comment