Created
February 27, 2017 18:46
-
-
Save rhemz/b3ecaf09b3152c6fd929ff65c2e2c3c2 to your computer and use it in GitHub Desktop.
add ec2 block device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir /data | |
sudo mkfs.ext4 /dev/xvdf | |
# then | |
sudo mount -t ext4 /dev/xvdf /data/ | |
# or add to /etc/fstab | |
/dev/xvdf /data ext4 defaults,nofail 0 2 | |
sudo mount -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To move MySQL data and binlog storage to the new volume, continue with these steps:
Make
mysql
user the owner of /data:sudo mkdir -p /data/mysql/binlogs
sudo chown -R mysql:mysql /data/mysql
Stop MySQL:
sudo /etc/init.d/mysql stop
Copy the existing data folder (located in /var/lib/mysql by default) into /data:
sudo cp -p -R /var/lib/mysql /data/
sudo cp -p -R /var/log/mysql/mysql-bin.* /data/mysql/binlogs/
Edit the MySQL configuration file and:
datadir
(which should be /var/lib/mysql) to the new data folder (/data/mysql).log_bin
(which should be /var/log/mysql/mysql-bin.log) to the same file in the new log folder (/data/mysql/binlogs/mysql-bin.log)sudo nano /etc/mysql/my.cnf
Reset AppArmor (Ubuntu Server only?):
sudo nano /etc/apparmor.d/usr.sbin.mysqld
Look for lines beginning with /var/lib/mysql or /var/log/mysql. Change them to their appropriate new locations (/data/mysql and /data/mysql/binlogs, respectively) and save the file.
Restart AppArmor profiles:
sudo service apparmor reload
Restart MySQL:
sudo service mysql start