473,748 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2337
>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***********@b urditt.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
2604
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"; $user = "root"; $pass = "password"; $database = "database"; $dbname = array ("1","2","3","4","5");
0
493
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 to split the mysqldump so that the output comprises of several files of less than 2 gigabytes each. Does anyone know the mysqldump options that could be used to do this? Or with using the >
7
7411
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 4.0.16, for portbld-freebsd4.9 (i386) I attempted to restore the DB with
0
2275
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 -p<passwd> (misc. options) bugs > bugs.sql Then try to restore it to an empty DB, "foobar" with this command # mysql -u root -p<passwd> foobar < bugs.sql It fails, with this not-too-helpful error:
1
4688
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 table dummy(col1 blob); -- Next insert a null ascii character (0) insert into dummy values (char(0)); -- To verify there is actually something there type: select length(col1) from dummy;
3
5769
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 drive onto a USB External Hard Drive. I have to assume I also copied the data. I
6
6162
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 minutes. I also tried using mysqlhotcopy, but with no success since it fails with error: "DBD::mysql::db do failed: Not unique table/alias: 'comments' at /usr/ bin/mysqlhotcopy line 466." I'd like to make a daily MySQL backup, but without freezing...
0
2930
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 without query logging ? ( when i run mysqldump .. i 'm not need to keey query log ) Thank you very much.
12
1802
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 not be under version control, and if I checkout or export the site from version control, and deploy it, it won't bring any of the uploaded files with it. I'm looking at php subversion functions, but the manual says that they're experimental,...
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.