Rsync, 'Uid/Gid Impossible to Set' Cases Cause Future Hard Link Failure, How to Fix

rsync, 'uid/gid impossible to set' cases cause future hard link failure, how to fix?

Use the --usermap and --groupmap rsync options (this requires that both source and dest environments use version 3.1.0 or higher). In my case this won't work since my destination (WD MyCloud) uses 3.0.9.

OR

Change the rsync source code with gcc running under cygwin (really not that hard with some C knowledge).

How does rsync preserve ownership when uid/gid differs?

Yes, by default rsync matches owners and groups by name. Details are in the docs for --numeric-ids.

--numeric-ids

With this option rsync will transfer numeric group and user IDs rather than using user and group names and mapping them at both ends.

By default rsync will use the username and groupname to determine what ownership to give files. The special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids option is not specified.

If a user or group has no name on the source system or it has no match on the destination system, then the numeric ID from the source system is used instead.

rsync presumably uses getpwnam and getgrnam to look up the uid and gid associated with the user and group names.

Compare md5 of all files in directory excluding multiple hardlinks

Unlike softlinks, hardlinks are regular files, each points to same inode number and conceptually there are no original or duplicate hardlinks.

What you can do here is to use -samefile with find command to get all the same hardlinks, put into the ignorelist, and use this ignorelist to skip operation on duplicate.

touch /tmp/duplicates
find . -type f | while read f
do
if ! $(grep $f /tmp/duplicates &>/dev/null)
then
find . -samefile $f | grep -v $f >> /tmp/duplicates
# put md5sum procedure for $f here
fi
done



Related Topics



Leave a reply



Submit