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 |
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.
|
|
01-04-2002, 11:00 AM
|
#1
|
LQ Newbie
Registered: Nov 2001
Location: Bogota, Colombia, South America
Distribution: RedHat 7.1
Posts: 13
Rep:
|
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
|
|
|
01-04-2002, 02:59 PM
|
#2
|
LQ Newbie
Registered: Dec 2001
Location: Texas
Distribution: Red Hat 7.1
Posts: 18
Rep:
|
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
|
|
|
01-05-2002, 03:04 PM
|
#3
|
Member
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Rep:
|
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.
|
|
|
01-06-2002, 08:07 AM
|
#4
|
LQ Guru
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700
Rep:
|
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
|
|
|
01-08-2002, 09:08 AM
|
#5
|
LQ Newbie
Registered: Nov 2001
Location: Bogota, Colombia, South America
Distribution: RedHat 7.1
Posts: 13
Original Poster
Rep:
|
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,
|
|
|
01-08-2002, 09:26 AM
|
#6
|
Member
Registered: Dec 2001
Location: Oklahoma City, OK, USA
Distribution: Xubuntu 16.04 LTS
Posts: 214
Rep:
|
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...
|
|
|
01-08-2002, 03:22 PM
|
#7
|
LQ Newbie
Registered: Dec 2001
Location: Texas
Distribution: Red Hat 7.1
Posts: 18
Rep:
|
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
|
|
|
01-09-2002, 08:46 AM
|
#8
|
LQ Newbie
Registered: Nov 2001
Location: Bogota, Colombia, South America
Distribution: RedHat 7.1
Posts: 13
Original Poster
Rep:
|
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!
|
|
|
All times are GMT -5. The time now is 04:45 AM.
|
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
|
|