Linux Partition Strategies

CityK

Storage Freak Apprentice
Joined
Sep 2, 2002
Messages
1,719
Hello. I'm looking for your thoughts on Linux partitioning.

I read an article a year or two ago in which the authour outlined the following partitioning strategy:

/boot
/
/home
/var
swap
/usr
/usr/local
/data

His reasoning (which seemed logical enough at the time) was as follows (much of which will be verbatim):

Security:
- sets /boot aside as a read only i.e. a barrier to any monkey business.
- Isolating the /boot files from the root partition also eliminates the potential of grevious errors such as overwriting the kernel

Isolation:

- keeping directories like /home and /var out of the root partition can prevent downloads and logs, traces etc from fragmenting or filing up the root partition (which can lead to evil kernel panics etc).
- your /usr directory is where all your applications reside, and it gets lots of activity during installation, and as you add and upgrade packages.
- your home directory sees lots of activity from applications, so you may want to keep your personal files elsewhere out of the way.
- a separate partition for the /usr/local directory as this is where most additional 3rd party software (i.e. Java, Acrobat....) gets installed. Having these 3rd party softwares on a separate partition makes it easier to keep it intact across Linux re-installations, when one changes from one Linux distro to another or installs a new release. i.e. installing a new distro doesn't require reinstalling all software.

Convenience:
-Having a separate /home and /data partition (to keep all your own personal work files like documents, spreadsheets, images, MP3s, etc in if you don't want to keep in the /home/name directory) is convenient.
- /home directory contains your desktop configuration and mail files, so you can keep those more easily across system upgrades if they are in a separate partition.
- your /home and /data working directories are easy to replicate or backup if you have them on separate partitions.

His idea for layout on a single disk would be

/boot, /, swap, /home, /var, /usr, /usr/local, /data ......... memory constrained system
/boot, /, /home, /var, /usr,/usr/local, swap, /data ......... no memory constraints

Now here's what the Suse 10 Getting Started Doc has to say:

4 GB or More:
A swap partition, a root partition (1 GB), and one partition each for the following
directories as needed: /usr (4 GB or more), /opt (4 GB or more), and /var
(1 GB). If you do not want to have separate partitions for these directories, add the
suggested disk space to the root partition. The rest of the available space can be
used for /home.

Depending on the hardware, it might also be useful to create a boot partition (/boot)
to hold the boot mechanism and the Linux kernel. This partition should be located at
the start of the disk and should be at least 8 MB or one cylinder. As a rule of thumb,
always create such a partition if it was included in YaST's original proposal. If you are
unsure about this, create a boot partition to be on the safe side.

You should also be aware that some (mostly commercial) programs install their data
in /opt. Therefore, either create a separate partition for /opt or make the root partition
large enough. KDE and GNOME are also installed in /opt.

So, given the above data, one would think that the strategy in a single disk, non memory constrained system could be:

/boot (50MB), / (1GB), /home (5GB), /var (1GB), /usr (5GB) ,/opt (5GB), swap (512MB), /data (The world `s your oyster)


Partition Layout/Order - accross two disks, non-memory constrained system:

/boot (50MB) , / (1GB) ........ ???
swap (512MB), ....... ??? ....... essentially I'm not sure about what to in this case.

Anyways, again, looking for your input on what you think is reasonable in regards to all that discussed above (capacities, strategies, placements etc etc etc.)
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
I used to agonize over this sort of thing, especially as I was starting with OpenBSD, which really emphasizes getting security right.

Then I got some larger hard disks greater than 2 gigabytes in size, and it turned out to be hard to go wrong. Really. I wouldn't worry about this too much.

Here's the output from "df" (a useful command to know) that shows you the results of my primary system, after a year and a half of use, with plenty of software installed:

Code:
myself@oops:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3             4.6G   92M   4.3G    3%  /
/dev/hda1              45M  3.3M   39M   8%  /boot
/dev/hda8              64G   42G   20G   69%  /home
/dev/hda5             4.6G  176K   4.4G    1% /tmp
/dev/hda6              19G  2.2G    16G   13% /usr
/dev/hda7              19G  2.4G    16G   14% /var
tmpfs                 253M     0    253M     0% /dev/shm
myself@oops:~$

...not that there's anything special about this configuration.

For the record, with Fedora Core 4 (and possibly earlier), Logical Volume Management (LVM) is included by default. From the link:

Logical volume management provides a higher-level view of the disk storage on a computer system than the traditional view of disks and partitions. This gives the system administrator much more flexibility in allocating storage to applications and users.

Storage volumes created under the control of the logical volume manager can be resized and moved around almost at will, although this may need some upgrading of file system tools.

The logical volume manager also allows management of storage volumes in user-defined groups, allowing the system administrator to deal with sensibly named volume groups such as "development" and "sales" rather than physical disk names such as "sda" and "sdb".

The subsections...

2.1. Why would I want it?
2.2. Benefits of Logical Volume Management on a Small System
2.3. Benefits of Logical Volume Management on a Large System

...are very descriptive. Take a read through them if you have the chance. Here's the first paragraph from section 2.2 for example...

One of the difficult decisions facing a new user installing Linux for the first time is how to partition the disk drive. The need to estimate just how much space is likely to be needed for system files and user files makes the installation more complex than is necessary and some users simply opt to put all their data into one large partition in an attempt to avoid the issue.

If I were you:

1. DO try and split things up a bit across multiple partitions - at the absolute bare minimum, keep /home on its own partition.
2. DON'T agonize over the space issue too much, especially if you've got a decent size hard disk.

Just pick some reasonable values for your current setup attempt and don't worry about it too much. Then perhaps in a few months or a year or something, once you're familiar with the standard way of setting up partitions, consider trying LVM.
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,599
Location
I am omnipresent
Not that i didn't cover it already, but the only things I split off are /home and /var from the main install. I also generally make a large volume called /pub which is where I put my generic shared files.
 

Mercutio

Fatwah on Western Digital
Joined
Jan 17, 2002
Messages
21,599
Location
I am omnipresent
Not that i didn't cover it already, but the only things I split off are /home and /var from the main install. I also generally make a large volume called /pub which is where I put my generic shared files.
 

CityK

Storage Freak Apprentice
Joined
Sep 2, 2002
Messages
1,719
Mercutio said:
Not that i didn't cover it already
Yep, I know *, but one of the things I was specifically wondering about is the ideas put forth by that authour - For example - are they ridiculous; do they hold water; waste of time; too many partitions; why bother; etc etc.

As I'm unsure of his reasoning, then without discussion/investigation, I stand to benefit little from following anyone elses receipe (even if it is well intended).


* I'm also keenly aware of the repetition in regards to accessing NTFS partitions, but as I said, in respects to that particular case, it was purely a test conducted in a controlled envirnment. Perhaps I was misunderstood...and, indeed, time's comments taken on the whole certainly seems to suggest I was
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
*sigh*

Excerpts from one tiny section of the OpenBSD 3.8 Installation FAQ:

There are several reasons for using separate filesystems, instead of shoving everything into one or two filesystems:

* Security: You can mark some filesystems as 'nosuid', 'nodev', 'noexec', 'readonly', etc. This is done by the install process, if you use the above described partitions.
* Stability: A user, or a misbehaved program, can fill a filesystem with garbage if they have write permissions for it. Your critical programs, which of course run on a different filesystem, do not get interrupted.
* Speed: A filesystem which gets written to frequently may get somewhat fragmented. (Luckily, the ffs filesystem that OpenBSD uses is not prone to heavy fragmentation.)
* Integrity: If one filesystem is corrupted for some reason then your other filesystems are still OK.

...

Some additional thoughts on partitioning:

* For your first attempt at an experimentation system, one big / partition and swap may be easiest until you know how much space you need. By doing this you will be sacrificing some of the default security features of OpenBSD that require separate filesystems for /, /tmp, /var, /usr and /home. However, you probably should not be going into production with your first OpenBSD install.
* A system exposed to the Internet or other hostile forces should have a separate /var (and maybe even a separate /var/log) for logging.
* A /home partition can be nice. New version of the OS? Wipe and reload everything else, leave your /home partition untouched. Remember to save a copy of your configuration files, though!
* A separate partition for anything which may accumulate a large quantity of files that may need to be deleted can be faster to reformat and recreate than to delete. See the building by source FAQ for an example (/usr/obj).
* If you wish to rebuild your system from source for any reason, the source will be in /usr/src. If you don't make a separate partition for /usr/src, make sure /usr has sufficient space.
* A commonly forgotten fact: you do not have to allocate all space on a drive when you set the system up! Since you will now find it a challenge to buy a new drive smaller than 20G, it can make sense to leave a chunk of your drive unallocated. If you outgrow a partition, you can allocate a new partition from your unused space, duplicate your existing partition to the new partition, change /etc/fstab to point to the new partition, remount, you now have more space.
* If you make your partitions too close to the minimum size required, you will probably regret it later, when it is time to upgrade your system.
* If you make very large partitions, keep in mind that performing filesystem checks using fsck(8) requires about 1M of RAM per gigabyte of filesystem size, and may be very time-consuming or not even feasible on older, slower systems (please also refer to this section).
* If you permit users to write to /var/www (i.e., personal web pages), you might wish to put it on a separate partition, so you can use quotas to restrict the space they use, and if they fill the partition, no other parts of your system will be impacted.

Now, all of that refers to OpenBSD, but you're a bright guy, CityK. I'm sure you can apply the parts you find relevant to your Linux system.
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
CityK said:
For example - are they ridiculous; do they hold water; waste of time; too many partitions; why bother; etc etc.

As I'm unsure of his reasoning, then without discussion/investigation, I stand to benefit little from following anyone elses receipe (even if it is well intended).

To summarize:

1. No, his suggestions are not ridiculous.
2. Yes, they do hold water, but only to the extent that you find the situations he and others outline could be applicable to your situation. You don't need to go "whole hog" and split everything. Or perhaps you do. You have to make the decision based on what you know your needs are.
3. There might be too many partitions, or there might not be. Again, it depends on what you're looking for from this setup.
4. You should bother because it's an opportunity to mull over some good ideas.

5. My recipe is perfect. :)

Perfect for me, that is. I started with OpenBSD years ago, and I've followed a roughly similar recipe as was outlined in those docs ever since, because they made reasonable sense to me for my situation.
 
Top