Extends Ubuntu HDD for existed Web Server

Table of Content

When we start out website, we may not care about how big our HDD must is.

But when your site is grow up, we need more space for store many types of log files and our MySQL Database increase.

In this post i will introduce you the simple way to deal with new adding HDD to existed Ubuntu Server.

Mount your new HDD as a new folder in current system.

When we plug the new HDD to our Ubuntu server, it just stay there and nothing affected to current system,

Let’s see our current server status by using df -h to see the list of current hdd at our system.

  • Mount our new HDD to one folder in current system :

  • Stop Running MySQL instance and copy database using rsync :

After rsync command completed, we must go to detail about our current MySQL configuration and apparmor services.

Edit current MySQL configuration and AppArmor Service

Go to your MYSQL configuration at /etc/mysql and every config have /var/lib/mysql to /hdd/store/mysql.

Edit apparmor service :

Reconfigure MySQL if needed

Now we have new directory contains all current MySQL files.

Try to rename the old directory and reconfigure MySQL

If everything fine, we will have MySQL running on new datadir location.

Now we can remove old /var/lib/mysql.bak.

If have any errors, check the section below.

Find error MySQL can not start

Leave a Reply

Your email address will not be published. Required fields are marked *