Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A few years ago I installed Debian which is my favorite OS.
There are many things in Linux I don't understand.

For instance:

Why should I make separate partitions for /tmp, /var and so on?

I can see more drawbacks than benefits. One benefit is that I can use ext4 with journaling for /home and ext4 without journaling for other partitions.

Main drawback is size limit. When I was partitioning my disk I was taught to allocate ~1GB for /tmp. And now I have trouble because it's not enough! Copying DVDs needs more free space. Even caching YouTube's concerts needs more than 1GB of free space.

What are the benefits of having a separate partition for /tmp?

share|improve this question
1  
if you have separate partitions for home, var, tmp, ... then you don't need too much space for /. Good thing if someday you need to restore system/settings from backup image. There is countless reasons why it is good to keep different parts of system on differens partitions. –  Sampo Sarrala Jun 27 '12 at 23:57
2  
Nowadays Debian uses tmpfs for /tmp, it can autoresize to accommodate files and can move stuff to the swap if needed. –  solarc Jun 28 '12 at 0:54

2 Answers 2

One common reason for making it a separate partition is to be able to mount it as nosuid and noexec. This prevents both privilege-escalation and arbitrary script execution from /tmp, respectively. This is particularly useful in multi-user environments (e.g. hosting) where unprivileged users will have access to read/write data to /tmp but should not be able to perform either of these actions.

Another justification would be to limit the amount of temporary data stored (since not everything cleans up after itself) to prevent other more important partitions from filling and causing service interruption and/or data loss.

share|improve this answer
    
But still estimating size of /tmp is difficult. 2 years ago I assumed 1GB is enough and now I can see I need more space for /tmp. It's difficult to judge what is more important safety reasons or inability to work with programs that need more than fixed /tmp size... –  patryk.beza Jun 28 '12 at 21:11
1  
Use LVMs and leave some free space in your volume group. Allocate it to individual logical volumes (e.g. /tmp) as needed. LVM supports online resizing as do ext3/4. –  Garrett Jun 28 '12 at 21:34

It also makes sense from the security standpoint. Since many programs write temporaries in /tmp and /tmp is automatically cleared (using insecure file deletion), this means a lot of deleted but recoverable files still reside on the /tmp partition. If you isolate this partition and make it smaller, then it's easier to securely clean it, e.g. using sfill from the secure-delete package.

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.