[mythtv-users] ramfs for mysql

Mark Boyum mark at boyum.us
Wed Jan 4 20:10:18 UTC 2012


On Wed, Jan 4, 2012 at 1:02 PM, Simon Hobson <linux at thehobsons.co.uk> wrote:
> Josu Lazkano wrote:
>
>>cp -R /var/lib/mysql /tmp/mysqltmp/
>>chown -R mysql:mysql /tmp/mysqltmp/mysql/
>
> You don't need to fiddle with ownerships and permissions - just use
> the "-p" option to cp and it will preserve ownership and permissions.
>
>>How could I copy all data on system stop and then copy again on system start?
>
> If you need to ask that, then it may not be the right option for you.
>
> You probably want to modify the mysql start/stop script. The system
> calls this during startup & shutdown. You need to have the shutdown
> option copy all the tables to a safe place after stopping the daemon,
> and the startup option copy the safe copies to the ram disk before
> starting the daemon.
> If the system is running for a long time, you almost certainly want
> to stop mysql from time to time and copy the tables to safe storage -
> otherwise you risk losing potentially weeks or months of updates. If
> you've modified the start/stop script, then this could be achieved by
> a cronjob that just just stops and immediately starts mysql.
> As a refinement, you could have the start option check to see if the
> files on ram disk are the same age as those on real disk and skip the
> copy - thus saving the copy back if the system hasn't been restarted
> and so has the current DB files already on ram disk.
>
> --
> Simon Hobson

Would the rsync command be a better option than cp?


More information about the mythtv-users mailing list