CLI Magic: Simple backup is Mirdir (Linux.com)
Posted Nov 22, 2005 21:25 UTC (Tue) by tjw.org
In reply to: CLI Magic: Simple backup is Mirdir (Linux.com)
Parent article: CLI Magic: Simple backup is Mirdir (Linux.com)
Your example is a quick hack that has nothing to do with synchronization/mirroring and is definitely not extremely suitable for newbies (or anyone else, for that matter).
That is completely untrue. This command has everything to do with mirroring. This method has been around a very long time and is commonly used and documented. Often it's attributed to Alan Cox in Linux related HOWTO's.
In fact, before "-a" became an option for GNU cp, this was THE way to archive a directory. Perhaps it still is on non-GNU systems that lack the cp archive option (e.g. Mac OSX).
I still use a varaition of this command from time to time.
For example if I want to mirror a directory containing millions of files totalling over a TiB in disk space; I wouldn't want use the following command for the intitial copying:
rsync -azP somehost:/some/dir/ /some/dir/
This is because this command could take days to complete and could make the machine swap to death as it deals with the mind bogglingly huge checksumming. Instead, I would use a very simpistic command that uses the smallest amount of CPU and RAM possible:
ssh somehost "cd /some/dir && tar czf -" | tar zxvf -
to post comments)