I am in the process of moving my MySQL databases from SAS Drive to a SSD drive. Currently I am running Centos 5.6 with Cpanel Installed. I have though about moving the data from /home(sas) to /home2(ssd) and then updating the my.cnf to point to the correct datadir location. But I also considered just creating a symlink to point to the new location. My question is which would be better to do? Are there advantages or disadvantages to doing either way?
3 Answers
The performance loss in dereferencing the symlink should occur so infrequently as to be negligible.
If you have a standard path to your datadir on all servers (say, /mysql ) then adding the symlink is a good idea just to make your sysadmin's lives easier but this is irrelevant to your question as you could still put the true path in your my.cnf.
I can't think of any other effect that either of your two options could have.
If you do a symlink, your datas will stay on the SAS drive, so no more preformance than today. So stop MySQL, move all the datas to the new drive. You can do a symlink if you want to the new dir, but I think it is not complicated to change your my.cnf to use the right dir.
Adding the symlink would allow you to keep 'standard' config which has a few benefits:
- Updates and upgrades will be easier. It's not common but there are some cases where a config file can be overwritten on purpose or accidentally so leaving the path standard is always good.
- If you're running other programs that make use of your DBs such as monitoring software, the will expect to find the DBs in /var/lib/mysql. You can likely reconfigure them to your new location, but if you symlink that's one less thing you have to do.
I don't think there are any downsides with respect to speed for symlinks. I supposed there is some sub-nano-second processing time to deference a symlink but I can't imagine it would ever be noticeable.