Linux - SoftwareThis 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.
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.
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
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...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.