Operating System - HP-UX
1836636 Members
1990 Online
110102 Solutions
New Discussion

Re: Using tar to backup and restore to remote server

 
Trevor McLachlan
Occasional Contributor

Using tar to backup and restore to remote server


Hi All,

I am trying to backup a filesystem lets say called /files and want to use tar to do this then restore it to a remote server under /files. I want to do this all in one command from the local server ... can this be done. This is the command I used -

cd /files
tar cvf - . | (remsh remotesvr cd /files; tar xvf -)

I got a directory checksum error. Trying to do this command from memory, and it aint good :)

Thanks
Trev

6 REPLIES 6
Tom Maloy
Respected Contributor

Re: Using tar to backup and restore to remote server

This command will do the remsh as one command, and the tar xvf - as a second command, not in the remsh execution. You need quotes.

tar cvf - . | (remsh remotesvr "cd /files;tar xvf -")

Tom
Carpe diem!
Robert Gamble
Respected Contributor

Re: Using tar to backup and restore to remote server

That should work.

Personally, I would NFS mount the other server and not worry about the remsh.

tar cvf - $OLD_DIR_MOUNT | ( cd $NEW_MOUNT_POINT ; tar xvf - )

That will preserve permissions and links.

Good Luck!
T G Manikandan
Honored Contributor

Re: Using tar to backup and restore to remote server

It should be like this

cd /backupdirectory

# tar cvf - .| remsh polnec "(cd /otherdirectory ; tar xvf - )"

THanks
G Manikandan
Frank Slootweg
Honored Contributor

Re: Using tar to backup and restore to remote server

If possible, use fbackup(1M)/frecover(1M) with their "-f machine:device" options, instead of (tar(1) and) 'remote pipes' (remsh(1) with pipes). Without proper precautions, remote pipes can easily cause problems/data_'corruption'.
Ravi_8
Honored Contributor

Re: Using tar to backup and restore to remote server

Hi, Trevor

# tar cvf - .| remsh remotesvr "(cd /otherdirectory ; tar xvf - )"

should do the job
never give up
Steve Steel
Honored Contributor

Re: Using tar to backup and restore to remote server

Hi

`tar' via network.

Write a `tar' tape on a remote computer that owns a DAT/DDS drive.

cd /relative_path
tar cvf - . | remsh name -l user "cat - | dd of=/dev/rmt/0m bs=10k"

Restore a `tar' tape from a remote computer that owns a DAT/DDS drive.
cd /relative_path
remsh name -l user dd if=/dev/rmt/0m bs=10k | tar xvf -


Please note that FBACKUP IS BETTER.


Remote backup on a local DAT/DSS tape drive.

In case you would like to make a backup from a remote system to a local
DAT/DSS tape drive, you can use this comand:

remsh remote_name "/etc/fbackup -f local_name:/dev/rmt/0m -i . -0 -v"

remote_name= system that runs the backup.
local_name = system that owns the DAT/DSS drive.
The options can be set at discretion.

If you are logged-in on the other system, then:
/etc/fbackup -f remote_name:/dev/rmt/0m -i . -0 -v


Restore of backup over network.

Restore from a remote DAT/DDS drive

/etc/frecover -xi/directory -f remote_name:/dev/rmt/0m

Remote restore with local DAT/DDS drive

remsh remote_name " /etc/frecover -xi/directory -f local_name:/dev/rmt/0m"



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)