Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm installing Debian Wheezy on a 50 GB partition of a 500 GB Seagate SATA hard disk with 2 GB RAM. I want to use following partition scheme, but stuck at:

  1. How much (in percent) of disk space should be given to following partitions?
  2. The order in which partitions should be created?

So that system runs very fast and smooth.

/
/boot
/home
/tmp
/usr
/var
/srv
/opt
/var/www
/usr/local
SWAP

MACHINE INFORMATION

  1. Debian Wheezy 64 Bit Update up to Date
  2. Role of Machine Server
  3. Main Software
  4. Bind9, Apache2, Mysql-Server, PHP5
  5. 500 GB Seagate SATA Hard Disk
  6. 2 Partitions 50 GB & 450 GB I do not want touch 450 GB Partition (sda2) however I can take 50 GB more from sda2 if required
share|improve this question
    
An optimal partitioning scheme would be very much dependent on the role of the machine. On a desktop workstation, for instance, you'd probably want a large /home while /var/www wouldn't even warrant a separate partition. On the other hand, if the primary role of the machine is to run a web server, the reverse could be true. –  Thomas Nyman Aug 21 '13 at 12:21
    
@ThomasNyman, It is a server machine; im updating my question. thank you –  Nishan Aug 21 '13 at 12:23

4 Answers 4

up vote 1 down vote accepted

Because you are creating all the Debian partitions on the same disk, there is no performance gains to be made by different partition layouts. The only gains are for risk reduction (because putting everything in / can put you in a "bad place" [tm] if that partitions disk space is all used up). I would suggest:

 / 1G
 /boot 100M
 /usr 10G
 /var 15G
 /home 20G
 swap 4G

Place all of /home's space into /usr if you do not plan to have many users/require large space for home directories.

/ a 1G / is generous as most of your operating install will land in /usr. Some libraries will end up in /lib but will only be a few hundred Megabytes in size for most servers. If you are paranoid increase the size of /. /var tends to be your non-volatile data area, log files, pid files, crontabs, transient mail queues, non-volatile tmp directory and so forth. /home is more for the benefit of users, but if in a server role there is nothing to stop you from configuring apache to look in /home/www instead of /var/www, or to symlink over to the /home partition from /var/www.

I've ran my servers in this setup for a number of years and have only had to vary the formula for specific server roles (database servers, large volume mail servers).

share|improve this answer
    
thank you for your advise and answer but what about /tmp, /srv, /opt, /var/www, /usr/local –  Nishan Aug 21 '13 at 11:04
    
/tmp is often tmpfs (which is actually held in memory), most linux distributions do not have /srv or /opt. /var/www can always be a symlink to /home, and even with /usr/local installs you will be hard pushed to fill 10G. –  Drav Sloan Aug 21 '13 at 15:45
    
I've updated my question to reflect the new information in your question and to give some insight to my choice of sizes. –  Drav Sloan Aug 21 '13 at 15:54

The partition layout has zero influence on the speed of the system (unless you have partitions across multiple drives). So choose what makes maintenance easier (which is part of running smooth). Unless you have special needs, create the following filesystems (in addition to swap):

  • / for the operating system
  • /home for user data, unless it's a server that only has a few dot files in /home`
  • Possibly a separate for data that doesn't belong to a human user, usually mounted on /srv.

In your case, a separate /home is probably not warranted, but you might want a separate /srv. If you do separate /srv then /var/www and /var/mysql should be symbolic links to directories under /srv.

The partition sizes depend on how much data you have and how many programs you want to install beyond the basic LAMP installation. 10GB for the OS is plenty.

Mount /tmp as tmpfs.

Separate partitions for /var, /usr, /opt and so on will only complicate your life and will bring you no benefit whatsoever.

Use LVM for partitioning, don't create more PC-style partitions. LVM makes administration a lot easier.

share|improve this answer
    
Just one thing How Mount /tmp as tmpfs will affect system RAM. I have just 2GB RAM at all. –  Nishan Aug 23 '13 at 9:22
    
@Nishan Mounting /tmp as tmpfs doesn't affect RAM usage. With tmpfs data is either in RAM or swap, with other filesystems data is either in RAM (buffers/cache) or on-disk, same difference. Mounting /tmp as tmpfs gives a slight performance improvement and avoids needing to clean up or having obsolete files on boot. –  Gilles Aug 23 '13 at 9:50
    
Thank you, however tmpfs data is either in RAM or swap is confusing me, if temp data is in RAM, it is bound to consume the RAM to some extent. But i am sure there must be some theory behind this and logic behind your advice, which i need to understand. Thank you once again. –  Nishan Aug 23 '13 at 11:09
    
@Nishan If you put a short-lived file in an on-disk filesystem, it might stay in the cache and never hit disk. If you put a long-lived file in tmpfs, it might get swapped out. Temp data doesn't consume more or less RAM depending on whether it's on tmpfs or not. Tmpfs can be swapped in and out more efficiently because the kernel doesn't need to enforce any kind of consistent state in case of a power failure. But the amount of RAM and storage that some data consumes is the same whether it's on tmpfs or on-disk storage. –  Gilles Aug 23 '13 at 11:13
    
THANKKKK YOU, it enters my brain now. –  Nishan Aug 23 '13 at 11:22

I like to use LVM for partitioning. It's a bit more complex, but I think that its versatility makes it worth it. So I'd partition like this:

  • sda1: /boot (256M)
  • sda2: LVM physical volume (everything else)

You could use LVM also for boot, but it's more complex.

Then I'd create a volume group using sda2 ("vg01", or whatever strikes your fancy) and define these logical volumes:

  • root (mounted on /): 2G
  • usr (/usr): 10G
  • var (/var): 3G
  • home (/home): 10G
  • swap (for swap): 2G (depending on your memory; I'd use 4GB tops)

I like to use names for LVs that tell me what is in them. Plus, it makes it easier to tab-complete :-)

This layout would leave about 23GB (50 - (2+10+3+10+2)) free to assign to whatever you want. With LVM you can create volumes for temporary things and then delete them, or resize current volumes if you find you need more space.

share|improve this answer

Since you've made a small partition, I would just put everything on / and make about 2GB of swap. That's it :)

share|improve this answer

Your Answer

 
discard

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

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