Jump to content
Cessquill

Stop Cache from Filling Up?

10 posts in this topic Last Reply

Recommended Posts

I occasionally fill up my cache.  Because appdata and docker image are there, it means it takes down all my dockers.  Not a huge deal, since you just have to stop and start the docker service, but it's an inconvenience.

 

Is there a way for the system to not fill the cache drive up completely?  Say, leave it at 5% capacity to leave some breathing room for dockers?

 

I've got a 250GB drive, 70GB of which is in use with appdata and docker image.  The rest fills up surprisingly quickly.  Especially when a docker triggers some large downloads that are unpacked and copied to the array whilst you're asleep...

 

There may be a way to do this, and I know that the mover scripts in the user scripts plugin is one option, but throwing this out there.  Of course, a larger cache drive (or second unassigned drive) would help...

Share this post


Link to post

Under Settings->Global Share settings you can set a Min Free Space value for the cache drive.    When the free space drops below this value then writes to user shares will bypass the cache and go straight to the array.

 

Note that this will not have any effect on dockers that are configured to use /mnt/cache as this is bypassing the User Share System so can still fill up the cache.

  • Upvote 1

Share this post


Link to post
Just now, itimpi said:

Under Settings->Global Share settings you can set a Min Free Space value for the cache drive.    When the free space drops below this value then writes to user shares will bypass the cache and go straight to the array.

 

Note that this will not have any effect on dockers that are configured to use /mnt/cache as this is bypassing the User Share System so can still fill up the cache.

Ahh, that sounds like it.  AFAIK, my dockers don't have direct access to the cache (other than appdata) - they all go via shares.

Share this post


Link to post

Hey, make your download path a extra share.

 

Set it to cache: yes (so it uses cache, if possible)

Then use 

 

#!/usr/bin/php
<?PHP

$moveAt = 80;    # Adjust this value to suit.

$diskTotal = disk_total_space("/mnt/cache");
$diskFree = disk_free_space("/mnt/cache");
$percent = ($diskTotal - $diskFree) / $diskTotal * 100;

if ( $percent > $moveAt ) {
  exec("/usr/local/sbin/mover");
}
?>

 

in the plugin user scripts and set it to run every minute  (0 * * * *)

 

This way you use your cache, but when it gets full it will transfer files from SSD to HDD. So theoreticle it shouldnt fill up.

  • Upvote 1

Share this post


Link to post

Thanks for that @nuhll - I've been looking at something similar, but I couldn't get to the bottom of whether it was OK to leave the regular mover running.  Whilst I want it to kick in at - say - 80%, I also want it to run overnight as well (otherwise things might stay on there unnecessarily long).

 

The other mover thing I was looking into was a notification if a file couldn't be moved due to space (eg, new/upgraded TV episodes onto a drive that has since been filled).

 

Share this post


Link to post
Posted (edited)

As far as i know this doesnt change anything other.


So if you let ur mover run at midnight (like i do), then it will do this anyway of the script above.

 

The move to hdd only happens when SSD is full, so exactly what you want.. :) (or if the files are not moved away from temp download until midnight)

 

And even if it gets moved to hdd, its np, you move the file to your archive and then it gets delted from hdd or sdd, wherever it is.

Edited by nuhll

Share this post


Link to post

Thanks - so there isn't an issue with this script trying to trigger the mover if it is already moving?

 

(thinking about it, if it runs every minute, it's bound to try and run it a 2nd/3rd, 4th time after it's initially triggered)

Share this post


Link to post

I didnt noticed anything so far. So i guess its working.. xD

 

Problem is only when mover cant go below e.g. 80%, then it will be triggered every minute, do you mean this? I had this, didnt had much impact on system, so no real problem.

Share this post


Link to post

No, I meant the first part...

 

- drive hits +80% full

- mover triggered, may take 20 minutes

- in that time, the script might try and start the mover again after the first minute as it might still be over 80%

- or the official mover might schedule at midnight whilst it's still running

 

If the mover at  exec("/usr/local/sbin/mover") only starts if it's not running, all good :)

Share this post


Link to post

Yeah, like i said, i had this happen, but i had no problem with it, no crash no slowdown, i guess its just ignroing when you do the script while its running.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now