If mysql has been shut down, and given enough time for the tables to
be flushed to disk, then backing up the data dir using tar is fine. You
can tar the data dir without shutting down, providing all transactions
have been stopped and the tables have been flushed to disk. This is how
we backup our servers, and we haven't had an issue yet (restoring daily
to a testing environment).
On Mon, 2007-06-04 at 14:57 -0700, Wm Mussatto wrote:
> On Mon, June 4, 2007 14:21, murthy gandikota said:
> > Hi
> > When restoring a DB from a tar file, I had to repair some of the tables.
> > Whereas when the DB is started after a power failure, everything works
> > fine. I noticed this on RedHat linux and MySQL5.
> > Any thoughts?
> > Thanks
> > Murthy
> What was in the tar file? If you tar'ed the data directory, it is almost
> guaranteed to fail since only part of the updated information may be
> actually written to disk. If the power failure occurred on a system with
> a correctly configured UPS, mysql probably got a shut down command so the
> disk files were in a stable state.
> Normally you should dump the databases and then tar that. (see mysqldump
> command for details).
> William R. Mussatto, Senior Systems Engineer
> Ph. 909-920-9154 ext. 27
> FAX. 909-608-7061