Posted: 24 Aug 2005
Applies To:
- SUSE LINUX Enterprise Server
- Open Enterprise Server
Purpose
Prior to installing the OS on a new Linux server, take time to consider the
hard drive and partition configurations of this server. Choices made during the
initial installation can lead to drastic performance boosts (or
degradations).
Specifically, consider:
- The number, size, type, and configuration of the hard drives.
- The partition layout on these drives.
- The filesystems used for these partitions.
Hard Drives
Most high-performing servers contain more than one hard drive. A hard drive
can only perform a single read or write operation at a time--multiple drives
boosts performance by making multiple read/write operations possible. To
maximize performance, consider the following:
- Place the most frequently used partitions on separate drives, if possible.
- Use the fastest drives for the most actively used partitions.
- If using IDE, spread the drives across the available channels. Make them
the master of their channel, if possible.
It is important to realize which partitions require the best performance.
This order varies for every server, based on its usage patterns. A good general
example is (in order of decreasing performance):
- swap - If the server needs to use swap space, it should be as fast a
possible.
- /var - Servers frequently write to log files (located in /var).
- /srv - A http or ftp server needs quick access to its sources.
- /usr - Most application binaries are stored in /usr.
- /tmp - As services run, they may store and access data here.
A note on RAID: Performance can also be
boosted by placing drives in a RAID array (Redundant Array of Inexpensive
Disks). RAID allows partitions to span physical hard drives, thereby allowing a
single read/write operation to span disks.
Partition Layout
Due to the physical layout of a hard drive, the order in which partitions are
created can also effect performance. Hard drives are made up of many circular
disks divided into sectors and tracks. The outermost track of these disks tend
to deliver the best performance because there are more sectors per track. Thus,
it is best to place the partitions which require the highest performance on the
outermost tracks of the drive. Usually, this is accomplished be creating the
partitions at the beginning of the drive
(i.e. cylinder 0).
Filesystems
One of the strengths of Linux is the variety of available file systems.
Different file systems boost certain areas of performance. It is important to
consider the anticipated uses of a server, and choose the most appropriate file
system:
Filesystem
|
Description
|
Journaling
|
ext2
|
Very quick and simple filesystem. In the
past, it was the default for most distributions. The major drawback: it's
prone to corruption if it is not unmounted properly (i.e. power failure,
unclean reboot, etc) and requires a time-consuming file system
check.
|
no
|
ext3
|
The next generation of the ext2 file
system. Conversions between ext2 and ext3 are very simple. Basically, it's
ext2 + Journaling support for better crash recovery. It is the default
file system on some distributions.
|
yes
|
reiserfs
|
Reiserfs was the first Journaling file
system available for Linux. It provides a good performance to CPU usage
ratio, and offers good disk space utilization, good disk access
performance, and fast crash recovery. It is great for systems that need to
create many small files. It is the default file system in SUSE
Linux.
|
yes
|
JFS
|
Developed by IBM, JFS is targeted for
high-throughput environments. It is a full 64-bit filesystem, and has
great large file support.
|
yes
|
XFS
|
XFS was developed by SGI. Like JFS it is
64-bit and performs well on large files in high-throughput environments.
It uses more CPU time that JFS, but tends to perform better.
|
yes
|
Example
Note: The example given here is just one way
this server could be set-up. Depending on intended use, other configurations
could be better.
As an example, consider a simple web/ftp server. This server has the
following available hardware:
- 2 IDE channels
- 1 SATA controller
- 5000 RPM IDE drive, 10 GB
- 7200 RPM IDE drive, 20 GB
- 7200 RPM SATA drive, 10 GB
- CD-ROM drive
- 512 MB memory
Notice that there are three hard drives available, with varying speed. To
begin with, configure the drives onto their proper I/O channels: IDE |--> IDE0 | |--> (master) 7200 RPM IDE drive, 20 GB | --> (slave) none --> IDE1 |--> (master) 5000 RPM IDE drive, 10 GB --> (slave) CD-ROM drive
SATA --> 7200 RPM SATA drive, 10 GB
Notice that the fastest of the IDE drives has its own channel so it can be
accessed as freely as possible. Also notice that the other drive shares its
channel with the CD-ROM, but is the master. With this configuration, the drives
perform best in the following order:
- 7200 RPM SATA drive, 10 GB
- 7200 RPM IDE drive, 20 GB
- 5000 RPM IDE drive, 10 GB
Now, consider which partitions should go on which drives. The most important
mount point for speed are swap and /var . These should
be created on separate drives, at the beginning of the drive.
swap should be twice the RAM size (1 GB).
swap would optimally be placed on its own drive, with no other
partitions. Given the intended purpose of the server, and its 512 MB of
memory, assume that the server will rarely use swap space and place some other
partitions on this drive to better utilize space.
/var should be about 1 GB.
/usr should be about 4 GB, and should be on a fast drive.
/srv needs to have good speed and space for the FTP files.
/tmp should have good speed.
/ has everything else. All the high-performing mount points
have been pulled out so it can go on the slowest drive.
Given these requirements and the available drives, an example configuration
could be: IDE |--> IDE0 | |--> (master) 7200 RPM IDE drive, 20 GB | | |--> /var, 1 GB reiserfs | | --> /srv, 19 GB reiserfs | --> (slave) none --> IDE1 |--> (master) 5000 RPM IDE drive, 10 GB | --> /, 10 GB reiserfs --> (slave) CD-ROM drive
SATA --> 7200 RPM SATA drive, 10 GB |--> swap, 1 GB swap |--> /usr, 4 GB reiserfs --> /tmp, 5 GB reiserfs
Or, in another view: / (5000 RPM IDE drive, 10 GB reiserfs) |--> /bin "" |--> /boot "" |--> /etc "" |--> /home "" |--> /lib "" |--> /opt "" |--> /root "" |--> /sbin "" |--> /srv (7200 RPM IDE drive, 19 GB reiserfs) |--> /tmp (7200 RPM SATA drive, 5 GB reiserfs) |--> /usr (7200 RPM SATA drive, 4 GB reiserfs) |--> /var (7200 RPM IDE drive, 1 GB reiserfs) --> swap (7200 RPM SATA drive, 1 GB swap)
All these partitions would probably be fine to use reiserfs. The exception
may be /srv . If the server is serving large files (such is iso's,
etc) it may benefit from JFS or XFS but this is probably an overkill on such a
small server.
|