I'm using ubuntu 12.04 and have two disk partition named: /dev/sda and /dev/sdb.

my home partition and other programs are in /dev/sda. therefor any work like database benchmark on my mysql databases will do IO Transactions on /dev/sda.

I'm going to do (or redirect) this IO Transactions on(to) /dev/sdb. my search results show that i should copy my myql folder to /dev/sdb and then using symlink create a symbolic link from mysql to new mysql in /dev/sdb.

first of all, does this solution is correct? if so, how can i exactly do that? and what should i consider(such as using cp or rsync command for copy files.)?

here is symlink for mysql.

1 Answer 1


Basically, the section 8.12.4 Using Symbolic Links is advising you that it is possible to make the database-directory (such as /var/lib/mysql) a symbolic link to another location with more space. With Ubuntu, you can do that, or you could make /dev/sdb mounted on /var/lib/mysql. A mountpoint may be (slightly) more efficient.

Either way, to migrate your database to the other filesystem, you would

  • shutdown mysql (e.g., mysqld).
  • use rsync for copying the files,
  • for the moment, rename the old database directory (in case you made an error),
  • make your symbolic link (or create a new directory as a mountpoint, mount the large filesystem there)
  • start up mysql
  • verify that it works
  • remove the renamed/saved database directory

In either case, the device /dev/sdb has to be mounted on a directory. This is done in /etc/fstab, and is manipulated using the mount and umount commands.

Further reading:

  • fi my benchmark creates new database and tables does new database and tables creates on /dev/sdb?
    – mR.aTA
    Jan 30, 2016 at 17:26
  • Once you've migrated everything, the new disk acts just like the old disk -- for that directory. Jan 30, 2016 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .