Hi all, warning: linux only, don't use this if your database(s) are larger then available ram For sake of speed I created an init script that loads all available databases into tmpfs on boot prior to starting mysql , and dumps them on shutdown of mysql. The script uses rsync instead of rm / copy to only copy the changed tables. I'm looking for an alternative to mysql slave replication on the same machine, as this is, overly complex and slave doesn't keep an exact copy > as for a I know one has manually export new databases, and the slave also keeps it's own database. I'm planning to write a watchdog script using the inotify kernel subsystem to commit all changes inside the tmpfs to storage. Does anyone has a better solution ? attached is the mysqltmpfs init script that goes in /etc/init.d install requires a small change to the my.cnf script I'll write a complete howto upon finishing inotify script ( or a suggested alternative ) Os=debian wheezy cheers djamu Code: #!/bin/bash # ### BEGIN INIT INFO # Provides: mysqltmpfs # Required-Start: $local_fs $remote_fs $syslog # Required-Stop: $local_fs $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # X-Start-Before: mysql # X-Stop-After: mysql # Short-Description: use tmpfs for mysql storage # Description: copies the stored mysql data to tmpfs upon start before mysql is started # copies tmpfs mysql data to permanent after mysql shutdown # stores all changes to mysql permanent before shutdown / reboot ### END INIT INFO . /lib/lsb/init-functions if [ ! -d /var/lib/mysql ]; then mkdir /var/lib/mysql fi start () { echo -n "Mounting MySQL tmpfs data folder: " rc=0 mount -t tmpfs -o rw,nosuid,nodev,noexec,uid=`id -u mysql`,gid=`id -g mysql` tmpfs /var/lib/mysql if [ "$?" -ne "0" ]; then log_failure_msg "Failed to mount MySQL data folder as tmpfs" rc=1 elif [ -d /var/lib/mysql_permanent ]; then chown -R mysql:mysql /var/lib/mysql chmod 0700 /var/lib/mysql /usr/bin/rsync -ArpEogt --delete --exclude=tmp/* /var/lib/mysql_permanent/ /var/lib/mysql/ touch /var/lib/mysql/.mysqldatadir fi if [ $rc -eq 0 ]; then log_end_msg 0 else log_end_msg 1 fi } stop () { echo -n "Unmounting MySQL tmpfs data folder: " rc=0 if [ -f /var/lib/mysql/.mysqldatadir ]; then rm -f /var/lib/mysql/.mysqldatadir /usr/bin/rsync -ArpEogt --delete --exclude=tmp/* /var/lib/mysql/ /var/lib/mysql_permanent/ umount /var/lib/mysql if [ "$?" -ne "0" ]; then rc=1 fi fi if [ $rc -eq 0 ]; then log_end_msg 0 else log_end_msg 1 fi } restart () { stop start } # # main() # case "$1" in start) start ;; stop) stop ;; restart|reload|force-reload) restart ;; *) echo $"Usage: $0 {start|stop|restart|reload|force-reload}" exit 1 esac exit 0