I have a Ubuntu 16.04 server with an 18TB RAID array. I am running virtual servers on the server using Wok/Kimchi and am wondering if it is reasonable to run a MySQL virtual server and set the data directory to run on the RAID that is mounted by sshfs or samba? Alternatively, should I just make a large virtual machine instance and keep the data in the default /var/lib/mysql location and then do backups of the database to the RAID array? I would think it is best to keep the data in a "real" location on the RAID but perhaps if that RAID is unmounted for some reason my database will be corrupted.

For testing I tried setting the data directory to the mounted RAID and ran into all sorts of ownership issues despite several different ways of doing this that I found online. The one that sort of works is to mount the RAID using sshfs using solution 2 from here, but that is maybe not best from a security perspective: https://unix.stackexchange.com/questions/326883/owner-of-sshfs-mounted-directory-with-777-permission-cant-open-it-no-acl-no-s

I then followed this guide to mv /var/lib/mysql to the mounted RAID array: http://www.vacilando.org/article/moving-mysql-data-files-virtualbox-shared-folder. It threw file permission/ownership errors but appears to have moved the folder and mysql is running and I can create databases. I could never get anything to work with a samba mount because of ownership issues. Also, trying to rsync the /var/lib/mysql directory to the RAID never worked and I had to use mv despite it also giving ownership errors with the sshfs mount.

I am quite new to this and maybe overthinking something here, which is why maybe I should make the large (a few TB should be plenty) storage allocation for a virtual machine and let mysql store its data in the default /var/lib/mysql directory.

  • Perhaps you are not I/O-bound, so the performance of samba or sshfs does not matter? – Rick James Jan 3 '19 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.