Page 1 of 1

Moving database data directory to its own drive

PostPosted: Sun Mar 11, 2018 10:41 pm
by alo
This may be more of a OpenSuSE Question, but I noticed Matt and others recommended putting database data directory on a separate physical drive partition from the rest of the Linux filesystem. Well I added a second drive and I see it and I can mount it, but If I mount it to the existing /srv/mysql Directory it just sits there and doesn't move database files to the directory.

Anyone know the best way to put the database data directory on this new separate physical drive partition?
Is it as simple as mounting the hard drive and then moving the files to the new Partition?

Thanks a bunch guys.

Vicibox 8.0.1
VERSION: 2.14-656a
BUILD: 180215-1318
SVN 2918
DB Schema Version: 1536
Asterisk 11.25.3-vici
Single server DB/Web/dialer
25 agents
webrtc Viciphone

Re: Moving database data directory to its own drive

PostPosted: Sun Mar 11, 2018 11:07 pm
by williamconley
Mounting a drive in a folder in NO way "communicates a need to copy files" to that folder.

Steps:

1) Mount the drive in /mnt (or some other innocuous location)
2) Shut down mysql
3) Move the files to the /mnt folder (not a sub-folder of /mnt, but in the /mnt folder itself if that's where you mounted the drive).
4) Remount the drive in the mysql folder, which should now be EMPTY because you moved all the files .. until after you remount the drive, of course, then they will magically reappear cuz that's where you put them!
5) Re-start mysql ... which will start up normally because as far as it's concerned the files never moved.

Obviously it's recommended to back up the entire mysql system (all databases) before you do this. It's not a bad idea to be very familiar with Linux and MySQL before attempting such a trick.

In this case, I'd highly recommend you practice on another server first. Perhaps a virtual one. It's easy once you know how, but it's equally easy to screw up and break something. Get that backup, get it OFF the Vicidial server, and test-restore it on another instance of MySQL to be certain it's valid (a backup set that has never been tested to be valid is actually a trap 8-) ).

Re: Moving database data directory to its own drive

PostPosted: Mon Mar 26, 2018 10:35 pm
by alo
This was quick and easy and painless. No sure if I notice much of a performance increase, But Its running fine!

Thank you very much!

Re: Moving database data directory to its own drive

PostPosted: Tue Mar 27, 2018 9:21 am
by williamconley
alo wrote:This was quick and easy and painless. No sure if I notice much of a performance increase, But Its running fine!

Thank you very much!

The improvement is only notable during seriously heavy usage when it would otherwise slow down the system. At that point, you are ordinarily too busy to be checking on the DB server ... unless it's crashing. lol