Partition scheme for installation of Debian

41,703

Solution 1

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

Solution 2

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.

Solution 3

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

Solution 4

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:
41,703

Related videos on Youtube

Nishan
Author by

Nishan

Updated on September 18, 2022

Comments

  • Nishan
    Nishan over 1 year

    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
    • Thomas Nyman
      Thomas Nyman over 10 years
      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.
    • Nishan
      Nishan over 10 years
      @ThomasNyman, It is a server machine; im updating my question. thank you
    • Greenonline
      Greenonline over 2 years
      More or less a duplicate of Best Disk Partitioning Scheme for a Linux-based Developer Machine. It is getting duplicate answers posted.
    • AdminBee
      AdminBee over 2 years
  • Nishan
    Nishan over 10 years
    thank you for your advise and answer but what about /tmp, /srv, /opt, /var/www, /usr/local
  • Drav Sloan
    Drav Sloan over 10 years
    /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
    Drav Sloan over 10 years
    I've updated my question to reflect the new information in your question and to give some insight to my choice of sizes.
  • Nishan
    Nishan over 10 years
    Just one thing How Mount /tmp as tmpfs will affect system RAM. I have just 2GB RAM at all.
  • Nishan
    Nishan over 10 years
    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.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 10 years
    @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.
  • user
    user almost 7 years
    100 MB for /boot can be rather tight. Unless you are strapped for space, I suggest allocating a few hundred megabytes, maybe half a gigabyte, there. Since the question specifies that 50 GB, or 100 GB if necessary, is available for partitioning for the system, limiting /boot to 100 MB seems shortsighted.