Procedures for identifying Unassociated vSAN objects.
search cancel

Procedures for identifying Unassociated vSAN objects.

book

Article ID: 326864

calendar_today

Updated On:

Products

VMware vSAN

Issue/Introduction

This article outlines what "Unassociated objects" are and procedures for identifying them so that they can be managed accordingly.

Impact/Risks:
Unused/unneeded unassociated objects can eat up valuable usable space on the vSAN datastore which could also result in the datastore filling up if not managed properly.

Environment

VMware vSAN 8.0.x
VMware vSAN 7.0.x
 

Cause

Unassociated does not necessarily mean unused/unneeded as any vSAN object that is not associated with a registered Virtual Machine will appear as 'Unassociated' when checked via RVC when using vsan.obj_status_report -t <pathToCluster> .

There are many instances of what gets classified as an Unassociated object but this doesn't mean the objects are unhealthy and should be removed, below are typical examples and not an exhaustive list:
  • Any VM data objects (e.g. namespace, vmdk, snapshot, vswap, vmem) of a VM that is not currently registered in vCenter inventory.
  • vSAN iSCSI target vmdk and namespace objects.
  • vSAN File Services root file system and shares.
  • Content Library namespace objects.
  • vSAN stats objects used for storing vSAN Performance data.
  • vswp objects belonging to some appliance e.g. NSX controllers, vRLI appliances and vROPS appliances.
  • AppVols
  • Replicated VMs in DR sites
  • VDI environments
  • Templates

Resolution

Prior to performing any actions that could potentially cause loss of data such as deleting vSAN objects, care should always be taken to positively identify the Object(s) and confirm that they are not needed and are safe to delete.


Steps to identify unassociated objects:

1. Open an SSH session to the vCenter appliance
2. Log into RVC with "rvc localhost" if still using [email protected] otherwise log in as rvc administrator@<domain>.local@localhost
3. Navigate to the vSAN cluster you want to check for unassociated objects like so

4. Get the list of unassociated objects by running "vsan.obj_status_report -t .", all Unassociated objects will be at the very end of the output.
5. Copy the list of the unassociated Object UUIDs like so

6. Open an SSH session to one of the ESXi hosts in the cluster and create a text file by doing the following:
  1. run vi /tmp/unassoc.txt
  2. Hit the "Insert" Key
  3. Paste the output copied from step 5
  4. Ensure the selected output from step 5 is pasted correctly, it should look similar to the above screenshot
  5. If the pasted output looks correct then hit the "Esc" key followed by ":wq!" to save the file
7. Edit the file down to just a list of UUIDs by running the following command.
cat /tmp/unassoc.txt | awk '{print $2}' | grep '^[0-9a-f]' >> /tmp/uuids.txt

8. Run the following command to generate a list of friendly names to UUIDs for review:

for i in `cat /tmp/uuids.txt`; do python -c "print('*' * 150)";/usr/lib/vmware/osfs/bin/objtool getAttr -u $i | grep -E 'UUID|friendly|class|Object path'; done > unassociated_objects.txt

Notes:
  • There are times when 100s or even 1000s of unassociated objects can be present so it's best to create a text file of the output and use an FTP client like WinSCP to pull the file down from the host for easier review.
  • Ensure to double/triple-check the list to ensure the unassociated objects can be safely deleted. It's critical to do this because once the objects are deleted there is no getting them back and can lead to potential data loss if the wrong objects are deleted.
  • VMware is not able to advise on what data can be safely deleted, this is up to the owner of the data. 
  • If there are any objects that shouldn't be deleted ensure to remove the UUIDs from the uuids.txt file
Once you have the file uuids.txt containing ONLY the UUIDs to be deleted, if you need assistance with options to delete these objects, engage vSAN support for assistance.


Identification can also be done via PowerCLI

Run the following PowerCLI script:

$clustername = "Cluster-01"
$clusterView = Get-Cluster $ClusterName
$ClusterMoRef = $Clusterview.ExtensionData.MoRef
$vmhost = ($clusterView | Get-VMHost) | select -First 1
$vsanIntSys = Get-View $vmhost.ExtensionData.configManager.vsanInternalSystem

$vsanClusterObjectSys = Get-VsanView -Id VsanObjectSystem-vsan-cluster-object-system
$results = (($vsanClusterObjectSys.VsanQueryObjectIdentities($clusterMoRef,$null,$null,$true,$true,$false)).Identities | where {$_.Vm -eq $null})

foreach ($result in $results) {
$jsonResult = ($vsanIntSys.GetVsanObjExtAttrs($result.Uuid)) | ConvertFrom-JSON
foreach ($object in $jsonResult | Get-Member) {
if($($object.Name) -ne "Equals" -and $($object.Name) -ne "GetHashCode" -and $($object.Name) -ne "GetType" -and $($object.Name) -ne "ToString") {
$objectID = $object.name
$jsonResult.$($objectID)
}
}
}


## Each Unassociated object will have the following structure:

UUID                : ca253f5c-a897-3421-73ec-############
Object type         : vsan
Object size         : 273804165120
User friendly name  : MGMT-VCG-02
HA metadata         : (null)
Allocation type     : Thin
Policy              : (("stripeWidth" i1) ("cacheReservation" i0) ("proportionalCapacity" (i0 i100)) ("hostFailuresToTolerate" i1) ("forceProvisioning" i0)
                      ("spbmProfileId" "aa6d5a82-1c88-45da-85d3-############") ("spbmProfileGenerationNumber" l+0) ("objectVersion" i7) ("CSN" l72) ("SCSN" l76)
                      ("spbmProfileName" "vSAN Default Storage Policy"))
Object class        : vmnamespace
Object capabilities : NONE
Object path         : /vmfs/volumes/vsan:########-########-####-####-####-########fed0/MGMT-VCG-02
Group uuid          : 00000000-0000-0000-0000-000000000000
Container uuid      : 00000000-0000-0000-0000-000000000000


Additional Information