A few words about custom partitions and /var

Aug 30th, 2012 | By | Category: Linux / Freebsd

So I just installed Debian onto my new laptop, this time through vmware with a windows 7 host because I for once have enough ram and cpu to handle virtualization, and this time I felt I was ready to custom configure a more complex partition schema based on my experience.  Not the recommended BS that Debian gives me but something a little more useful.

Right now it looks like this:

 

sda1 = / (5GB)

sda5 = /usr (15GB)

sda6 = /home (35GB)

sda8 = /tmp (2GB)

sda9 = /var (1.4GB)

sda10 = /var/log (3GB)

 

So one thing out of the ordinary you should see here is that /var/log is it’s own partition.  this is one of those things tha tI just don’t know why Debian doesn’t do by default.  In all my years managing webservers and running linux at home one of the most common instances of the fit hitting the shan is when a log file runs amok and fills up the drive.  If it’s all one drive well then you’re hooped in so many ways, but if you have your own partition for /var/log then it’ll just run into loggin errors and your entire system won’t go down the toilet.  So that’s teh first point of this post.  A word from the wise

always make /var/log its own partition!

The next is the size of /var.  I mistakenly went to my old machine, saw that /var was using a total of 300MB, no t including the logs and so I figured, 1.4GB should be more than enough right.. errr, not so much as I got a message today that I had 30MB free.  Now this isn’t a super critical issue as the reason that /var is going to ever use a lot of space is at the very beginning when you are installing everything for the first time.  You see apt-get stores its cache in /var and so if you are installing everything from scratch after you installed debian from a netinst .iso then you’re going to have a ton of stuff in /var/cache.   Now i can’t foresee ever running into this problem again as I won’t be installing 2GB worth of stuff through apt-get in one go ever again but it’s possible it could happen.  So what I did in this case was to move /var/cache to /usr/cache as there is more than enough spare room there by editing /etc/apt/apt.conf and adding the following line:  dir::cache::archives /usr/cache .  I also promptly cleaned out the cache with apt-get clean and brought my /var/cache dir size down to 100MB.  So not sure if this is important to you but if it is you should probably have /var at around 2-3GB instead of 1.5GB like I did.

 

Hope this is useful, it definitely pays to setup your own manual partitioning structure as the extra control can really prevent some nasty system problems down the road.

Tags: , , , ,

Leave a Comment