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 |
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.
|
|
10-10-2005, 08:31 AM
|
#1
|
LQ Newbie
Registered: Oct 2005
Posts: 3
Rep:
|
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
|
|
|
10-11-2005, 05:14 PM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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
|
|
|
10-11-2005, 07:16 PM
|
#3
|
LQ Newbie
Registered: Oct 2005
Posts: 3
Original Poster
Rep:
|
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
|
|
|
10-11-2005, 07:22 PM
|
#4
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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
|
|
|
10-11-2005, 07:31 PM
|
#5
|
LQ Newbie
Registered: Oct 2005
Posts: 3
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 06:09 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
|
|