I believe I understand how file copy/move operations work (or appear to work). My general understanding being that as long as files and directories are on the same device and filesystem, moving a file from one directory to another should happen nearly instantly. And a file copy operation takes longer as the data has to be replicated from each original inode to a new inode, etc,.
However, occasionally I run into a situation where I move a file and it takes as long as copying it and I have not been able to determine why.
I have a Raspberry Pi server (running OMV) set up for a partner and I to collaborate and share files over sftp and I have it so there is an incoming directory that we upload files to and when we are done working with them, I move them to an archive directory on the same physical drive and at the same hierarchical level. IE, both directories share the same parent directory. The file system is ext4.
For some reason when I move a file from this incoming directory to another directory above or beside it in the file "tree", it essentially seems to copy it to the new directory and then delete the original file as if I were moving it to another drive or file system. If I move the same file to a sub-directory of the incoming directory, the move happens instantly as expected.
The only difference I see between the two directories is that the incoming directory has ACLs applied to it.
So I experimented by creating a test directory and applying the same ACLs as the incoming directory has, one at a time to see if I could duplicate the behavior (and isolate the offending ACL) and I can not. To be clear, if I create a test directory with the same ACLs and permissions as the incoming directory, I can move files in and out of it nearly instantly unlike the incoming directory.
Clearly, I do not fully understand why my incoming directory is acting like it's on another drive and I have not had any luck on Google finding relevant information.
I am thinking that it has something to with the way OMV (Open Media Vault) handles file shares, ACLs and permissions. But in the past with other distros it seems this happens every now and then but I have been too lazy to troubleshoot.
I'm hoping someone with a better understanding of file systems might point out something I'm missing.
Here are some details:
$getfacl incoming # file: incoming # owner: root # group: users # flags: -s- user::rwx group::rwx group:users:rwx mask::rwx other::r-x default:user::rwx default:group::rwx default:group:users:rwx default:mask::rwx default:other::r-x getfacl testFolder2 # file: testFolder2 # owner: root # group: users # flags: -s- user::rwx group::rwx other::r-x default:user::rwx default:group::rwx default:group:users:rwx default:mask::rwx default:other::r-x $ls -lah drwxrwsr-x+ 7 root users 4.0K Oct 3 20:12 incoming drwxrwsr-x+ 2 root users 4.0K Oct 4 19:51 testFolder2 drwxr-xr-x 2 root users 4.0K Oct 4 19:51 testFolder4 tree -L 1 /sharedfolders/ /sharedfolders/ ├── incoming ├── testFolder2 └── testFolder4
File moves between testFolder2 and testFolder4 instantly, file moves between incoming and either testFolder2 or 4 happen at the speed of copying.