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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-27-2004, 06:29 PM
|
#1
|
Member
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 366
Rep:
|
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.
|
|
|
08-27-2004, 06:38 PM
|
#2
|
Senior Member
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038
Rep:
|
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
|
|
|
08-27-2004, 07:15 PM
|
#3
|
Member
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162
Rep:
|
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.
|
|
|
08-27-2004, 08:04 PM
|
#4
|
Member
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 366
Original Poster
Rep:
|
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!
|
|
|
08-27-2004, 09:11 PM
|
#5
|
Senior Member
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038
Rep:
|
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
|
|
|
08-27-2004, 10:51 PM
|
#6
|
Member
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 366
Original Poster
Rep:
|
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!
|
|
|
08-28-2004, 01:30 AM
|
#7
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
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.
|
|
|
08-28-2004, 10:45 AM
|
#8
|
Member
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 366
Original Poster
Rep:
|
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.
|
|
|
08-28-2004, 11:26 AM
|
#9
|
Member
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 366
Original Poster
Rep:
|
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!
|
|
|
All times are GMT -5. The time now is 07:41 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|