473,396 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Drive Image and mysqldump?

We regularly make drive images of our entire server and store it at a
backup site. To be honest I have never fully understood how the imaging
programs deal with open files. My question is will the drive image make
a good copy of MySQL DB or should I be running a mysqldump before doing
the drive image?

Jul 31 '05 #1
3 2309
>We regularly make drive images of our entire server and store it at a
backup site. To be honest I have never fully understood how the imaging
programs deal with open files. My question is will the drive image make
a good copy of MySQL DB or should I be running a mysqldump before doing
the drive image?


If the MySQL server is actively running (data modifying) queries
while the drive image is being made, you can be pretty sure the
resulting image will potentially have lots of problems. You *might*
get 99% of your data back, but considering that you don't know which
1% is bad, is that acceptable? It's probably better than nothing
after a large fire, but it could still kill your business. You
might see partial changes where the change you see was made after
the change you don't.

In general, the way imaging programs deal with open files is either
"You are instructed not to have any while making the image" (rather
difficult for a root drive), or "BADLY!". Files open read-only
probably aren't a problem.

Assuming you can individually extract files from an image, rather
than restoring the whole thing, you can probably retrieve table
schema (.frm files) unless someone was running ALTER TABLE while
the image was being made, and you can probably retrieve the `mysql`
privileges database as it likely doesn't change that often. If you
try retrieving any table data, I'd sure run CHECK TABLE before
depending on the data, and there's still no guarantee of consistency
of changes even if the indexes look OK.

Check out the options --lock-all-tables and --lock-tables of mysqldump.
A long lock shuts down operations for a long time but you get a
more consistent result.

Gordon L. Burditt
Jul 31 '05 #2
On 2005-07-31 15:08:55 -0500, go***********@burditt.org (Gordon Burditt) said:
We regularly make drive images of our entire server and store it at a
backup site. To be honest I have never fully understood how the imaging
programs deal with open files. My question is will the drive image make
a good copy of MySQL DB or should I be running a mysqldump before doing
the drive image?


If the MySQL server is actively running (data modifying) queries
while the drive image is being made, you can be pretty sure the
resulting image will potentially have lots of problems. You *might*
get 99% of your data back, but considering that you don't know which
1% is bad, is that acceptable? It's probably better than nothing
after a large fire, but it could still kill your business. You
might see partial changes where the change you see was made after
the change you don't.

In general, the way imaging programs deal with open files is either
"You are instructed not to have any while making the image" (rather
difficult for a root drive), or "BADLY!". Files open read-only
probably aren't a problem.

Assuming you can individually extract files from an image, rather
than restoring the whole thing, you can probably retrieve table
schema (.frm files) unless someone was running ALTER TABLE while
the image was being made, and you can probably retrieve the `mysql`
privileges database as it likely doesn't change that often. If you
try retrieving any table data, I'd sure run CHECK TABLE before
depending on the data, and there's still no guarantee of consistency
of changes even if the indexes look OK.

Check out the options --lock-all-tables and --lock-tables of mysqldump.
A long lock shuts down operations for a long time but you get a
more consistent result.

Gordon L. Burditt


Isn't mysqlhotcopy a viable solution for this, to backup your database
while its still running? Thanks for clarification if I'm wrong.

Aug 1 '05 #3
>>> We regularly make drive images of our entire server and store it at a
backup site. To be honest I have never fully understood how the imaging
programs deal with open files. My question is will the drive image make
a good copy of MySQL DB or should I be running a mysqldump before doing
the drive image?


If the MySQL server is actively running (data modifying) queries
while the drive image is being made, you can be pretty sure the
resulting image will potentially have lots of problems. You *might*
get 99% of your data back, but considering that you don't know which
1% is bad, is that acceptable? It's probably better than nothing
after a large fire, but it could still kill your business. You
might see partial changes where the change you see was made after
the change you don't.

In general, the way imaging programs deal with open files is either
"You are instructed not to have any while making the image" (rather
difficult for a root drive), or "BADLY!". Files open read-only
probably aren't a problem.

Assuming you can individually extract files from an image, rather
than restoring the whole thing, you can probably retrieve table
schema (.frm files) unless someone was running ALTER TABLE while
the image was being made, and you can probably retrieve the `mysql`
privileges database as it likely doesn't change that often. If you
try retrieving any table data, I'd sure run CHECK TABLE before
depending on the data, and there's still no guarantee of consistency
of changes even if the indexes look OK.

Check out the options --lock-all-tables and --lock-tables of mysqldump.
A long lock shuts down operations for a long time but you get a
more consistent result.

Gordon L. Burditt


Isn't mysqlhotcopy a viable solution for this, to backup your database
while its still running? Thanks for clarification if I'm wrong.


mysqlhotcopy has some disadvantages:
(1) You have to run it on the mysql server, meaning you need shell
access on that system.
(2) It only does MyISAM and ISAM tables.
(3) It requires UNIX file permissions to read the table files (meaning if
the database is shared, you can steal everyone's data, bypassing any
MySQL permissions). This pretty much means you have to be the admin
of the MySQL server or trusted by the admin or sleeping with the admin.
(4) It still requires locks, so you still shut down (write) operations for
a while if the database is large. (both mysqlhotcopy and mysqldump
let you leave the server running, but it can get really, really
slow for a while due to the locking to anyone trying to make changes
(think about a 1 hour time to refresh a web page that submitted an order).)
(5) The resulting files cannot be easily accessed except by stuffing them
into a database directory on another server (within an acceptable
range of server versions).

(3) is a killer if you are using a hosted web server and database server.

You can also consider using replication, and doing your backup on
the replicated server. Run STOP SLAVE; changes quit getting made
on the slave, run your backup (nobody gets locked out since nobody
is using the slave for anything else), then run START SLAVE; and
the slave catches up with the changes.

Replication by itself is not that good as a backup. It's good
against hardware failures. However, it will replicate accidentally-typed
queries like "DELETE FROM table;" quickly and accidentally erase
your data on all the copies, just like you asked it to.

Gordon L. Burditt
Aug 1 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mangina | last post by:
Hello all. Can anyone see why this snippet of code isnt dumping the databases using mysqldump ? All the credentials are correct (changed for the purpose of this post). $host = "localhost";...
0
by: Thiko | last post by:
Hi We currently use mysqldump to dump all our db's in quick mode to one file, backup.sql. This file has come quite large. mysqldump -Aq -u root > /MySQL/backup/backup.sql I would now like...
7
by: Adam Smith | last post by:
Hope this is the right news group!! I did a server upgrade and at the same time did a mysql update from 4.0.12 to Ver 12.22 Distrib 4.0.16 mach1# mysql --version mysql Ver 12.22 Distrib...
0
by: mcstayinskool | last post by:
I'm trying to dump a bugzilla installation to a file, then restore it to a different database name (so as to test my db backup system). I use mysqldump to dump it to a file: # mysqldump -u root...
1
by: Greg.Harabedian | last post by:
I'll start off by saying I am using MySQL v4.0 and my question is...how do I get mysqldump to dump the actual binary values store in a blob? Here is an example: -- Create a test table create...
3
by: eieiohh | last post by:
MySQL 3.23.49 PHP 4.3.8 Apache 2.0.51 Hi All! Newbie.. I had a CRM Open Source application installed and running. Windows Xp crashed. I was able to copy the contents of the entire hard...
6
by: Antoni | last post by:
Hello, I'm trying to make a daily database backup. When executing "mysqldump - uxxx -pxxx database /home/backup/ddbb.sql -q &" the httpd server gets blocked and my site is "offline" for 30...
0
by: Pratchaya | last post by:
How can i dump (mysqldump) with skip query logging ? Now, when i run mysqldump. mysql log ( query log ) default running/keeping all in result mysqldump. It's possible ? to run mysqldump...
12
by: lawpoop | last post by:
I'm developing a php website that I have under subversion version control. I'm working on an image upload functionality, and in the middle of it I realized that any files that a user uploads will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.