On copying directory "home" (from remote machine) to local machine using the following command:
ssh [email protected] 'tar -cz -C /home/*' | tar -zxv
The number of files after the transaction doesn't match. Some files were never copied.
Anyone has experienced similar problems?
Use rsync instead. It's faster and safety.
Then you can compress the data.
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 usingpax
instead oftar
, ortar
with the right options. Current versions of GNU tar default to the pax format, and do complain properly if told to produce austar
archive where the names don't fit.