LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-10-2005, 08:31 AM   #1
cefn
LQ Newbie
 
Registered: Oct 2005
Posts: 3

Rep: Reputation: 0
tar --exclude --exclude-from


I'm having real trouble getting tar to behave when writing backups of a filesystem into the same filesystem. I'm stuck with this disk layout unfortunately. I suspect I don't fully understand the interaction between the command line options ...

--listed-incremental
--exclude
--exclude-files

Want to do a recursive gzipped tar backup of the whole filesystem from / (root) upwards. Then I want to tar incremental changes. The aim is to take an occasional full backup, and then take regular small snapshots of changes and lift them over the network.

Using /tmp to store the files, and using options --exclude backup.tar.gz and --exclude-from excluded.filelist to make the backup ignore the file it is actually writing, as well as some other files I want it to ignore.

However, for some reason, it's ignoring my specification of excluded files, and going ahead and trying to back them up, also the incremental seems to ignore the record of files already backed up using --listed-incremental.

I have modded the files so they just try to back up the /tmp directory instead of the whole filesystem. Still the same problem. The three scripts I'm using are inlined below. dump-exclude is used in common between both scripts in order to generate the exclusion list.

The incremental dump is actually coming out bigger than the full dump, because the exclusion list is being ignored! Help!


>>>>>>
#dump-exclude

#!/bin/bash
#
/usr/bin/find /tmp/ -type f -name 'dump*' > /tmp/dump-exclude.filelist


>>>>>>
#dump-full

#!/bin/bash
# Generates exclusion list in /tmp/dump-exclude.filelist
/root/backup/dump-exclude
# Makes temporary backup of last list of tarred files
/bin/mv -f /tmp/dump-full.tarlist /tmp/dump-full.tarlist.old
# Temporary modification for testing
cd /tmp
# Make incremental backup
/bin/tar --create --one-file-system --exclude-from /tmp/dump-exclude.filelist --listed-incremental /tmp/dump-full.tarlist --label "Archive of entire filesystem" . | /bin/gzip -c > /tmp/dump-full.tar.gz

>>>>>>
#dump-inc
#!/bin/bash
# Update the list of files to exclude from backup
/root/backup/dump-exclude
# Create copy of information about
# previous full backup for the incremental
# tar operation to build upon
/bin/cp -f /tmp/dump-full.tarlist /tmp/dump-inc.tarlist
# Temporary modification for testing
cd /tmp
# Make an incremental backup based on the --listed-incremental format file
# saved from the last full backup
/bin/tar --create --one-file-system --exclude /tmp/dump-inc.tar.gz --exclude-from /tmp/dump-exclude.filelist --listed-incremental /tmp/dump-inc.tarlist --label "Incremental archive of /" . | /bin/gzip -c > /tmp/dump-inc.tar.gz
 
Old 10-11-2005, 05:14 PM   #2
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
Hi, and welcome to LQ! :)

One piece of essential info missing:
/tmp/dump-exclude.filelist

And for readabilities sake, try something like this:
Code:
/bin/tar  --one-file-system --exclude /tmp/dump-inc.tar.gz -X /tmp/dump-exclude.filelist --listed-incremental /tmp/dump-inc.tarlist --label "Incremental archive of /" -czf /tmp/dump-inc.tar.gz

Cheers,
Tink
 
Old 10-11-2005, 07:16 PM   #3
cefn
LQ Newbie
 
Registered: Oct 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Extra info needed

Thanks for getting back to me, Tink. Sorry to leave out info which would be essential.

One of the reasons I changed the script to only back up the /tmp directory is so that in principle one could run the scripts directly on any system, and these generate the /tmp/dump-exclude.filelist, but here's an example of the file which is created, and then later referenced, within both scripts...

#dump-exclude.filelist
>>>>>>>>>>>>
/tmp/dump-exclude.filelist
/tmp/dump-full.tar.gz
/tmp/dump-full.tarlist.old
/tmp/dump-full.tarlist
/tmp/dump-inc.tarlist
/tmp/dump-inc.tar.gz
 
Old 10-11-2005, 07:22 PM   #4
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
Cool - and now you're saying that those files are being included
in backups despite the fact that they're in the exclusion-list?


Cheers,
Tink
 
Old 10-11-2005, 07:31 PM   #5
cefn
LQ Newbie
 
Registered: Oct 2005
Posts: 3

Original Poster
Rep: Reputation: 0
That's about the size of it

tar xzvf /tmp/dump-full.tar.gz
Archive of entire filesystem
Reading `Archive of entire filesystem'
./
./.ICE-unix/
./.X11-unix/
./.font-unix/
./.iroha_unix/
./orbit-cefn/
./orbit-marks/
./orbit-root/
./.X0-lock
./dump-exclude.filelist
./dump-full.tarlist
./sess_0433a8087c8935bff7e06ecf48d85226
./sess_06596e96a2c1447fca642023c9531fc4
./sess_1b49cfe7b841f7212cbf9f8c0781b744
./sess_38ba59388572a0e3a76bd25faecf4015
./sess_4474316b118964011d788d20ab6bcda4
./sess_643b4e669d61ff46c46ea7739bbf4205
./sess_6c3a8fdeae8f433716342830130cb831
./sess_876df273bdef367f5d7af49d7390817e
./sess_8bd32ce1d05f383064a2bb6c5fc745a0
./sess_af2eed5ba5638085fb817269c834170f
./sess_d15ec8724bf2706bfe88e1660cf301a6
./sess_f3da9831944add58725333c07465d957


tar xzvf /tmp/dump-inc.tar.gz
Incremental archive of /
Reading `Incremental archive of /'
./
./.ICE-unix/
./.X11-unix/
./.font-unix/
./.iroha_unix/
./orbit-cefn/
./orbit-marks/
./orbit-root/
./dump-exclude.filelist
./dump-full.tar.gz
./dump-full.tarlist
./dump-inc.tarlist
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tar won't exclude directories. yougene Slackware 9 12-01-2005 09:32 AM
tar --exclude-from=FILE GATTACA Programming 1 07-29-2005 12:25 PM
tar exclude-from drisay Slackware 1 12-23-2004 01:10 PM
Exclude directories when backing up with 'tar'? wolfpeach Linux - Newbie 2 06-28-2004 10:54 AM
tar --exclude for subdirectories mrtwice Linux - Software 2 10-23-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:11 PM.

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