Delete old smb folder from cli

Hi, i will expand later as you ask, but for now the problem explanation.
I move my nextcloud cloud server to a new host, also at the same time i move some smb share folder to a new host also. When i open the new nextcloud i can use it normally, but the old smb sharefolder are still there, if i go to admin setup it gave an error “internal server error” and show me the old smd sharefolder ip, but i can edit anything. If i go to the user external folder setup i can see the older folders but i can’t edit them.
Now I’m going toi work, when i return i will try what ever you recommend and search for anything you ask.

PD: As I promise this is my system info:
Ubuntu Server 18.04.4 LTS
Nexcloud 18.0.1
Apache: Apache/2.4.29 (Ubuntu)
PHP: PHP 7.2.24-0ubuntu0.18.04.3 (cli)

This is the error log when i tried to open admin external folder menu.
Martin is my user and was the ip of nextcloud old server.

[index] Error: Exception: HMAC does not match. at <>

  1. /var/www/nextcloud/lib/private/Security/CredentialsManager.php line 93
    OC\Security\Crypto->decrypt("*** sensitive parameters replaced ***")
  2. /var/www/nextcloud/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php line 56
    OC\Security\CredentialsManager->retrieve("", “password::global”)
  3. /var/www/nextcloud/apps/files_external/lib/Settings/Admin.php line 71
  4. /var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php line 141
  5. /var/www/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php line 83
    OCA\Settings\Controller\AdminSettingsController->formatSettings({40: [OCA\Files_ … ]})
  6. /var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php line 152
  7. /var/www/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php line 68
    OCA\Settings\Controller\AdminSettingsController->getIndexResponse(“admin”, “externalstorages”)
  8. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
  9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 99
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings\Con … {}, “index”)
  10. /var/www/nextcloud/lib/private/AppFramework/App.php line 125
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings\Con … {}, “index”)
  11. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main(“OCA\Settings\ … r”, “index”, OC\AppFramework\ … {}, {section: "exter … "})
  12. <>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({section: "exter … "})
  13. /var/www/nextcloud/lib/private/Route/Router.php line 299
    call_user_func(OC\AppFramework\ … {}, {section: "exter … "})
  14. /var/www/nextcloud/lib/base.php line 1008
  15. /var/www/nextcloud/index.php line 38

GET /nextcloud/index.php/settings/admin/externalstorages
from by martin at 2020-03-12T03:53:07+00:00

This is the error in the nextcloud new server.

That was a nice topic with solution that seems could help you: Files amount after moving of data directory is wrong (much bigger).

Just check via command line your shares and find out ID of your old SMB:


Then simply delete unneeded SMB ID:

And run command sudo -u www-data php occ files:cleanup to do rescan of the files and DB:

Thanks for your answer, but the command mysql -e ‘select * from nextcloud.oc_storages’ , return nothing but variables and the help info.
When i run files_external:list only show my new smb folders mount. Not the old ones, and when i run files:cleanup return:
0 orphaned file cache entries deleted.