[mythtv-users] Excessive disk usage in remotecache on Raspberry Pi

Peter Bennett cats22 at comcast.net
Fri Dec 2 19:16:41 UTC 2016


On 12/02/2016 01:38 PM, Michael T. Dean wrote:
> On 12/02/2016 11:16 AM, Peter Bennett wrote:
>> One of my raspberry Pi's started acting strangely a few days ago and I
>> found it had run out of disk space.
>>
>> The raspberry Pi disk is an 8 GB SD card.
>>
>> I found that the directory ~/.mythtv/cache/remotecache was using 1.2 GB.
>> On a normal frontend this may not be an issue but on a Raspberry Pi with
>> only 8 GB available this can be a problem. This directory has many files
>> with names like 3707_20161124170000.ts.png.
>>
>> Can anybody tell me if this directory ever gets cleaned up by the system
>> or will it go on increasing forever. Do those files get deleted when the
>> relevant recording is deleted?
>
> No.  No one has yet implemented any cleanup there.  Users can
> (occasionally/at shutdown/before startup/...) delete the
> ~/.mythtv/remotecache directory as desired (as well as any other cache
> in ~/.mythtv, including themecache, thumbcache, and Cache-*). The only
> downside to doing so is that any images required during running will
> have to be transferred (and scaled/...) when needed.
>
> Remember that any automatic cleanup would have to consider that
> there's potentially a copy on each frontend-running system.  So,
> event-based (such as on-delete) cleanup would require messages to all
> running frontends--and would miss any disconnected/not-running
> frontends.  Also, determining that the image is no longer
> necessary/used is very difficult, especially for metadata images (some
> of which are used by any episode of the series, or for episodes that
> don't have any specific image, or ...).
>
> For a resource-constrained device like the pi, you could just clean it
> up in a shell script using find...
>
> find ~/.mythtv/remotecache -atime +7 -delete
>
> to delete any that haven't been accessed in the last 7 days, or
> whatever you like.  Put this in the startup or shutdown script for
> mythfrontend and it's semi-automatic.
>
> I'd actually suggest a similar type approach if you want to automate
> it (but not using find).  You could run a task in the frontend
> HouseKeeper that deletes any remotecache images that haven't been
> accessed in the last month or so?  Ideally you'd pick a number that
> just works for people, rather than having a setting to adjust it--and
> since you're using one of the most-resource-constrained devices, you
> should be able to find an appropriate value.  (FWIW, I don't know if
> Qt has a way to find a file's access times--it may not since not all
> file systems support ctime/mtime/atime--but if nothing else, you can
> use C/C++ code.)
>
> Mike 

Thanks Mike. I have added it to my to-do list. I should also look at
other cached files at the same time.

Peter


More information about the mythtv-users mailing list