LinuxQuestions.org
Help answer threads with 0 replies.
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-30-2005, 04:54 PM   #1
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Rep: Reputation: 30
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
 
Old 01-30-2005, 06:57 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Code:
tar czf example.tar.gz /directory1 /directory2 /directory3
 
Old 01-30-2005, 10:03 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 02-06-2005, 03:14 PM   #4
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Original Poster
Rep: Reputation: 30
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.
 
Old 02-06-2005, 05:17 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Code:
  -T, --files-from=NAME        get names to extract or create from file NAME
Cheers,
Tink
 
Old 02-07-2005, 10:43 PM   #6
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Original Poster
Rep: Reputation: 30
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
 
Old 02-07-2005, 11:32 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 02-08-2005, 03:25 PM   #8
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Original Poster
Rep: Reputation: 30
Thanks Tink
 
  


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
incremental backup using tar eaglegst Linux - Software 9 02-01-2009 05:00 PM
Schedule a Backup with Tar globochem Linux - Newbie 2 02-28-2005 12:49 PM
Using tar for backup. TheRealDeal Linux - General 2 08-10-2004 11:46 PM
tar as backup imsajjadali Red Hat 4 02-07-2004 03:46 PM
tar: How do I backup everything !! grantm Linux - Newbie 3 07-30-2003 02:41 PM

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

All times are GMT -5. The time now is 02:49 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