Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How many and which partitions should I create for a linux server?

I just bought a dedicated serveur with 2TB of storage. I'll install Debian on it, but I'm reconsidering how to partition my disk.

Previously, I had the same server with this configuration (automatically defined by my provider) :

/ -> 10 GB
/home -> 1.99 TB

Problem was that I quickly went to 90% of / because MySQL, stored in /var/, was way too heavy for only 10GB.

In the /home, I store all the websites, looking like this :

/home/domain.tld/subdomain/ # like :
/home/google.com/www/
/home/google.com/calendar/
/home/facebook.com/www/
/home/facebook.com/api/

(note: yeah I own Google and Facebook, why? ;))

So having a lot of storage space for /home seems correct.

For the new server, I thought to create only two partitions / and swap, but before doing something awful, I was wondering what you would recommend me to do ?

Thanks for your expertise guys :)

share|improve this question
    
@claasz yup, it seems so :/ sorry. –  Cyril N. Jan 29 '13 at 9:32
    
You can define a different data directory for MySQL that is in /home, not the best idea, but a valid idea ;) –  jwbensley Jan 29 '13 at 9:36
add comment

marked as duplicate by MadHatter, Khaled, Alex, Dave M, Ward Jan 29 '13 at 14:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

up vote 2 down vote accepted

I've tended to put /var in its own partition and also /srv in its own partition.

On a production server, /var in its own partition is a good idea, not only because you may need a lot of space for it (as you've discovered), but also because if it fills up with logs, you don't want it bringing your whole server to a grinding halt.

Also, I tend to create a mount point /srv, and mount a separate partition there too. If I need storage for services, I put them all under /srv (usually it's Samba shares I deal with).

So with the way I tend to use Linux, I have /var and /srv and /home as areas which are likely to grow a lot, and I use a separate partition for all of these mount points. I'd also prefer to move the MySQL storage location from /var to /srv, so all the data for services are under the one easy-to-remember location. Also, websites which arent relevant to just one single user, I also tend to move from /var/www to /srv/www for consistency.

I also think LVM is a good thing to learn about and use. However, if you're using Linux in a virtual environment, it's less of an issue, since it's not such a big deal to go about resizing virtual disks, and therefore the advantage of LVM is a bit diminished (although there are still advantages). I've been trying to learn Linux administration via the command shell, so I've tiered my learning. I've left out LVM for now and have gotten fairly familiar with the old way for the time being...

..but whether you choose to use LVM or not, there's no getting around learning about what the intended use of the various directories are. Once you know these, you're better equipped to make your own decisions about how to partition. You can read more about that in the Filesystem Hierarchy Standard

share|improve this answer
add comment

It entirely depends on your usage and nature of your applications. Some guys keep a separate /var partition. Anyway, you will see that people who use oracle uses a separate partition for the oracle data and often for oracle redo logs as well.

You can also consider /var to be a lvm partition. Don't oversize a partition, choose with something that you feel will be used up. Since you already had a space crisis, you know the rate at which mysql fills up the space. Allocate the /var/ keeping that in mind.

You can also create a separate /var/lib/mysql.

But, please ensure that you use lvm. It is almost indispensable for a sysadmin work.

share|improve this answer
add comment

There is no proper way to define what is a correct partition schema. It depends a lot on what your server is for, and for instance, a server used by MySQL may want its own partition for /var, as your pointed out.

However, I suggest the use of LVM (Logical Volume Manager). LVM. It allows to abstract your physical devices (disks) and let you create your partition schema as you would do in classical partitioning. More interesting, it lets you change the size of logical volumes (partitions) on running servers. This way, you bother less on defining properly what your partition schema should look like, because anyway you still have the possibility of changing it on running environment. Last but not least, it lets you taking snapshot of logical volume, (useful as backup).

To sum thinks up, this solution avoids the problem you are having, and gives you more flexibility for others purposes (snapshots, mirroring...).

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.