How to move, nightly, one directory tree and files?


Recommended Posts

I've never really used mover as I haven't had a need for it really. I've read about it and it seems that it copies any and all information on the cache drive to the array. I have lots of stuff on the cache drive that I don't care to be copied. There is a lot of "appdata", VMs, etc... that are perfect where they are and definitely don't need moved, let along copied. I will create a backup of them once in a while if I feel necessary, but that's beside the point.

 

I have one particular folder that has subfolders and files that I'd like to move and I only want to move that one folder tree and that's it. It is currently for surveillance video footage. It'll fill up my SSD in a few days if I don't do this and I don't want it constantly writing to the array keeping the disks spun up all day long. This is just a temporary setup that I'm using before implementing a full on system just for surveillance. This system could be in place for 6 months to a year as I work through exactly how I want to do everything. Anyways, what's the best way to go about this??

 

I appreciate any input.

Link to comment

I setup this last week when I took one of my drives out of my cache pool, so I had only a second drive.  I use this two/three scripts in tandem to move files to the array when my cache drive gets to a certain limit.  It's a bit clunky, but it works

 

add diskmv script - I added it via custom scripts

 

- I then created custom diskmv commands to move files:

 

#!/bin/bash

echo "$(date "+%d.%m.%Y %T") INFO: moving downloads_import."

/boot/config/plugins/user.scripts/scripts/diskmv/script -f -v "/mnt/user/downloads_import" cache disk5
/boot/config/plugins/user.scripts/scripts/diskmv/script -f -v "/mnt/user/downloads_import" cache disk6

exit

I've added two disks just in case disk5 is full

 

- then use this script to set your min and max disk used thresholds - mine is set to run hourly and the script triggers the mover script above

 

#!/usr/bin/php

<?PHP

$min = 80;
$max = 100;

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

if (($min <= $percentUsed) and ($percentUsed <= $max)) {
  exec("/boot/config/plugins/user.scripts/scripts/diskmv_all/script");
}
?>

 

Link to comment

If this folder is actually a share then all you need to do is go to the share tab in the web UI click on the share and set ‘Use cache disk’ to ‘yes’.

 

This will invoke mover once a day (unless you change the default schedule) for this share and move the files from the cache drive to the array.

 

job done.

Edited by remotevisitor
Link to comment
42 minutes ago, live4soccer7 said:

I've read about it and it seems that it copies any and all information on the cache drive to the array.

You have apparently misunderstood what you read. Mover moves cache-yes user shares from cache to array, moves cache-prefer user shares from array to cache, and doesn't move anything else.

 

https://forums.unraid.net/topic/46802-faq-for-unraid-v6/?page=2#comment-537383

 

Link to comment

So I've had a little time to take a look at the actual mover script on github. The condition is: shareUseCache="yes"

 

There are a few instances where a share can be setup to use the cache. There is ONLY, YES, PREFER

 

Can someone confirm that mover will only effect the if the share is set to YES and not the other two options? I just don't want it to move stuff that I'm not expecting as it would really mess me up.

Link to comment

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.