Tar: File has changed while reading
-
- Posts: 117
- Joined: 2008-11-08 19:49
Tar: File has changed while reading
Hello.
I am using a backup system with cron + tar. Since the server is very busy, I get often the cron-email: "The file XYZ has changed while reading". This message is a bit annoying and I see it as critical point in my backup system.
I believe that this file is then not in my backup. (Is that correct?)
Let's imagine the hard disk dies and I have to recover the system and my personal data, and in the night the mysql-table XYZ was not in the backup, because it was in read-usage. I would then have lost this table forever.
Is there any way to tell TAR, that it should force the file to be included (if in read-usage, then wait 2 seconds and try again)?
I am using a backup system with cron + tar. Since the server is very busy, I get often the cron-email: "The file XYZ has changed while reading". This message is a bit annoying and I see it as critical point in my backup system.
I believe that this file is then not in my backup. (Is that correct?)
Let's imagine the hard disk dies and I have to recover the system and my personal data, and in the night the mysql-table XYZ was not in the backup, because it was in read-usage. I would then have lost this table forever.
Is there any way to tell TAR, that it should force the file to be included (if in read-usage, then wait 2 seconds and try again)?
Re: Tar: File has changed while reading
Set the interval to be greater.
No, I don't use cron but I decided to look at the man pages for tar, cron, and crontab.
Apologies if I come across as an arse with my reply.
No, I don't use cron but I decided to look at the man pages for tar, cron, and crontab.
Apologies if I come across as an arse with my reply.
Let my desire and hope surpass my expectations;
And give me the strength to persevere through doubt.
Grant me the wisdom to exceed my bounds.
Let my eyes always see through the dream fog of childhood,
so that every moment may be treasured.
And give me the strength to persevere through doubt.
Grant me the wisdom to exceed my bounds.
Let my eyes always see through the dream fog of childhood,
so that every moment may be treasured.
-
- Posts: 1740
- Joined: 2009-05-04 15:56
- Been thanked: 1 time
Re: Tar: File has changed while reading
I think you will find that the file was backed up, but it may be some combination of the new and the old. Since you are backing up a database you should read the documentation for that database about backing it up. It will almost certainly include info about halting writing to the db while you collect the backup.
-
- Posts: 117
- Joined: 2008-11-08 19:49
Re: Tar: File has changed while reading
I think you don't understand me ...
The database table was just an example (actually, a worst-case-scenario). Actually, the problem exist for ALL files on the server.
Ever 24h I do a FULL backup of all userdata, including the mysql-directory, /etc, httpdocs, /var/mail, /root and /home. This backup needs 5 hours. Of course, I cannot stop my mysql-server for 5 hours, just to prevent that this message appears.
Also, other files with high-traffic like logfiles (e.g. Apache access.log or email-services logs) often produce this messages.
So, your opinion is, that I should stopp ALL services like Apache, MySQL, Exim4 until the TAR-operation is done? That's not a good solution.
I cannot believe that nobody has this problem with TAR-Backups.
I need to tell TAR that it should re-try before printing out this message (and probably producing an incomplete/errorous backup!) I did read the "man tar", but I have not seen that such an important option exists.
Can somebody help, please?
The database table was just an example (actually, a worst-case-scenario). Actually, the problem exist for ALL files on the server.
Ever 24h I do a FULL backup of all userdata, including the mysql-directory, /etc, httpdocs, /var/mail, /root and /home. This backup needs 5 hours. Of course, I cannot stop my mysql-server for 5 hours, just to prevent that this message appears.
Also, other files with high-traffic like logfiles (e.g. Apache access.log or email-services logs) often produce this messages.
So, your opinion is, that I should stopp ALL services like Apache, MySQL, Exim4 until the TAR-operation is done? That's not a good solution.
I cannot believe that nobody has this problem with TAR-Backups.
I need to tell TAR that it should re-try before printing out this message (and probably producing an incomplete/errorous backup!) I did read the "man tar", but I have not seen that such an important option exists.
Can somebody help, please?
-
- Posts: 1740
- Joined: 2009-05-04 15:56
- Been thanked: 1 time
Re: Tar: File has changed while reading
Where did I say anything like that? How much do you care if your apache logs are a little screwed up? Hopefully not as much as if your database tables are corrupt. Then again, since you are using MySQL you probably don't know enough to care if your database tables get corrupt. It may be that you need to have separate pieces of your data backed up at different times so it is not all in one 5 hour chunk.konfiguros wrote: So, your opinion is, that I should stopp ALL services like Apache, MySQL, Exim4 until the TAR-operation is done? That's not a good solution.
-
- Posts: 959
- Joined: 2006-07-15 12:08
Re: Tar: File has changed while reading
My humble but correct opinion is that a database that size should never be subjected to tar backups. If it was me I would do everything I could to implement the system under a raid configuration, say 5 or 6.
-
- Posts: 117
- Joined: 2008-11-08 19:49
Re: Tar: File has changed while reading
On principle, I would like to have a correct backup, meaning also Apache's logs not corrupted. Every compression program should be able to re-try if a read-error occoured... Also, the Cron message in my mailbox every night are annoying.
Well, RAID is a nice solution, but it does not replace backups. If I delete something by accident, RAID does not help me. So I still want my 24h backup. And what should I do to backup the MySQL database? (With easy way to recover?) I am not pleased with the mysqldump tool, since then the backup needs 9 hours. A simple TAR operation (even with theoretical retries) is faster.
Well, RAID is a nice solution, but it does not replace backups. If I delete something by accident, RAID does not help me. So I still want my 24h backup. And what should I do to backup the MySQL database? (With easy way to recover?) I am not pleased with the mysqldump tool, since then the backup needs 9 hours. A simple TAR operation (even with theoretical retries) is faster.
Re: Tar: File has changed while reading
File modifications will be a problem regardless of backup format / tool used. I'm quite content with using tar to backup (though a daily full backup seems a bit excessive to me). Anyway, you'll almost certainly want to be looking in the direction of LVM snapshots.
-
- Posts: 117
- Joined: 2008-11-08 19:49
Re: Tar: File has changed while reading
Hello.
Alas, I didn't find a solution. I have searched about information about LVM-snapshots, but websites like http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html just tell me that I should run a TAR operation. And as I said before, a TAR operation needs several hours and fails if a file is currently read/write - and since the server is VERY busy, this happens here and then. So, is there any way to do a good backup job without getting into trouble if a file is currently in access? Please give me some information.
Regards
konfiguros
Alas, I didn't find a solution. I have searched about information about LVM-snapshots, but websites like http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html just tell me that I should run a TAR operation. And as I said before, a TAR operation needs several hours and fails if a file is currently read/write - and since the server is VERY busy, this happens here and then. So, is there any way to do a good backup job without getting into trouble if a file is currently in access? Please give me some information.
Regards
konfiguros
Re: Tar: File has changed while reading
These numbers suggest that every day you are backing up over 100 gigabytes of data; or you are using very slow backup media. If it is the latter then you should look towards buffering the data (tarring to a harddrive then, when finished, transferring the tarball, or rather a compressed version of it, to the slower media). If you are actually backing up 100 gigabytes of data each day, you should reconsider your process and only perform incremental backups on a daily basis, with full backups being performed less frequently.konfiguros wrote:Ever 24h I do a FULL backup of all userdata, including the mysql-directory, /etc, httpdocs, /var/mail, /root and /home. This backup needs 5 hours. Of course, I cannot stop my mysql-server for 5 hours, just to prevent that this message appears.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan