These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/Filesystem Choices

Classnotes | UNIX02 | RecentChanges | Preferences

No diff available--this is the first major revision. (no other diffs)
Prior to installing your Linux system, you should plan out exactly what you need with respect to your filesystem. Here, there are two major classes of decisions to make: filesystem types and filesystem organization.

FS Organization

We saw in the first class that your Linux filesystem is organized into a very specific hiearchy (see UNIX01/Exploring The Root File System for a review). Each directory off from the root directory usually has a very specific purpose. Since storage media (such as hard disk drives) can be mounted at any point in the filesystem, obviously any one of these directories could be it's own hard drive partition.

In order to decide how to organize your filesystems physically on the hard disk, you really need to ask yourself what directories will require more space than others?

Obviously, on a system with many users, your /home directory will probably require a significant amount of space. On systems with a lot of userspace applications, your /usr directory will require a good deal of storage space. And, of course, for systems with large web-sites or mail-servers centered around the /var directory structure will require that /var give them room to grow. This may mean that generally you will have the following directories with associated hard drive partitions (hard drive partitions here are just examples):

 /          (/dev/hda2)
 /home      (/dev/hda3)
 /usr       (/dev/hdb1)
 /var       (/dev/hdb2)

A second question to ask is what directories need to be isolated from others? This isolation could be to prevent them from crowding other directories (for example, a run-away process sending endless errors to a syslog file in /var/log would be a good thing to isolate away from the user home directories), or it would be to prevent file-system corruption from knocking out significant segments of your data.

For example, you might wish to have a special "boot" partition, just consisting of your Linux kernel and possibly the boot loader. This special partition would provide a boot loader something to mount initially during boot up that would be free of corruption from other file systems. As another example, by keeping /home separate from /var, you can prevent certain types of DoS attacks which can be performed from compromised user accounts.

Finally, you will want to ask yourself how much space will these partitions need?

If you only have a handful of users, /home may not need to be very large. However, if you have tons of users, /home may need to be very big (or even split up in multiple homes, eg /home1, /home2, etc). /usr will likely store most of the applications on your Linux system (userspace applications comprise the bulk of a standard Linux install), so you will need to take that into account.

Of course, actually answering each of these questions is more of an art than a science. You will probably have to go through a period of "experimentation" as a system administrator before you find a system you prefer.

The one guideline that is even remotely scientific is deciding the size of the swap partition. Traditionally, it has been advised to set this to twice your system RAM. While this mostly holds true today, it must be taken with a grain of salt when your RAM is 512MB or more. Very large swap partitions will simply be seen by the kernel as more potential memory, and the kernel will simply expand its "operations" to better utilize that memory. Thus, very large swap partitions can actually slow down an otherwise fast and beefy Linux system.

There are tricks with priority settings and other esoteric options that can be done to deal with this. We will touch briefly on them on Day 5 of this course.

FS Type

Deciding filesystem type is an even headier issue. Traditionally under Linux you had ext2, vfat, and minix filesystems to choose from. Since ext2 was the Linux-centric FS, it was the one almost everyone used. However, ext2 had many shortcomings. Most notably, it was not a "journalling" filesystem, meaning that in the event of a system crash or power outage it was very easy to lose data. Journalling filesystems keep a record (the "journal") of modifications to files and directories, and by reading that "journal" can recover data which would otherwise have been lost through a crash or power outage.

Today there are several other FS types available for Linux. We will discuss them now.



Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited August 16, 2003 12:37 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.