I inherited a collection of four Linux boxes where no care was taken to keep UIDs unique across systems. There are ~40 users and over 7TB of data owned collectively by those users.
In order to have some sanity when NFS mounting /data volumes between these four boxes, I need to get the UIDs matching. I also want to minimize the amount of time users are asked to stay logged out while I perform this change.
Because of the number of users and amount of data, I have written a program to chown (in one pass of the ~7TB) all the files from current state UIDs to fixed state UIDs for all 40 users. At the end of this, I'll need to change /etc/passwd so that the usernames match the new fixed state UIDs.
This would be simpler if I only had one user to fix and/or if there were less data to crawl through and chown.
I had thought that after running my program to change file permissions I would simply run
usermod -u fixedUID jsmith -o
For each of the 40 users. However, the manual for usermod suggests it is going to do it's own chown of the files in /home/jsmith (thus defeting my attempt at a simple pass fix). I can't figure out how to disable this and I'm worried the final usermod step is going to turn my 1-pass fix into a 41-pass fix.
How would you change the users UIDs after chowning everything on the file system? Is there a better way than "vipw" ?