Prerequisite: A free partition that will serve as a dedicated MySQL partition.
Note: These instructions assume that the partition you wish to mount is /dev/sdc1
- Backup all MySQL databases
Code:
mysqldump --opt --all-databases | gzip > /home/alldatabases.sql.gz
- Stop tailwatchd and the mysql (tailwatchd monitors services, so disable it to prevent it from prematurely restarting mysql)
Code:
/scripts/restartsrv_tailwatchd --stop /scripts/restartsrv_mysql --stop
- Backup the MySQL data directory in case something goes awry
Code:
mv /var/lib/mysql /var/lib/mysql.backup
- Create the new mount point
Code:
mkdir /var/lib/mysql
- Configure /etc/fstab so that the new partition is mounted when the server boots (adjust values as necessary)
Code:
echo "/dev/sdc1 /var/lib/mysql ext3 defaults,usrquota 0 1" >> /etc/fstab
- Mount the new partition. The following command will mount everything in /etc/fstab:
Code:
mount -a
- Change the ownership of the mount point so that it is accessible to the user “mysql”
Code:
chown mysql:mysql /var/lib/mysql
- Ensure that the permissions of the mount point are correct
Code:
chmod 711 /var/lib/mysql
- Start mysql and tailwatchd
Code:
/scripts/restartsrv_mysql --start /scripts/restartsrv_tailwatchd --start
- Ensure that the MySQL data directory is mounted correctly:
Code:
mount |grep /var/lib/mysql
- You should see a line that looks like this:
/dev/sdc1 on /var/lib/mysql type ext3 (rw,usrquota)