LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to take backup with tar command (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-take-backup-with-tar-command-901521/)

suresh.k 09-07-2011 12:49 AM

How to take backup with tar command
 
Hi all,
Iam using federo os, i want to take backup from remote pc in single command, what is the command i have to execute.
I Execute following commands.
But it is not working

tar -cZvf /home/html.tar.bz[Destination] /var/www/html[Source]

tar -cZvf 192.168.10.44:/root/Desktop/html06082011.tar.gz[Destination] /var/www/html/[Source]
it is showing like this
tar: compress: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Removing leading `/' from member names
tar: /var/www/html/
192.168.10.44\:/root/Desktop/html06082011.tar.gz: Cannot open: Input/output error
tar: Error is not recoverable: exiting now
/var/www/html/HumidorDev/
/var/www/html/HumidorDev/var/
/var/www/html/HumidorDev/var/.htaccess
/var/www/html/HumidorDev/var/cache/
/var/www/html/HumidorDev/var/cache/mage--e/
/var/www/html/HumidorDev/var/cache/mage--e/mage---internal-metadatas---a8b_DB_PDO_MYSQL_DDL_catalog_product_index_eav_tmp_1
/var/www/html/HumidorDev/var/cache/mage--e/mage---a8b_DB_PDO_MYSQL_DDL_catalog_product_index_eav_tmp_1
/var/www/html/HumidorDev/var/cache/mage--c/

jschiwal 09-07-2011 01:01 AM

Use ssh and pipe the tarball to your local machine:
It will work better if you use pubkey authentication and run ssh-agent & ssh-add before hand so you aren't prompted for a passphrase from ssh.

Code:

ssh user@host 'tar -C /var/www/html/ -cZvf - . | cat >/root/Desktop/html06082011.tar.gz
However, I'd recommend ssh'ing as a regular user and never running an X desktop as root.

You could also ssh to the server first and ssh back to the client stream the archive.


All times are GMT -5. The time now is 08:24 PM.