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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
Due to network maintenance being performed by our provider, LQ will be down starting at 05:01 AM UTC. The exact duration of the downtime isn't currently known. We apologize for the inconvenience.
|
 |
01-30-2005, 04:54 PM
|
#1
|
|
Member
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438
Rep:
|
Tar backup
Hi all.
I have a server that holds alot of important data, but is also used for people to dump files on.
I have a weekly backup that runs on the server and backs the share up to a tar file on a seperate drive. Because of the not so important stuff people are uploading, it is filling the drive.
Is there a way I can specify which folders to add to the tar directory? I really don't want to have to back up 30 or 40 folders one by one.
Thanks alot.
Regs
Craig
|
|
|
|
01-30-2005, 06:57 PM
|
#2
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Code:
tar czf example.tar.gz /directory1 /directory2 /directory3
|
|
|
|
01-30-2005, 10:03 PM
|
#3
|
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 3,816
Rep: 
|
There's also an --exclude option and --exclude-from <file> where <file> would have a list of directories to exclude. This assumes you're using GNU tar.
|
|
|
|
02-06-2005, 03:14 PM
|
#4
|
|
Member
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438
Original Poster
Rep:
|
Thanks alot guys!!! Sorry about the long delay.
With the -exclude-from way, I don't suppose there is a way to have a file like that, but an include file? So I can put the folders that I want backed up in there? So any other files that are added are just ignored and not backed up?
Thanks alot.
Craig 
Last edited by TheRealDeal; 02-06-2005 at 03:15 PM.
|
|
|
|
02-06-2005, 05:17 PM
|
#5
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Code:
-T, --files-from=NAME get names to extract or create from file NAME
Cheers,
Tink
|
|
|
|
02-07-2005, 10:43 PM
|
#6
|
|
Member
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438
Original Poster
Rep:
|
Hi Tink,
Sorry about this, just so I understand correctly....
tar -cf --files-from=filestobackup.txt /tarfile.tar
And inside of filestobackup.txt would be like the below?...
----------------------------------------------
/root/secret.txt
/home/johndoe
/etc
/var/www
---------------------------------------------
And that would create a backup of those files, and then allow me to extract them to where they originally were?
Thanks for your help.
>Craig 
|
|
|
|
02-07-2005, 11:32 PM
|
#7
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally posted by TheRealDeal
Sorry about this, just so I understand correctly....
tar -cf --files-from=filestobackup.txt /tarfile.tar
And inside of filestobackup.txt would be like the below?...
|
Close, not sure the position would work like that,
though ... the 'f' in '-cf' wants its argument immediately,
so the --blurb is not quite what it expected ...
I'd do
tar -T filestobackup.txt -czf tarfile.tgz
Quote:
----------------------------------------------
/root/secret.txt
/home/johndoe
/etc
/var/www
---------------------------------------------
And that would create a backup of those files, and then allow me to extract them to where they originally were?
Thanks for your help.
>Craig :)
|
Got that right mate :)
Cheers,
Tink
|
|
|
|
02-08-2005, 03:25 PM
|
#8
|
|
Member
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438
Original Poster
Rep:
|
Thanks Tink 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:23 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
|
|