11 Steps to Increasing Disc Space for AWS MySQL Server
The following 10 steps guide will help you expand your disk meet your business needs:
- Create a new storage volume at the Amazon console (or using AWS API). Make sure it is big enough to accommodate storage, log files, bin files and future growth. Notice! verify the new drive is in the same availability zone as the target instance.
- Write down the mount name you chosen. For example: /dev/sdf.
- Mount the disk to your system according to Chris Dean post:
- sudo mkfs.ext3 /dev/sdf where /dev/sdf is the mount name you chose.
- Shutdown the MySQL daemon: sudo /etc/init.d/mysql stop
- Unmount the current disk umount /dev/sdf
- Move your current MySQL data directory to a temporary directory: sudo mv /var/lib/mysql /var/lib/mysql.old or mount the previous disk to mysql.old by creating a new folder and changing the /etc/fstab as described bellow.
- Recreate the MySQL data directory and provide the needed permissions:
- sudo mkdir /var/lib/mysql
- sudo chown mysql:mysql /var/lib/mysql
- Mount the new disk to the new directory:
- Add another line to /etc/fstab (sudo vi /etc/fstab): /dev/sdf /var/lib/mysql ext3 defaults 1 2
- Mount the disk: sudo mount /var/lib/mysql
- Verify everything is Okay with df
- Move the files from the temporary directory back to the new data directory sudo mv /var/lib/mysql.old/* /var/lib/mysql
- Remove the old directory: sudo rmdir /var/lib/mysql.old and unmount the old disk umount /dev/sdf
- Restart you MySQL: sudo /etc/init.d/mysql start
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)