Recently I stumbled over a posting on the German MySQL Forum from a user
that accidentally removed all table files from a MySQL Server's
data directory with a misbehaving shell script. He was surprised
to find out that the server happily continued to serve requests
and his web site was still fully operational, even though
/var/lib/mysql/<database> was completely emtpy! The reason
for this in a nutshell: the rm command only removed the reference
to the table files from the database directory, the files itself
were not removed from the file system yet as the mysqld process
still had the files opened. So as long as a process keeps a file
open, the kernel will not release the disk space occupied by the
file and it will remain intact, albeit no longer visible.
Of course, the user was now desperate to recover the deleted
tables files and was …
Recently I stumbled over a posting on the German MySQL Forum from a user
that accidentally removed all table files from a MySQL Server's
data directory with a misbehaving shell script. He was surprised
to find out that the server happily continued to serve requests
and his web site was still fully operational, even though
/var/lib/mysql/<database> was completely emtpy! The reason
for this in a nutshell: the rm command only removed the reference
to the table files from the database directory, the files itself
were not removed from the file system yet as the mysqld process
still had the files opened. So as long as a process keeps a file
open, the kernel will not release the disk space occupied by the
file and it will remain intact, albeit no longer visible.
Of course, the user was now desperate to recover the deleted
tables files and was …