"Datastore conflicts with an existing datastore in the datacenter that has the same URL" error in vCenter Server
search cancel

"Datastore conflicts with an existing datastore in the datacenter that has the same URL" error in vCenter Server

book

Article ID: 316577

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction



    Symptoms:
    When adding an ESXi host to a vCenter Server that was previously part of a datacenter or cluster from another vCenter Server, you experience these symptoms:
    • Adding the ESXi host fails.
    • You see the error similar to:

      Datastore 'datastorename(XX)' conflicts with an existing datastore in the datacenter that has the same URL (ds://vmfs/volumes/UUID/), but is backed by different physical storage.

      Datastore 'datastorename(XX)' conflicts with an existing datastore in the datacenter that has the same URL (ds://vmfs/volumes/UUID/), but is backed by different physical storage.
       
    • Multiple ESXi hosts in the same cluster may become unresponsive or go to a Disconnected or Not Responding state as a result of the attempt to add the ESXi host.


    Environment

    VMware vSphere 6.7.x
    VMware vSphere ESXi 7.0.x
    VMware vSphere ESXi 6.5
    VMware vSphere ESXi 7.0.0

    Cause

    This issue occurs due to a duplicate entry of the datastore UUID in the vCenter Server database.

    Resolution

    Ensure a snapshot is taken of the vCenter VM. Then, to resolve this issue:
    1. Connect to the VCSA through SSH.
    2. Access the Bash Shell with the command shell.set --enabled true or just type shell.
    3. Stop the vpxd service with the command: service-control --stop vmware-vpxd
       
    4. Access the Postgres DB using this command: 

      /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
       
    5. vCenter 6.5: Run the query select id,storage_url from vpx_datastore;
    6. vCenter 6.7/7.x: select * from vpx_datastore;
      • ​​​​​​​Alternatively, you may also run:
    select * from vpx_datastore where storage_url='<storage URL from the error message>';
    1. Look for the affected datastore (DS) UUID and find the ID.
    2. To confirm the correct ID as needed, run select * from vpx_entity where id=(ID found on previous step);
    3. Delete the entry from vpx_ds_assignment, vpx_vm_ds_space, vpx_datastore and vpx_entity using query delete from vpx_ds_assignment where DS_id=XXXX; 

      Sample were the ID = 461:

      delete from vpx_ds_assignment where ds_id=461;
      delete from vpx_vm_ds_space where ds_id=461;
      delete from vpx_datastore where id=461;
      delete from vpx_entity where id=461;
    4. To quit from database use \q
    5. Start the vmware-vpxd service in order for changes to be reflected:

      service-control --start vmware-vpxd
       
    6. Once the vmware-vpxd service is up again, proceed to add the ESXi host again back to the vCenter Server.


    Additional Information

    Impact/Risks:
    This process interacts directly with the vCenter Server Appliance (VCSA) Postgres Database, and it is recommended to have a snapshot of the VCSA prior to proceeding.