1

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 :)

Cyril N.
  • 624
  • 1
  • 10
  • 36

3 Answers3

2

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...).

philippe
  • 2,303
  • 4
  • 32
  • 53
2

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.

Soham Chakraborty
  • 3,584
  • 17
  • 24
2

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

JKim
  • 562
  • 3
  • 10