LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-27-2004, 07:29 PM   #1
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Rep: Reputation: 31
Question tar extract fails


Hi--

I have a mammoth (13 Gb) .tgz file I have been trying to restore for several days.

Right now it is choking on a file it restores which has a date of something like Dec 31, 2035. Not sure how it got that way--it is probably a backup of an old netware .err file.

This is the command I have used:

[root@samba1 /]# tar xzpvf /backups2/weekly.tgz doug2/a-long-directory-name-like-this --ignore-failed-read --same-owner

So--

1. How do I get past this error?

2. How do I make sure I am restoring all the ownerships and permissions? (That's what I was trying with the -p and --same-owner stuff, but perhaps I guessed wrong.
 
Old 08-27-2004, 07:38 PM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
what are the errors?

and just try to extract it regularly ..

tar fzxv /backups2/weekly.tgz

you can fiddle with details like owner and permissions later
 
Old 08-27-2004, 08:15 PM   #3
Crunch
Member
 
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162

Rep: Reputation: 30
Yeah. I also think you forgot to append an argument on the tar command. I think it's -C so you can extract it to that directory...

Quote:
$ tar -zxvf filename.tgz -C /path/to/dir
As for the permissions... I'm not quiet so sure about that. Can't you just chown the file under your user name and group? I'm not exactly sure why it'd have troubles extracting. The only difficulty I could see is compressing.

Hope this helps.
 
Old 08-27-2004, 09:04 PM   #4
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
SciYro--

The error (from memory--if there is a log file somewhere that would record it, I will look it up--otherwise it takes about an hour to get to the error) was to the effect that the file is dated "in the future."

Crunch--

Not sure what C adds. I found some info for it in the tar --help file, where it reads "-C, --directory=DIR change to directory DIR" under the "Local file selection" category. Since I am restoring directly from / won't the location of the file be taken care of?

I suspect I misunderstand the meaning of the help file here....

I'd like to keep the permissions because each directory and sometimes each file is different. It took me an hour of chowns and chmods to get the smaller .tgz (1.5 Gb) restores working roughly--perhaps more tweaking to do.

Also for anyone--

I am at a loss to understand where to put the various options. Crunch has his -C between the .tgz file and the one to extract; some of them go right after the tar command, and some, I learned after about a half dozen tries, goes at the end (the --options).

Can somebody give me a quick tutorial on where these things go, and how to remember it?

Thanks for your quick responses, SciYro and Crunch. You are life savers!
 
Old 08-27-2004, 10:11 PM   #5
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
i don't think it matter when the options come ... but to be on the safe side i like to put all the options first then the file

and I'm not sure how to solve that error of yours .. tho i don't think it would have stopped decompression .. all it means is either your computers clock is wrong, or the computer that made those files in the archive has its clock wrong .... you sure that it errored out and didn't just give a warning?

o and next time try something like

tar fzxv /whatever/whatever >> ./log

that should send the output into ./log
 
Old 08-27-2004, 11:51 PM   #6
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
SciYro--

Thanks for the idea about a log file. What a great idea!

As to the order, I worked a lot of different combinations before I found that that was the way to make it work.

I tried for instance

tar -xzvfp --same-owner --ignore-failed-read foo.tgz doug2/directory-to-restore

and got an error that said it could not find a file called --same-owner.

I tried removing the spaces and even one of the hyphens. I tried taking out p and --same-owner. Each time it would immediately return an error, something about the child process didn't like it or couldn't find it or it was a bad command.

I read in a manual that each utility has different expectations on where the options are placed and how, so that's what gave me the idea of putting the two hyphen options at the end. And that did seem to work. Not sure it kept the permissions exactly right, though.

And get this: earlier I tried tar -xvfz and found that that would not work, but tar -xzvf would!

The date on the file is a function of netware 3.12, I think--not every system file created post Y2K (bet you thought you'd not see that abbreviation again!) was written with an accuarate date. So I am relatively sure this was a netware problem on an old computer that I copied these archive files from.

Yes it did seem to error out--it gave this error message and immediately stopped processing the .tgz file.

Thanks for your wonderful help with this SciYro!
 
Old 08-28-2004, 02:30 AM   #7
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,896

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
You might want to check out an application called TkZip. I've had good luck using it to extract tar files that tar wouldn't touch because of some perceived error. TkZip is a gui app, which will show you a list of the files in an archive, and allow you to select which files to extract. It works with several archive formats.
 
Old 08-28-2004, 11:45 AM   #8
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
bigrigdriver--

Excellent idea. I will search and see if I can find it.

Thanks, bigrigdriver!

Everyone--

The file tar choked on appears to be one called tts$log.err and it has a date Sept 2, 2031. I am currently trying running tar with an option at the end of the command which reads --exclude=???\$log.err and see what happens. It is chugging away now. At least no (immediate) error messages.
 
Old 08-28-2004, 12:26 PM   #9
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
Well, it looks like that worked.

At least it looks like a lot more of the archive got extracted, and it ended wihout error message and gave me a prompt. And the ownerships and permissions seem pretty close to what I expected. And it was done in 20 minutes instead of 20 hours!

For the record, here is the command I ultimately used:

tar -xzpvf /backups/weekly.tgz doug2/directory-I-wanted-to-restore --ignore-failed-read --same-owner --exclude=???\$log.err

Perhaps someone else can benefit from all our experiments....

Thanks everyone for help. The people in this forum are terrific!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar.bz2 Fails To Extract carlosinfl Linux - General 6 10-16-2005 01:33 PM
can not extract the tar.gz file sharad durgawad Linux - Software 3 10-05-2005 03:41 AM
using tar to extract properly xushi Slackware 9 03-05-2005 10:10 AM
extract .tar.bz2 EcceVery Debian 3 11-24-2004 01:39 PM
Choosing where to extract tar.gz Arclite Linux - Software 14 08-14-2003 04:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration