Jaster Posted January 10, 2019 Share Posted January 10, 2019 I have a share (lets call it Source) which is set to 'use cache: yes'. Once the mover runs, it is moved to the array. Sometimes I use scrips to move files around across shares; e.g. (mv /mnt/user/Source/foo.img /mnt/user/Destination/bar.img). Destination is set up not to use the cache, but if the script runs while the file is located on the cache, it will end creating a Folder called "Destination" on the cache and moving the file there. Resulting in an orphaned File How do I prevent that, or what kind of scripting do I have to use here? Quote Link to comment
trurl Posted January 10, 2019 Share Posted January 10, 2019 Linux sees all user shares as being mounted on the same device, so when you try to move from one to the other it just renames it so it has a different path. You can copy the files instead of moving then it will use the settings of the destination share to decide where to put the file, and then you can delete it from the source. Quote Link to comment
Jaster Posted January 10, 2019 Author Share Posted January 10, 2019 I see the point, but 90% of the time moving is correct as the files are on the array. So creating that kind of overhead seems not correct and takes way longer. Maybe I could add a check if the file(s) are still on the cache? No idea if/how it is possible. Quote Link to comment
itimpi Posted January 10, 2019 Share Posted January 10, 2019 1 hour ago, Jaster said: I see the point, but 90% of the time moving is correct as the files are on the array. So creating that kind of overhead seems not correct and takes way longer. Maybe I could add a check if the file(s) are still on the cache? No idea if/how it is possible. Why not set the 'Destination' to also have Cache=Yes? That way the move of a file that is on the cache will be virtually instantaneous, and later mover will move it to the array. One thing that might help you if you want to be clever is to utilise the fact that /mnt/user0 only shows files that are on the main array, while /mnt/user shows files that are on the array or the cache. Any difference would imply a file that is only on the cache. Also there is nothing to stop you checking /mnt/cache which is a direct reference to the physical cache drive by-passing the User Share level. Quote Link to comment
trurl Posted January 10, 2019 Share Posted January 10, 2019 2 hours ago, Jaster said: So creating that kind of overhead...takes way longer. Moving between disks is a copy followed by a delete anyway so I don't know why you say it would take longer. itimpi has some good ideas up there. Quote Link to comment
Recommended Posts
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.