0

I am trying to use tar to backup but keep getting the error that it's "exiting due to previous errors." The solution is to (obviously) exclude the offending files/dirs with --exclude, which I am doing.

But the problem is that I'm running tar for hours and hours, half a day each time, only to find ONE error, fixing that, then running it again for half a day to find that there's another error...fixing that. And so on. It's been days now. I would love to be able to run it with a flag that just tells it to churn through start to finish and list ALL the errors for me. The man page has something about "ignore child errors" but I don't understand what that means.

Most of these errors are ridiculously unnecessary, too. So if there's a way to just see ALL the expected errors at once, I can write an exclude file that has them all there, run tar once and for all, and be done.

Thank you in advance for any help!

0

Tar completes the run as best it can. There can be transient errors that would not occur on a second run: for example, if a file is modified or deleted between the time tar scans the directories to find out what it has to do, and the time it actually writes it out. Logs can get appended to, for example.

Can you give examples of the type of error you get? Having a file change under you is probably unfixable. If you are supplying specific filenames (e.g. with -T option or a find command) you could script separately to check if the files are all existing and readable.

You could also tar -tv the archive, compare to find what was missing, and put those names into a separate addendum tar.

9
  • Also notice that GNU tar has a --warning=KEYWORD option. – Paul_Pedant May 17 '20 at 17:55
  • Thank you for the suggestions. I have 2 types of errors, one is "socket ignored" errors which don't seem to be fatal. The others are caused by files that for some reason have perms set to 400 and the only user able to do anything with them is User 1000. I haven't quite investigated the option of su-ing to User 1000 and THEN running the "sudo tar --exclude=/blah/blah" etc. But that'd be the next step. It's frustrating because it runs mainly through the .config and .cache and .such-and-such dirs first, finding weird files and failing on those, BEFORE getting to the dirs and subdirs. – user1149499 May 17 '20 at 17:55
  • @Paul_Pedant That GNU tar option is a cheap copy of the errctl=xxx option from star. You better should have a look at star, see cdrtools.sourceforge.net/private/man/star/star.1.html for a reference on the features. – schily May 17 '20 at 18:10
  • BTW: It is recommended to run backups with star -cM -dump .... as this is using an enhanced archive format that supports all file types. So your socket problem will go away. If you are on the file server that has the filesystem locally, the permission problems should go away when the backup is run as root. – schily May 17 '20 at 18:16
  • 1
    star is closer to the behavior of tar than GNU tar is, so if you are familiar with tar, that would be an argument for star. – schily May 17 '20 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.