# VMWare - Delete inaccessible datastore

### Rename the store

Use the web client to rename each store and a DEL in front of the name

### Access the shell of the appliance server and then the database

```shell
VMware vCenter Server 8.0.2.00300

Type: vCenter Server with an embedded Platform Services Controller

Connected to service
* List APIs: "help api list"
* List Plugins: "help pi list"
* Launch BASH: "shell"

Command> shell
Shell access is granted to root
root@vcenter80 [ ~ ]#
```

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

### View the stores

This will give you the ID that is needed to clean up

```shell
SELECT * FROM vpx_entity; 
```

### Delete the store

This is the delete for cleaning up the inaccessible datastore

<table border="1" id="bkmrk-delete-from-vpx_ds_a" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>DELETE FROM vpx\_ds\_assignment WHERE ds\_id=1015;  
DELETE FROM vpx\_datastore WHERE id=1015;  
DELETE FROM vpx\_vm\_ds\_space WHERE ds\_id=1015;  
DELETE from vpx\_entity where id=1015;</td></tr></tbody></table>

Change the ID and then run the following

```bash
DELETE FROM vpx_ds_assignment WHERE ds_id=5015;DELETE FROM vpx_datastore WHERE id=5015;DELETE FROM vpx_vm_ds_space WHERE ds_id=5015;DELETE from vpx_entity where id=5015;
```

### Restart the services

```shell
\q;service-control --stop --all && service-control --start --all
```