-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Masse wrote:

> In the later part of June a new Linux Mysql server was installed.
> While mysqld was still running, the data folder was moved to a different
> volume and a soft link to the new location was put in it's place.   I
> know, bad idea, but everything seemed to work fine, so I didn't think
> anything of it.   Today, the server had to be rebooted for the first
> time since, and now all data since the folder move is gone.   It's as if
> mysqld was just using ram to cache everything, and not writing out
> changes to disk.    Is this true, that all data was only written to
> memory and not disk, or is it possible that the data was written out to
> a temporary location somewhere that I might be able to recover some of
> this data from?
>
> Mike
>

Hi!

I'm assuming since you mention symlinks, that you're running on Unix.

Unix allows processes to write to/read from open file descriptors, even
when some other process removes the underlying file. The physical file
isn't actually removed untill _all_ processes using it have finished
with it. I'm assuming when you say 'moved to a different volume', that
you did a 'mv' to a directory that was under a different mount point.
That means it was basically translated into a 'cp' of the original
directory to the new volume, followed by an 'rm', which is where the
problem comes in.

What most likely happened is that the data was written to and read from
disk, using the file pointed to by the _original_ file descriptor (not
the symlinked file). Once you shutdown MySQL, you lost all of that data.
It's not a MySQL problem, it's how the operating system behaves. The
data is gone. I hope you had backups and/or bin logging turned on,
otherwise you won't be able to recover it :(

Although it is not prudent to move files out from underneath running
processes in Unix for this very reason, you could've gotten away with
this if you did a 'FLUSH TABLES WITH READ LOCK' before you moved the
files, followed by an 'UNLOCK TABLES', so that MySQL would close all
file descriptors, and not allow writes until after you moved them.

        -Mark

- --
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 557 2388
www.mysql.com

Are you MySQL Certified?
http://www.mysql.com/certification/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/IBLEtvXNTca6JD8RArhCAKC73pWAZIA8rVtFBsGKzv7AbL7BvQCdGJfs
IzcHzKB4bI3N5IGp7+penAI=
=xrMY
-----END PGP SIGNATURE-----


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to