I'm working on a Debian machine with a bunch of different filesystems and I'm trying to manipulate a large amount of data in MySQL. I've run out of room in my home directory, but there's a ton of empty space in other systems (particularly one that's located in /srv). I want to make it so that /var/lib/mysql (the directory that stores MySQL data) seems to still be in its rightful location, but all of its data is stored in /srv/mysql. How can I do this?
First, move or copy
$ mv -i /var/lib/mysql /srv $ cp -ir /var/lib/mysql /srv
You may want to use a bind mount instead of a symbolic link. Bind mounts won't break in special roots.
$ mkdir /var/lib/mysql $ mount --bind /srv/mysql /var/lib/mysql
if you decide to use a symbolic link, remove the old
/var/lib/mysql directory and run the following.
$ ln -s /srv/mysql /var/lib/mysql