Moving data between shares with different caching rules behaves unexpectedly

Go to solution Solved by remotevisitor,

Recommended Posts

Hi all,


I have two shares, downloads and Media.  Downloads uses a cache pool and Media does not.  When a download finishes, I ssh in and 

mv downloads/some_dir/ /mnt/user/Media/.

But this results in two copies of the data, one in /mnt/cache/Media/some_dir/ and the other in /mnt/disk1/Media/some_dir/.  It seems like this is some kind of conflict between the default Linux mv behavior, which simply changes the reference for where data is stored when moving data on the same physical disk, and the UNRAID behavior that follows caching rules.  


Is this expected/desired behavior?  It seems very counter-intuitive to me and it results in a warning from Common Problems because a share that doesn't use a cache gets a path on a cache drive.  It also raises questions to me about how reads will behave and if there are potential race conditions (seems unlikely but possible).  

Link to comment
  • Solution

Short answer yes.    But as you say it isn’t very intuitive.


The placement rules apply to new files.    The mv command isn’t creating a new file, just renaming an existing file so the placement rules do not apply.


You have 2 possible choices:

  • Set the Media share’s cache setting to ‘Yes’ rather than ‘No’ and mover will subsequently move the files from the cache drive to the data drives.
  • change your command to
    mv downloads/some_dir/ /mnt/user0/Media/.

    As share views in user0 does not include the cache drive this forces the mv command to do a copy/delete rather than just a rename.

  • Like 1
Link to comment

There should never be 2 copies of the same file in Unraid so are you sure that is what is happening?    I would expect the file to stay on the cache drive and not get moved to the array due to how Linux handles mv.     As was said using /mnt/user0 should work.

Link to comment

The modified move command makes sense to me and I can change my commands accordingly. 


But I seem to be getting conflicting information here in that I absolutely am getting duplicate files and I can delete the one on the cache without removing the one on the array disk (checked and double-checked but I'll check again later today to confirm). 

Edited by JokesOnYou77
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.

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.