LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-04-2002, 11:00 AM   #1
rebayona
LQ Newbie
 
Registered: Nov 2001
Location: Bogota, Colombia, South America
Distribution: RedHat 7.1
Posts: 13

Rep: Reputation: 0
Troubles with tar


Hi, I'm having trouble with tar, I'm not sure if I'm doing something wrong.

I created an alias to backup periodically my whole system. I'm using Redhat 7.1

In the .bashrc file I added this line:

alias backp=´tar -cvf /tmp/backup-2001-12-26 /etc /home /root /var/named /var/www /usr/local /var/ftp´

So I just run the "backp" command to backup the whole system. It worked fine the first time, but later (when I created the alias) started to generate the file, but when I open in a Windows based computer with an application called filzip (who opens tar files) I can't see the files anymore, i just see one single file called backup-2001-12-26 or a single file called ifcfg-lo.

I don't know what's the problem, if it is the tar command, there is something wrong generating the file (the syntax it's OK, but there's an error generating the file), if everything's OK but the problem is on my filzip program under windows.... .... What's the problem here?

Thanks a lot,

Rafael
 
Old 01-04-2002, 02:59 PM   #2
ssu4716
LQ Newbie
 
Registered: Dec 2001
Location: Texas
Distribution: Red Hat 7.1
Posts: 18

Rep: Reputation: 0
You can make a temporary directory, say /tmp/mytar, cd to
that directory and do a
tar xvf /tmp/backup-2001-12-26

If you see that all the directories and files are reproduced
under /tmp/mytar then you know that your tar command
is working fine and something's wrong with that windows
utility. Alternatively, you can do a
tar tf /tmp//tmp/backup-2001-12-26
to list the contents of the tar file. If it shows everything
then your tar command worked fine.

If you followed the first approach then be sure to clean
the junk using
cd /tmp; rm -rf mytar
 
Old 01-05-2002, 03:04 PM   #3
JimKyle
Member
 
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Blog Entries: 1

Rep: Reputation: 39
Sure looks to me as if you've built the filename "backup-2001-12-26" into your alias, so it will ALWAYS use that same name. You might look at creating a shell script that will use the date command to get the current date for building the file name...

Last edited by JimKyle; 01-05-2002 at 03:06 PM.
 
Old 01-06-2002, 08:07 AM   #4
finegan
LQ Guru
 
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 72
Or, alternatively, you can check out crond, and have the machine make the backups for you... and just have say 4 different jobs that each save over four different versions so you will only have 4 sets of backups at any given time.

I'm with ssu4716, the alias line looks clean. I think your windows utility may be the issue.

Cheers,

Finegan
 
Old 01-08-2002, 09:08 AM   #5
rebayona
LQ Newbie
 
Registered: Nov 2001
Location: Bogota, Colombia, South America
Distribution: RedHat 7.1
Posts: 13

Original Poster
Rep: Reputation: 0
Thumbs up

Those scripts sound great, but I'm just a newbie and have no idea on how to write them. Any help will be apreciated.

Returning to the tar subject, What ssu4716 said worked fine under linux, but I couldn't open it under windows, so the problem should be in the windows app. What I can't understand it's why the first file I generated is readable by it, but the new ones doesn't? I still have the file, and if I double click I can see its contents.....but for newer files, I just can't make it work.

I just tried changing the file name ensayo.tar to ensayo.tar.gz, ensayo.tgz, ensayo.gz, but the result didn't change.

It doesn't really matter if the backup is good, I just want to make sure it'll work in case if i need it sometime.

Thanks a lot,
 
Old 01-08-2002, 09:26 AM   #6
JimKyle
Member
 
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Blog Entries: 1

Rep: Reputation: 39
Most any Linux book, such as "Running Linux" or "Linux System Administration", will have discussions on writing scripts. I particularly like Gagne's LSA book because it's new and covers most all the areas I'm fuzzy about as a semi-newbie (I worked with Multics, the ancestor of Unix, more than 25 years ago, but didn't get seriously back into Linux until this past November).

Read through some examples in the books or even from your own system, then experiment a bit...

I'd agree that the problem is most likely in your Windows utility, which I've not heard of before. I use WinZip as my Windows compression tool; it knows about tar and gz formats and handles them quite nicely. It's inexpensive shareware, well worth the $30 it cost me to register many years ago and updates are free to registered users...
 
Old 01-08-2002, 03:22 PM   #7
ssu4716
LQ Newbie
 
Registered: Dec 2001
Location: Texas
Distribution: Red Hat 7.1
Posts: 18

Rep: Reputation: 0
Suddenly a question came on the top of my head:
How are you transferring your tar file to the windows
system? Are you using FTP? If yes then make sure that
you do the transfer in binary mode (type bin in ftp prompt).

Also try to see the size of the tar file under linux and windows.
If it looks smaller under windows then you lost data during
the transfer.

Thanks.

Syed
 
Old 01-09-2002, 08:46 AM   #8
rebayona
LQ Newbie
 
Registered: Nov 2001
Location: Bogota, Colombia, South America
Distribution: RedHat 7.1
Posts: 13

Original Poster
Rep: Reputation: 0
Talking ssu4716 is a genious!

Well ssu4716, you hit in the target!

You were right. That was the explanation for such a bizarre behavior.... it didn't make any sense that the first time worked.... and suddenly stopped working? No way José!

Yes, the first time I was careful and didn't forget to ftp in binary mode. But the following times, when I was desperate to make it to work, I forgot that "small" detail!

The price of being a self-learning newbie !!!

Thanks a lot ssu4716, you've made a diference! Very helpful thread!

Thank you guys for your support too. Linuxquestions rocks!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
Tar troubles adler321 Linux - Software 1 10-25-2004 03:15 PM
Tar + Tapes = Troubles =@( TheDirtyPenguin Linux - General 1 03-04-2004 11:08 AM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:45 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
Open Source Consulting | Domain Registration