TAR OVER SSH


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers TAR OVER SSH
# 1  
Old 11-10-2009
TAR OVER SSH

Hello,

I have a server that has a tape drive attached to it in our company's DMZ. I want to backup the data on other servers onto this tape drive using a script. I will have to ssh into each machine and execute a tar command and instruct the tar command to send the data back to the server that has the tape drive to record the information on the tape drive.

Can someone tell me the commands to go about doing this? I have done some research on the net but I only found an example where the script is being run on the server with the backup data and it did not have a tape drive.
# 2  
Old 11-10-2009
Just an idea of tarring over ssh:

Code:
ssh user@srcbox 'tar cf - srcpath' | tar xf - trgt

this uses " - " for "f" to signify stdin/stdout for tar.

Last edited by migurus; 11-10-2009 at 08:58 PM.. Reason: missed target
# 3  
Old 11-11-2009
Quote:
Originally Posted by migurus
Just an idea of tarring over ssh:

Code:
ssh user@srcbox 'tar cf - srcpath' | tar xf - trgt

this uses " - " for "f" to signify stdin/stdout for tar.
Why do you say tar xf -?

I want to send ti to tape....how can I do that?
# 4  
Old 11-11-2009
Quote:
Originally Posted by mojoman
I want to send ti to tape....how can I do that?
That depends on your platform and the name of your tape device.

What is the name of your tape device?

Normally, people use the cpio command to send data to a tape device, BTW.
# 5  
Old 11-11-2009
Quote:
Originally Posted by Neo
That depends on your platform and the name of your tape device.

What is the name of your tape device?

Normally, people use the cpio command to send data to a tape device, BTW.
It is called /dev/nst0
# 6  
Old 11-11-2009
Quote:
Originally Posted by mojoman
....and execute a tar command and instruct the tar command to send the data back to the server that has the tape drive to record the information on the tape drive.
tar has no capability send to a remote server unless you could export the tape device using NFS (for example) and mount this on the machine you are backing up. However, you cannot do this because NFS does not support exporting tape devices.

So, you could NFS mount a directory on the server with the tape device. Then when you use SSH to run your tar backup, you write the output of tar to the server in the DMZ with the tape device.

Then, you could write another script to instruct the server with the tape device to write the backup file to tape.

Or, you could simply NFS export the file system you want to backup to the server with the tape drive, and then run the tar backup command directly on that server where you have mounted the exported filesystem.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ssh tar file using slave node

Hi, I wanted to zip some files (very large files) on our cluster (centOS). I am told that I should use the head node for this as it would tie down the CPU. How can I do this using one of the other nodes in the cluster? For small files, I would just log into the cluster using ssh (ie. ssh... (1 Reply)
Discussion started by: pc2001
1 Replies

2. Shell Programming and Scripting

Help with ssh,tar and logging

Hi, I'm successfully written a script which tar a directory and ssh's it over a remote server tar cfv - $SDIR | ssh $RHOST "cat > $DDIR/backup.$BKPEXT.tar" However, Im unable to log the activity to a file. i.e for example if I do tar cfv - $SDIR | ssh $RHOST "cat >... (1 Reply)
Discussion started by: maverick_here
1 Replies

3. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

4. Shell Programming and Scripting

expect script pushing ssh keys w/ tar extract

ok, I'm new to the forum and I did a few searches and didn't find much on this so here goes. I have a ksh I use to call an expect script that opens a ssh session and then extracts a tar file. The tar file has my prefered .profile and my ssh keys. I want to run this script 1 time on new servers and... (2 Replies)
Discussion started by: gtsonoma
2 Replies

5. Red Hat

tar/untar over ssh

I use red hat linux. I have two linux server . I want to use tar over ssh to tar and untar the file. The server A , have IP 10.1.1.a ,there is dir a and contain files. The server B have IP 10.1.1.b , there is dir b and contain file . So, in above case ,how can I tar over ssh sunc that the file... (0 Replies)
Discussion started by: chuikingman
0 Replies

6. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

7. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

8. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

9. UNIX for Advanced & Expert Users

Tar utility (untar a .tar file) on VxWorks

Hi All Can someone pls guide me if there any utility to compress file on windows & uncompress on vxworks I tried as - - compressed some folders on windows ... i created .tar ( to maintain directory structure ) and compressed to .gz format. - on VxWorks i have uncompressed it to .tar... (1 Reply)
Discussion started by: uday_01
1 Replies

10. Shell Programming and Scripting

need help scripting tar over ssh

Hello - I've used 'expect' in FTP scripts before without any problems, but am unsure as to how I would script a tar over ssh session? I need to send password for authentication to the remote Suse machine. :confused: Any assistance provided would be GREATLY appreciated. (6 Replies)
Discussion started by: rm -r *
6 Replies
Login or Register to Ask a Question