| How to Mysql + SSD |
Feb 20, 2010
About a year ago we installed our first SSD and we liked it. We did learn about some issues in that you can corrupt tables if you dump or do some other big read on a table while you are triing to write to it. If you need some brief consulting about this subject please let us know.
Otherwise here are the steps to move your mysql database onto a dedicated SSD.
NOTE: These are directions for an Ubuntu Server and we assume you have the drive installed, you know what vim is, you are comfortable on the command line .. aka you should be a linux sysadmin.
first use fdisk to create a new partition on the new drive
you can use
?> ls /dev/s* to find the new drive
?> fdisk /dev/somedrive (n to create a new partition then 1 enter enter then w)
then format the drive as a reiser partition
make a place to mount it
?> mkdir /ssd
get the UUID and add the drive to /etc/fstab
?> blkid /dev/sd...
vim /etc/fstab .. add it
update apparmor ...
?> vim /etc/apparmor.d/usr.sbin.mysqld
add this appropriately ....
restart apparmor so it for sure reloads it's config
?> /etc/init.d/apparmor restart
stop mysql because we are about to move all the data dirs ..
?> /etc/init.d/mysql stop
move and re-link the databases you want on the ssd
?> cd /var/lib/mysql
?> mv exampledb /ssd/.;ln -s /ssd/exampledb .
after you have moved and linked your databases .. restart mysql
?> /etc/init.d/mysql start
you should probably test your db .. :-)
1 of 1