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:
- run vi /tmp/unassoc.txt
- Hit the "Insert" Key
- Paste the output copied from step 5
- Ensure the selected output from step 5 is pasted correctly, it should look similar to the above screenshot
- 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.txtNotes:
- 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