Removing stale PVC snapshot shown as “Inaccessible” in vSAN Virtual Objects view
search cancel

Removing stale PVC snapshot shown as “Inaccessible” in vSAN Virtual Objects view

book

Article ID: 442878

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

You are observing orphaned vSAN container volume snapshot objects (PVC-based snapshots) that are Marked as “Inaccessible” in vSAN Virtual Objects view

Environment

vCenter:8.0.3 and vSAN:8.0.3

Cause

These objects are stale PVC snapshots requiring backend cleanup.

Resolution

1. Identify Stale Snapshots
SSH into the vCenter Server Appliance as root and access the database:

/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

2. Run the following query to identify volumes with snapshots and their corresponding datastore MOIDs:

with a as (
   select v.volume_name, v.volume_id, count(s.snapshot_id)
   from cns.volume_info v
   left join cns.vpx_storage_snapshot_info s on s.volume_id=v.volume_id
   WHERE v.is_cns_volume
   GROUP by v.volume_name, v.volume_id
   HAVING count(s.snapshot_id) > 0
)
select
   v.volume_id,
   (select 'moid: '||'datastore-'||id|| ' name: '||name from vpx_datastore where storage_url=v.datastore) as datastore,
   s.snapshot_id
from cns.volume_info v
left join cns.vpx_storage_snapshot_info s on s.volume_id=v.volume_id
WHERE v.volume_name in (select a.volume_name from a)
order by v.volume_id, s.create_time;

Take note of the volume_id, datastore (MOID and name), and snapshot_id.

3. Remove the snapshot , either using the mob or govc

a. Remove Snapshots using Managed Object Browser (MOB)

    1. Navigate to: https://<vcenter-address>/mob/?moid=VStorageObjectManager&method=deleteSnapshot_task
    2. Populate the following parameters obtained from the SQL query:
      • id: The volume_id
      • datastore: The datastore MOID (e.g., datastore-123)
      • snapshotId: The snapshot_id
    3. Click Invoke Method.
    4. Monitor the task in the vCenter Task Console

b. Alternatively: Remove Snapshots using govc

If the MOB is inaccessible, use the govc utility:

  • List snapshots: govc disk.snapshot.ls -ds <datastore-name> <volume-id>
  • Remove snapshot: govc disk.snapshot.rm -ds <datastore-name> <volume-id> <snapshot-id>

Additional Information

Related Articles