JP Vossen on 5 Jan 2011 15:02:58 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux n00b question


Date: Wed, 5 Jan 2011 10:06:13 -0500
From: jeff<jeffv@op.net>

On 01/05/2011 08:56 AM, Steve Slaughter wrote:
What, in your opinion, is the best way to partition this drive?

I use a small swap partition, / partition, and a very large /home.

Maybe we ought to take a step back and talk about *why* you partition in various ways.

Way back when, disks were small and very expensive, and for a variety of reasons it made sense to dole them out in certain ways. The Unix file system layout is both a relic and a perpetuator of this. And that isn't a bad thing, there were good reasons for all of it, and it still more-or-less works today (40-odd years later). See http://www.pathname.com/fhs/ if you want all the gory details.

On the other hand, disk is now cheap, system roles and environments have changed drastically, and so it's OK to apportion disks differently.


There are two really critical points you need to know, the rest of it is religious. Note that the "root" file system, denoted by '/' is not the same as the root user's home directory, which is usually '/root/' which is a sub-dir of root '/'. (Yeah, the word 'root' is really over-loaded and over-used.)

1) If you fill up the root partition (/) the system will become very annoyed with you and probably crash.

1.1) If /var is on root, a runaway logging process can fill up the disk, even really big ones, pretty easily (see /var/log/). 1.2) If /home is on root, a runaway user can fill up the disk, even really big ones, pretty easily.

2) If /home is on root, and you do a "clean" install, you will nuke all of your data! If /home/ is a separate partition, you can omit that at install time and not nuke your data. (It is *really* easy to screw that up or miss a step and nuke the data anyway, but you can do it right it you are careful. BACKUP!)


So, what does that mean for us?

CAVEAT: This is for new-ish users on home or non-production systems. If you are running Linux servers in production you need to consider your environment very carefully and plan accordingly. Get a consultant (from this list) if you need to.

For #1, if you are monitoring your system like you should [1], you probably won't run out of space unexpectedly.

For #2, if you are running Debian, Ubuntu or Gentoo, you don't do "clean" reinstalls anyway, you do upgrades or emerges. So unless you like to mess around with your system (and that's what virtualization is for), you won't reinstall much or at all. If you are running an RPM-based distro, this is more important. In that case, a separate /home/ makes more sense.


The main danger to breaking things up into little partitions is that if you guess wrong on space, you can fill up, say /var/ and still have lots of space left in / or /home/. Filling up /var/ in that case won't crash the system, but it's still annoying.

A possible mitigating factor here is LVM (and later btrfs) (Google LVM2) but that requires a little extra effort to set up up-front, and it's tedious to have to move sizes around later one. (Tedious is still better than impossible though.) In other words, LVM lets you change partitions sizes on the fly, subject to actual file-system limitations. It also allows file-system snapshots, which are handy for backups. But now we're starting to go out-of-scope.


Finally, after saying all of that, I personally almost never bother with anything other than a small swap partition and everything else in /. I monitor my systems so they don't run out of space, and I run Debian or Ubuntu on RAID1 (see recent RAID threads) so I don't do clean installs even when swapping hard drives or machines.


Other old-timers please chime in if I messed up any details.  ;-)

Hope this is useful,
JP
___________________
[1] Monitoring:
fcheck - IDS filesystem baseline integrity checker
monit - A utility for monitoring and managing daemons or similar programs
http://www.jpsdomain.org/public/2010_Cool_Ubuntu_Apps.pdf
http://www.jpsdomain.org/public/2010_Cool_Ubuntu_Apps.odp
----------------------------|:::======|-------------------------------
JP Vossen, CISSP            |:::======|      http://bashcookbook.com/
My Account, My Opinions     |=========|      http://www.jpsdomain.org/
----------------------------|=========|-------------------------------
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug