# Purging OC\_STORAGES and OC\_FILECACHE

**URL:** <https://help.nextcloud.com/t/purging-oc-storages-and-oc-filecache/84441>\
**Category:** ℹ️ Support\
**Tags:** oc\_filecache\
**Created:** [June 11, 2020, 10:20pm UTC](https://help.nextcloud.com/t/purging-oc-storages-and-oc-filecache/84441 "2020-06-11T22:20:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [February 19, 2021, 10:33pm UTC](https://help.nextcloud.com/t/purging-oc-storages-and-oc-filecache/84441/2 "2021-02-19T22:33:20Z")

</div>

I followed number of post here and on github, unfortunately I have no references by hand. There is a known bug/misconception in nextcloud which turns into issue

- storages, most often related to external storage used by multiple users is indexed multiple times
- storages removed from NC config remain in DB (check oc\_storages DB table)
- records in oc\_filecache table remain there (at least until corresponding storage is removed/or forever)

there was an issue on github discussing this more in depth and it looks there is an improvement now filecache records removed by occ files:scan --all/files:cleanup

at least for me running NC 19.0.8 following procedure helped:

- enable external\_files app (was removed earlier due to performance issues)
- remove all configured storages
- some external storages are still listed in oc\_storages table
- review this records  
`select * from oc_storages where id like 'smb:%'`
- review this records  
`delete from oc_storages where id like 'smb:%'`
- run occ files:cleanup

as a result it removed 160k stale records from file cache.

- running ALTER TABLE oc\_filecache FORCE;  
returned free space as described [here](https://github.com/nextcloud/server/issues/7312)

hopefully this helps!

---

_[View the full topic](https://help.nextcloud.com/t/purging-oc-storages-and-oc-filecache/84441)._
