Skip to content

masterwishx/ca.mover.tuning

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mover Tuning

About

This is a simple Unraid plugin that will let you fine-tune the operation of the mover.

  • On scheduled runs of mover
    • Only actually move file(s) if the the cache drive is getting full (selectable threshold)
    • Optionally don't move if a parity check / rebuild is already in-progress
  • Optional ability to completely disable the scheduled runs of mover
  • Manually executed runs of mover ("Move Now" button) can either follow the rules for schedules, or always move all files

This new fork merge all pull requests after review from Hugenbd's repo (cosmetics, merge skipfiletypes from shares, 4 changes from Swarles below) and add several feature, as for example automatic age threshold and compatibility with Unraid 7.x, and other stuff coming.

How it works:

First it checks if it's valid for this script run: there must be a cache disk present and an instance of the script must not already be running.

Next, check each of the top-level directories (shares) on the cache disk. For all share with 'Use Cache' setting set to "prefer" or "yes", we use 'find' to create a filtered file list of that share directory. For all share with 'Use Cache' setting set to "only", we use 'du' or 'zfs list' to get total size of that share directory.

The list is sorted by "Use cache", increasing age, pool, and file inode, giving priority for being on cache to "cache only" shares, then "cache prefer" by moving newest from array to cache and older to array, and finally to "cache yes" share by moving only from cache to array. Please note that if age setting is set to something else than "Auto (smart cache)" this script is actually dumb and do not check for size and free space and rely on your own calculations. Files at the top level of the cache or an array disk (i.e not in a share) are never moved.

The list is then passed to original unraid mover. For each file, if the file is not "in use" by any process (as detected by 'fuser' command), then the file is moved, and upon success, deleted from the source disk. If the file already exists on the target, it is not moved and the sourceis not deleted. All meta-data of moved files/directories is preserved: permissions, ownership, extended attributes, and access/modified timestamps. If an error occurs in copying a file, the partial file, if present, is deleted and the operation continues on to the next file.

Changelog

Installation

You can download and install plugins with Community Apps.

Configuration

You'll find its settings within Settings - Scheduler.

Usage

After installation, the default settings are set so that the plugin will be in test mode. You may check /tmp/ca.mover.tuning/Mover_actions_date.list to see if your settings are correct and if the mover will move/keep/sync the files as expected.

There are several commands that can be launched from terminal or a script: /usr/local/emhttp/plugins/ca.mover.tuning/age_mover start To start age mover (the internal moving engine) with the settings you set in the GUI

/usr/local/emhttp/plugins/ca.mover.tuning/age_mover softstop To cleanly exit loops (Filtering, Deciding, Moving) and age_mover. While moving/syncing, the ongoing file transfer is not interrupted and softstop occurs after actual file operation.

/usr/local/emhttp/plugins/ca.mover.tuning/age_mover stop To kill all the process (can lead to unfinished or corrupted file transferts while moving).

See the Mover Tuning_ thread on the Unraid support forum for more details and discussions.

Thanks

This was originally created by Squid and updated by hugenbd, with contributions by Castcore, Swarles, Dphelan and Davendsai. @2025 Updated by masterwishx.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 91.7%
  • PHP 8.3%