One issue with using tar
for copying files is that the old POSIX tar format (ustar
) has a limited length of 100 bytes to store hard links. It can cope with longer names, so as long as your files have a single link, everything is fine. But when tar encounters an inode for the second time, it produces a hard link record, with only 100 bytes for the name. If the name is too long, the second link isn't stored in the archive.
I do recall tar implementations that discarded these links with a diagnostic messages but still exited with a status of 0. Maybe your tar is even worse and silently discards them.
The new POSIX tar format (pax
) doesn't have this limitation. Try using pax
instead of tar
, or tar
with the right options. Current versions of GNU tar default to the pax format, and do complain properly if told to produce a ustar
archive where the names don't fit.