posted by admin
on Mon, 05/01/2017 - 11:02
If you wish to make a backup of a file system between two unix machines, you may use scp command.
scp {filename} {[email protected]}:{remote filename}
The scp command will copy file (or directory) one at a time uncompressed, so it will take longer time to transfer files between two machines. On the other hand, if you use tar command, it will compress the file (or directory) before transferring so it will take less time to transfer. The time it will take to compress will be much less than the time it will take to transmit larger content.
tar cfz - {directory} | ssh {[email protected]} "cat > {remote file}" example> tar cfz - /home |ssh [email protected] "cat > /home/home.tgz" [email protected]'s password:
You may also use dd in place of cat command.
tar cfz - {directory} | ssh {[email protected]} "dd of={remote file}" example> tar cfz - /home |ssh [email protected] "dd of=/home/home.tgz" [email protected]'s password:
Finally, if you wish to explode the archive at the remote end, you may wish to combine the command.
tar cfz - {directory} | ssh {[email protected]} "(cd {directory}; tar xfz -)" example> tar cfz - /home |ssh [email protected] "(cd /home; tar xfz -)" [email protected]'s password:
Comments
Add new comment