############################################################# # Searchable Keywords: tar backup dump ssh rsh tape mt rmt Various ways to backup files and directories using secure protocols and not so secure but using either tar or dump commands <<<<<<<<<<<<<<<< tar - Using ssh/rsh to remote tape drive - backup >>>>>>>>>>>>>> http://w3.trib.com/~ccurley/OpenSSH.html Backing up over SSH To back up to another computer over SSH: To compress on the machine originating the backup: root@charlesc # tar -cf - directory.to.be.tarred | bzip2 | ssh server "cat > test.tar.bz2" To compress on the target: root@charlesc # tar -cf - directory.to.be.tarred | ssh server "bzip2 > test.tar.bz2" where server is the name of the target computer. ## This worked to stat the remote tape drive. ##### ssh keys were exchange before hand. #> ssh -v abby \ mt -f /dev/st0 status ( The mt command stands for "Magnetic Tape Control available on Solaris on Linux you may need to install it. Last I looked it was called mt-st also for remote tape drives rmt. ) #!/bin/bash # Backup from Leon to Tony cd / list="home/www home/www2 etc var" for file in $list do #Keep the previous backup tgz=`echo $file | sed -e 's/\//_/g'`; old="${tgz}.old"; #Store the old backup ssh tony "mv -f /home/backup/leon/$tgz /home/backup/leon/$old"; #Tony is a i486... be patient ! sleep 5m #THE ligne that makes everything tar -cz $file/* | ssh tony "cat - > /home/backup/leon/$tgz"; sleep 5m done Use remote or secure shell commands, tar, and dd from your local machine: tar zcBbvf 20 - . | ssh vagabond 'dd of=/dev/rmt/0ln bs=20b' This have worked !!!!!!!!!!!!! tar cvf - ./Styx-backup | ssh abby 'dd of=/dev/st0 bs=512b' Maybe ???? Keeps erroring out (i/o error) dump 0f - /data2 | ssh abby 'dd of=/dev/st0 bs=512b' using ssh to tar and dump Here is how I took a tar backup of a solaris server, to a linux box, some time ago: tar cf - source | ssh -l username backup_server 'cat > destination.tar' If you wanted to send it straight to the tape, you could do this: tar cf - source | ssh -l username lnx 'dd of=/dev/st0' If you wanted to do a dump, instead of tar: ufsdump 0f - /dev/rdsk/c0t2d0s0 | ssh -l username lnx 'dd of=/dev/st0' You may want to give dd an appropriate block size, for your tape drive. > is there also a way of automating it all, i don't Something like: backupbox# ssh target 'dump 0f - / | gzip -fast' | \ dd if=- of=/dev/nst0 tried: dump 0sf 95000 - / |ssh abby 'dd of=/dev/st0' <--bombed tar cf - / |ssh abby 'cat > /dev/st0' <-- could tar root dump 0sf 95000 - / |ssh abby 'cat > /dev/st0' rdump -0u -f abby:/dev/st0 /data2/Styx-backup <-- ahh No ssh abby \ dump -0u -f /dev/st0 . <----trys to back up remote machine dump 0sf 95000 - /data2/Styx-backup | ssh abby /dev/st0 <-- bombed dump 0sf 95000 - /data2/Styx-backup |ssh abby 'dd of=/dev/st0 bs=512' <--maybenot THIS IS THE ONE ! dump 0sf 95000 - /data2/Styx-backup | ssh abby dd of=/dev/st0 USING NFS AND TAR TO BACKUP REMOTE HOSTS each dat tape only holds 2gigs ?$#@%^&* [root@abby pingyD4]# for A in `ls |grep -v lost+found` > do > date > echo $A > tar cvf /dev/nst0 $A > echo > sleep 1 > done ------------- Using rsh to backup to a remote host -------------- # !!! Of course I still couldn't get tho to fit on one tape !!! # having a hard time addressing more then 64k from host to tape drive - Make sure the remote tape host have open entris for rsh,rlogin,rexec,shell in the /etc/ined.conf file......then HUP inetd - If your using tcpwrappers make sure there is an open entry for the host your sending data from on the remote hosts /etc/hosts.allow file - Make sure there is an entry for the sending host on the remote tape hosts /.rhosts file. (otherwise a password WILLL be required) dump syntax: dump 0sf 150000 abby:/dev/st0 /data3 -b 512 The -b for block size is optional but your mileage may vary. tar syntax: tar cvf abby:/dev/st0 /data3 -b 512 #!!!!!!!!!!!!!!!!!!!! This worked !!!!!!!!!!!!!!!!!!!!!!!!!!!!# pingy is the file server to back up, abby is the tape drive host To backup: Use the pingy:/root/bin/bkup_2tape.sh script, but use it for a directory level. Not a full partition.That way you fit it on one tape To restore(on the remote hosts, in this case pingy): Use /sbin/retsore if abby:/dev/st0 #!!!!!!!!!!!!!!!!!!!! This worked !!!!!!!!!!!!!!!!!!!!!!!!!!!!# #------------------------------------------------------------------# See also dumpcmd, Solaris notes for more tar and dump options