MySQL Enable SSD storage Chszs, All rights reserved, without consent, not reproduced. Blogger Home: Http://blog.csdn.net/chszs
Sometimes OS read-write slows down the performance of the MySQL server, especially when the OS uses the same disk as MySQL. So it's best to let MySQL use a separate disk, to use SSDs better. To do this, you need to mount the SSD new disk to the server, assuming the new disk is/dev/sdb.
1. Prepare a new disk:
# fdisk /dev/sdb
Pressing "n" will create a new partition, and pressing "P" will create a new primary partition. Then set the partition number (from 1~4), then select the size of the partition and press ENTER.
If you do not want to use the entire disk as a partition, you will still need to create a new partition.
Press "W" to achieve write changes.
2. Create file system in new partition
# mkfs.ext4 /dev/sdb1
3, the new partition map to a directory, I named "SSD", under the root directory.
# mkdir /ssd/# mount /dev/sdb1 /ssd/
4. Allow this mapping to take effect when the server is started
Modifying a configuration file/etc/fstab
/dev/sdb1 /ssd ext4 defaults 0 0
5. Move MySQL to the new disk
Stop MySQL service first
# service mysqld stop
If the system has a service that writes MySQL, it also stops, such as
# service httpd stop# service nginx stop
Copy the entire MySQL directory to the new disk
# cp /var/lib/mysql /ssd/ -Rp
After the copy is complete, rename the MySQL directory
# mv /var/lib/mysql /var/lib/mysql-backup
Then create a symbolic link
# ln -s /ssd/mysql /var/lib/mysql
Now it's time to start the MySQL service.
# service mysqld start# service httpd start# service nginx start
Copyright NOTICE: This article for Bo Master Chszs original article, without Bo Master permission not reproduced.
MySQL Enable SSD storage