How do I delete files attached with media entity? Background:

drupal 8.4.2

custom media solution

Issue

I can not delete files permanently which created as media entity.

Reproduce


Created an image media entity.
/admin/content/files claims status permanent and used in 2 places.
After deleting newly created media entity from UI /admin/content/media.
/admin/content/files says status permanent and used in 1 places.


Even cron run after 6 hours (as described in file settings) file still exist on the server.

Is there any safest or best way to delete those unused file permanently?
You have to delete old versions of entities (articles etc.) where you used the files for the files to get the "used in 0 places" under /admin/content/files. After that status should be changed to temporary with option make_unused_managed_files_temporary set to true.