Performance of chown and chmod or find and running in background in parallel?
0
votes
1
answer
198
views
I have up to terabytes of data (a large number of smaller files) that could contain wrong owner, group or permissions. To repair that we had a script doing
-sh
sudo -n chown -R user:group "/path"
sudo -n chmod -R a-rwx,u+rwX,g+rwX "/path"
But I wonder if the performance could be improved? What about running both in background and adding wait in the script? Is this a bad idea for chown
and chmod
? Do they interfere?
What about using find
instead? Is this faster and even correct this way (tests looked like this ain't even working, i.e. there is something wrong with the usage)?
-sh
sudo -n find "/path" -type f -exec chmod 660 {} + -exec chown user:group {} +
sudo -n find "/path" -type d -exec chmod 770 {} + -exec chown user:group {} +
What about running this in background and adding wait
? Due to the type filter this shouldn't interfere, right? Could this even be improved by filtering for files only deviating from the target configuration?
Maybe it's important to note that this script should be able to run on multiple platforms like Ubuntu (different versions) and Red Hat (different versions) and potentially different file systems, too.
Asked by jan
(105 rep)
Dec 2, 2024, 01:07 PM
Last activity: Dec 2, 2024, 03:06 PM
Last activity: Dec 2, 2024, 03:06 PM