Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just finished developing a rails app which has a mysql db as a backend.
The app is meant for high traffic and will store lots of information. I am planning to set up my own web server and host the site from it.

If in future my disk space runs out i would want to expand by adding more space.
But say if my mysql database is housed in my /disk0s1 and by adding a new drive i have more partitions (and hence more disk space), how then would i extend my database to store information on those partitions too, and at the same time prevent any information from being written on the original partition. Should i go for multiple databases? if so how?

If i went for a hosting solution i wouldn't be bothering about this as i would just have to worry about making payments for the extra space :)
I always wondered how space is added on-the-go by these webhosts.
Is there any specific mysql configuration that i have to make?

share|improve this question

migrated from Mar 24 '10 at 1:37

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

You don't mention what platform you're using - my answer relates entirely to Linux/Unix so discard my answer if you want to use Windows.

Some filesystems can be grown - XFS and JFS are examples - so if the partition on-disk was resized, it would just be a simple case of resizing the filesystem to accommodate the additional space.

There are other options if the filesystem cannot be resized. MySQL is actually quite a good candidate because it stores each database in a separate directory, so what you can do if one database grows beyond the available space, is move the database's directory onto a new partition, and symlink to the directory from within the MySQL data folder.

Or you can even symlink the entire MySQL directory so if you add a new disk in to the server with more space, you just move the data directory onto the new disk, create a symlink to the new path from the old path, restart MySQL and you're good to go.

You can actually do a similar thing in Windows with NTFS mount-points, but you can only link an entire drive into a folder on another drive, not on an individual folder/file level like you can with Linux symlinks.

share|improve this answer
I am on a mac. This answer is good for probably temporarily getting out of trouble. Say the application grew to an extent where i need to have more space than the current max limit for the physical hard disk space available in the market. The only other option that would seem fair to me is either merge partitions or somehow extend the mysql database to use another partition while having just a read-only access to the present partition. – user35526 Mar 22 '10 at 10:53
How do you merge partitions on mac? Or rather is it possible using disk utility if i add a new drive? Again i would then face an other kind of problem. There is a max limit of 6 sata drives that can be added to the rack. What if my space requirement exceeds that too in the future? How do data centers resolve such issues? – user35526 Mar 22 '10 at 10:56
Data centers typically have storage servers (NAS) on their own dedicated network - SANs. Extending storage is as easy as adding another hard drive (enterprise NASs hold > 50 drives) or another NAS device. Will you be hosting your MySQL service on a Mac? Is it a Mac server? – Andy Shellam Mar 22 '10 at 11:02
You might also want to look at how much of your data is required to be "live", and how much you can archive away into a separate database, or summarise. Other database systems have the concept of "tablespaces" - you can put separate tables into their own physical folders on-disk. PostgreSQL in particular I'm thinking of here. – Andy Shellam Mar 22 '10 at 11:05
Ok that seems great. And thanks for the info on NAS. I'll look into it. Yes it is a Mac server. – user35526 Mar 22 '10 at 11:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.