Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Plugin] Mover Tuning

Featured Replies

37 minutes ago, norgoe said:

Would be great if this check could be disabled on a per share base, to have it active on other shares.

I will check it

  • Replies 3.5k
  • Views 486.3k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • hugenbdd
    hugenbdd

    New Version 07-03-2023   HUGE thanks/Shout-out to @Swarles for the help with updating code fixes and adding a great new feature.  You can now have some customization per share.  It's great t

  • How to ignore a SINGLE file 1.) Find the path of the file you wish to ignore.     ls -ltr /mnt/cache/Download/complete/test.txt         root@Tower:/# ls -ltr /mnt/cache/Download/complete/test

  • Hi all, I made a new version of the plugin. This fork replaces @hugenbdd's plugin which is not maintained anymore and will land in community applications if your feedbacks are positive.  

Posted Images

18 minutes ago, Masterwishx said:

No, clean only parent folder of moved files

Ah... This explains my issue. In fact, it seems intended. Empty folders are not being moved / deleted. It only deletes folders that had files that were moved?

Just now, steve1977 said:

only deletes folders that had files that were moved?

Yep, this is what description says 

58 minutes ago, wambo said:

guess the next option is uninstall and reinstall, can I just save the 'ca.mover.tuning.cfg' and overwrite it afterwards? 

I think you can try use old config 

7 hours ago, steve1977 said:

Ah... This explains my issue. In fact, it seems intended. Empty folders are not being moved / deleted. It only deletes folders that had files that were moved?

#!/bin/bash

# Function to delete empty directories
delete_empty_dirs() {
  local search_dir=$1
  find "$search_dir" -mindepth 2 -type d -empty -exec rmdir {} \;
}

# Perform the deletion recursively for specified directories
perform_recursive_deletion() {
  local search_dir=$1
  while [ "$(find "$search_dir" -mindepth 2 -type d -empty)" ]; do
    delete_empty_dirs "$search_dir"
  done
}

dirs_to_search=(
    "/mnt/cache/data/media"
    "/mnt/cache/data/torrents"
    "/mnt/cache/data/cross-seed-links"
)

# Combine original entries with modified ones
new_dirs_to_search=("${dirs_to_search[@]}") # Start with original directories
for dir in "${dirs_to_search[@]}"; do
  for i in {1..10}; do
    new_dirs_to_search+=("${dir//\/cache\//\/disk$i\/}")
  done
done

# Use the combined list of directories
dirs_to_search=("${new_dirs_to_search[@]}")

for dir in "${dirs_to_search[@]}"; do
  echo "Processing directory: $dir"
  perform_recursive_deletion "$dir"
done

echo "Deletion of empty directories completed."



I use this as a post script on the mover because I wanted to do exactly this.  It's pretty common for something like:

 

plex_library/tv_series/season/episode.ext

 

and an entire season/tv series to be moved from the cache to the array once it becomes old.  So then I would have a bunch of /tv_series/ sitting empty on the cache drive. 

 

The script should empty out those folders (although there will be some error messages about "no such file or directory" in the output.  You could probably update it to be nicer/work over all directories, but I just needed something quick and for specific directories.

9 hours ago, wambo said:

Fix Commons Problems made me aware that I'm stuck on an outdated version (2023.12.19) and recommends going with the version by masterwishx.
I can find it in Apps but sadly updating does not work (it starts but skips after noticing that 2023.12.19 is installed - see log below)

I guess the next option is uninstall and reinstall, can I just save the 'ca.mover.tuning.cfg' and overwrite it afterwards? 
 

plugin: updating: ca.mover.tuning.plg
Executing hook script: pre_plugin_checks
7.0.1
+==============================================================================
| Skipping package ca.mover.tuning-2023.12.19-x86_64-1 (already installed)
+==============================================================================
Backup current mover binary, command may fail depending on version of unRAID
Creating Soft link for 6.12 RC8 or newer since /usr/local/sbin/move is now lcoated in /usr/local/bin/move
----------------------------------------------------
ca.mover.tuning has been installed.
Copyright 2018, Andrew Zawadzki
Version: 2023.12.19
----------------------------------------------------
plugin: ca.mover.tuning.plg updated
Executing hook script: post_plugin_checks
Updating support link

 

i believe you need to uninstall the version you have now, reboot unraid, then install the new version

8 hours ago, Masterwishx said:

No, clean only parent folder of moved files

Thanks for the reply and thanks for the help.  With this being the intended function, storage locations of docker containers such as Minio will always be left with hundreds or thousands of empty folders after running the mover.  Nearly every file created within a Minio storage location is created within multiple nested folders.  As new files are added, they are placed within newly created nested folder structure.  Therefore it would seem the tuning plugin will always leave many empty folders after the mover runs.  Is there another mechanism to remove the empty folders left behind or should I look towards writing a script to clean up those empty folders?

9 hours ago, Droidguy759 said:

should I look towards writing a script to clean up those empty folders?

You can use script by @ronia posted above

On 4/5/2025 at 10:25 AM, Masterwishx said:

Will try to check it

Is there a way that I can help you with this?

4 hours ago, silverkin said:

Is there a way that I can help you with this?

I need to check the code for this, but you or any user can help with :

1. Make pr or open issue in github

2. Make donation

3. Test the code befor released

 

You can choose whatever you like

 

Edited by Masterwishx

Hi,

 

When using the latest mover tuning 2025.04.05 on Unraid 6.12.15, mover tuning doesn't respect the minimum space setting that I have for my share. For example, with my allocation method set to Fill Up and min space set to 250 GB per drive, mover tuning will still write to disk1 (for example) even if it already had < 250 GB of free space, instead of skipping disk1 and writing to the next disk that fit my allocation + min disk space criteria.

 

Furthermore, mover tuning will also try to write a file to a disk even when that file is larger than the free space left on that disk, causing mover to write to that disk until it has 0 kB of free space and then fail with an "out of space" error.

 

If I uninstall the plugin and go back to using stock mover, it behaves as expected.

 

Is this known behavior of the plugin?

Edited by msalad

6 minutes ago, msalad said:

Is this known behavior of the plugin?

Yep, if i remember correctly the code

1 hour ago, msalad said:

Furthermore, mover tuning will also try to write a file to a disk even when that file is larger than the free space left on that disk, causing mover to write to that disk until it has 0 kB of free space and then fail with an "out of space" error.

You can open issue in github for it

10 hours ago, Masterwishx said:

Yep, if i remember correctly the code

Is there a way to make the mover tuning plugin respect the share min space setting? Maybe there's a setting I'm not seeing? I'm not sure I understand why the plugin is built to disregard that

 

9 hours ago, Masterwishx said:

You can open issue in github for it

Will do, thanks!

2 hours ago, msalad said:

Is there a way to make the mover tuning plugin respect the share min space setting

It's need more coding to add. 

Unraid mover = mover + binary move

Plugin = age_mover + rsync

 

So this part is in code of binary move file I think. 

 

I will try to add this future to plugin. Still need to fix some bugs. 

 

maybe if possible also to add option for binary move or rsync but then some options maybe unavailable then like rebalance etc. 

Edited by Masterwishx

18 minutes ago, Masterwishx said:

It's need more coding to add. 

Unraid mover = mover + binary move

Plugin = age_mover + rsync

 

So this part is in code of binary move file I think. 

 

I will try to add this future to plugin. Still need to fix some bugs. 

 

maybe if possible also to add binary move instead rsync but then some options maybe unavailable then like rebalance etc. 

I heard one advantage of using Unraid's mover binary, is that it can also move hardlinks.  Was speaking with some other unraid users in another forum and they were pretty confident in this ability.  That would be an extremely useful feature if it could be made possible.

29 minutes ago, ronia said:

heard one advantage of using Unraid's mover binary, is that it can also move hardlinks.

You can use it already in plugin. 

Edited by Masterwishx

1 minute ago, Masterwishx said:

You can use it in plugin! 

Oooh, how do I set that up?

Just now, msalad said:

Oooh, how do I set that up?

Hardlinks already in code for rsync, no option needed

8 minutes ago, Masterwishx said:

Hardlinks already in code for rsync, no option needed

Oh, good to know. I thought you were talking about using the stock mover binary hehe

10 hours ago, Masterwishx said:

Hardlinks already in code for rsync, no option needed

Really?  I don't think that's true.  This is what happens when a file is hardlinked:

 

Apr  7 05:00:08 Dammerung move: *********************************************************** LET THE MOVING SHOW BEGIN ! *********************************************************
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e03-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e01-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e06-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e02-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e04-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e05-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e08-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e07-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e10-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: Expected 3 files, got 1. Not moving "/mnt/cache/./data/media/tv2/Silo/Season 02/Silo (2023)-s02e09-NTb-WEBDL-1080p.mkv"  to prevent breaking hardlinks
Apr  7 05:00:08 Dammerung move: ------------------------------------------------------------------- Cleaning up -----------------------------------------------------------------

 

The official mover is apparently able to handle the hardlink and move both the hardlinks and the file to the array.  

 

Again, I don't know if this is true as I don't have the original mover setup and I'm not in a position to do so.  Just something I had heard that I thought was interesting.

36 minutes ago, ronia said:

Really?  I don't think that's true.  This is what happens when a file is hardlinked:

I'm saying from what I saw in code, the code is supposed to handle hard links.

if it's not working for you, can be be issue in you case, or maybe some bug. not checked yet becouse fixed and added other things.

 

As you can see, you have some message for it? 

58 minutes ago, ronia said:

Really?  I don't think that's true.

Just a part of the code:

```

# Skip filesize = 0 (hardlinks already handled in a previous loop)
            NBLINKS="${NBLINKS:-0}"
            if [ "$NBLINKS" -gt 1 ] && [ "$FILESIZE" = 0 ]; then
                continue
            fi
            #Prepare RSYNC_CMD
            RSYNC_CMD="rsync --archive --xattrs --relative --hard-links"
```

Investigating this further and I have a theory.  I think the only way that we can hit this line:

 

            # Check if list is complete
            NBFILES=$(($(echo "$SYNCED_FILES" | grep -o '" "' | wc -l) + 1))
            if [ $NBFILES != $NBLINKS ]; then
                mvlogger "Expected $NBLINKS files, got $NBFILES. Not moving $SYNCED_FILES to prevent breaking hardlinks"
                continue
            fi

 

Is if the transfer list is incomplete and missing hardlinks.  From the rsync help documentation:

Quote

Note that rsync can only detect hard links between files that are inside

the transfer set. If rsync updates a file that has extra hard-link connections to files outside the transfer, that linkage will be broken. If you are tempted to use the --inplace option to avoid this breakage, be very careful that you know how your files are being updated so that you are certain that no unintended changes happen due to lingering hard links (and see the --inplace option for more caveats).

Which is probably what this check is intended for.

 

I remembered that I had added a bunch of folders to my exclusion list and at least one entry in my example log could have been in the exclusion list.  I will see tonight whether or not removing that exclusion will cause cause the hardlinks to move correctly.

 

So a lot of words to say that I probably screwed up 🤣

Edited by ronia

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.