?
Solved

tar procedure may have been compamised

Posted on 2009-03-30
8
Medium Priority
?
425 Views
Last Modified: 2012-05-06
The cord on my laptop, got pulled out during the night (the cat :-(() and I am not sure if the tar file procedure finished or not. Other than restarting or completely untarring, is there a way I can ascertain whether this procedure completed?

Here is what I was using from OmarFarid:
omarfarid:
from your laptop:

ssh username@remoteserver "tar cf - /path/to/dir" | dd of=/path/to/local/dir/mybackup.tar

Thanks in advance.

0
Comment
Question by:wotan1953
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 1000 total points
ID: 24018994
Hi,
use 'tar -tvf /path/to/local/dir/mybackup.tar' to produce a table of contents.
If this works without error, the tarball should be OK.
wmp
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 1000 total points
ID: 24019007
ok

of the laptop run

dd if=/path/to/local/dir/mybackup.tar | tar xvf -

if you see an error or it does not show all files / folders then it is not complete.

Also, you could do

ssh username@remoteserver "du -ks /path/to/dir"

and compare its size with the tar file size

0
 

Author Closing Comment

by:wotan1953
ID: 31564324
Once again Thanks You. Although I split the points evenly, I liked  the tar (only) solution, better , there was a table with an 'OK' at the end. The dd solution actually created the directory structure. Both approaches worked, but upon using them I realized my scope narrowed. My error;-).  Thanks again for all your help.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:omarfarid
ID: 24019882
I am very sorry, it should have been tar -tvf -
0
 

Author Comment

by:wotan1953
ID: 24019921
And I am adding another ... third times a charm :-))

Here is my run :

Title: Multiple ssh hops to tar to MAC laptop.

Question:

Hi-
I need to ssh into server X and then ssh into server Y and tar up a dir (files and dirs), to my MAC laptop. I previously got this from OmarFarid:

ssh username@remoteserver "tar cf - /path/to/dir" | dd of=/path/to/local/dir/mybackup.tar.

I am thinking something like:

ssh username@remoteserver1 | ssh username@remoteserver2  "tar cf - /path/to/dir" | dd of=/path/to/local/dir/mybackup.tar

But not sure. Any help will be appreciated. If by some strange web of circumstances I am right, then the confirmation is still worth 500 pts. I am under the gun on this latest project, and I appreciated you folks help.

Thanks -



0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24020064


ssh user@serverA "ssh user@serverB tar -cf - /path/to/dir" | dd of=/path/to/local/dir/mybackup.tar
0
 

Author Comment

by:wotan1953
ID: 24039583
Thanks ... quick followup on the this question "tar procedure may have been compamised", when U said run du -ks /path/to/dir, and compare the 2. I have had this come up again. They changed the network during th night , and I think another one of these, might have failed. When I run this du etc .. I get.

For the dir I was trying to tar:
username@remoteserver > du -ks rw/
870984  rw
username@remoteserver > 


For the tarred file itself:
bash-3.2$ du -ks rw_sav_dir/
861640      solveint/
bash-3.2$

I guess my question is, "should these be exactly the same or close?"

When I run:
dd if=/path/to/local/dir/mybackup.tar | tar xvf -

there are no errors, but determining that all files/dirs are there is difficult, because the file structure is huge.

Any help will be appreciated.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24042357
the results of both are in KB. The difference is 870984 - 861640 = 9344 KB which is about 9 MB which I think much. It could be that the tar did not complete successfully.

dd if=/path/to/local/dir/mybackup.tar | tar xvf -

results in restoring it to the local system and there you could do du -k again and compare the two results which could be close to each other or an exact match
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question