dump ssh 異地備份 method 2

The default first SCSI tape drive under Linux is /dev/st0. You can read more about tape drives naming convention used under Linux here.

# tar zcvf – /wwwdata | ssh [email protected] “cat > /backup/wwwdata.tar.gz”


OR
# tar zcvf – /wwwdata | ssh [email protected] “cat > /backup/wwwdata.tar.gz”

Output:

tar: Removing leading `/’ from member names
/wwwdata/
/wwwdata/n/nixcraft.in/
/wwwdata/c/cyberciti.biz/
….
..

Password:You can also use dd command for clarity purpose:

# tar cvzf – /wwwdata | ssh ssh [email protected] “dd of=/backup/wwwdata.tar.gz”

It is also possible to dump backup to remote tape device:
# tar cvzf – /wwwdata | ssh ssh [email protected] “cat > /dev/nst0”

OR you can use mt to rewind tape and then dump it using cat command:
# tar cvzf – /wwwdata | ssh ssh [email protected] $(mt -f /dev/nst0 rewind; cat > /dev/nst0)$

You can restore tar backup over ssh session:

# cd /
# ssh [email protected] “cat /backup/wwwdata.tar.gz” | tar zxvf –