Tips for Placing Partitions for Best Performance

The physical layout of sectors on a hard disk and the characteristics of data transfer speeds from inner and outer cylinders lead to potentially conflicting rules for optimizing disk performance. These factors also interact with your specific needs; for instance, you might want to favor one type of data over another one for optimal performance. Some of the rules of thumb you can use to improve performance include:

Put often-used data near the center of the disk. On average, the time to seek to the middle of a disk is the lowest of any seek time. Therefore, you should put frequently accessed files near the center of the disk. Such partitions are likely to include your Linux root (/) partition and, if you separate any of them, your/var, /tmp, /usr, and /home partitions. Partitions you can move aside include any partitions you use for archival storage, infrequently used binaries, /boot, and non-Linux OSs.

Put the swap partition near the center of the disk. In many cases, the swap partition is a very heavily used partition. Therefore, as a corollary to the preceding rule, swap should sit as close to the center of the disk as possible.

Put data for which high throughput is important at the start of the disk. Large data files that you read or write in large blocks can benefit from the superior performance of the outer cylinders (early-numbered sectors) of the disk. For instance, if you maintain large database files, you're likely to see a performance boost if you put them early on the disk. Partitions with lots of small files, such as web pages served by a web server, benefit less from this advantage and, therefore, can go later on the disk.

Keep related partitions near each other. If a pattern of disk activity is likely to keep the disk head moving between two partitions with few accesses to other partitions, those two partitions should be placed next to each other. The biggest consequence of this rule of thumb is that partitions belonging to one OS should be kept in sequence on the disk. An exception might be a seldom-accessed partition, which could be split off from the rest if some other factor intervenes.

Address special requirements for the boot partition. The IA-32 BIOS has historically imposed limits on where boot files (namely, the Linux kernel and any boot loaders you use) reside. This issue isn't nearly as much of a problem today as it once was, but if you have a computer that's more than a few years old, you might need to create a separate /boot partition to hold the kernel and place it in the first 1,024 cylinders (about 8GB) of the disk.

Split OSs across multiple disks. "Two heads are better than one," the saying goes, and in the case of hard disks, using two can improve performance by reducing the number of head seeks. For instance, if your /home partition is on one disk while /usr is on another disk, head seeks required to access files in /home won't budge the head resting in /usr, which can speed the next access to files in /usr.

As noted in the lead-in to this list, these rules sometimes conflict. For instance, you might want a partition to reside early on the disk to improve throughput, but you also might want it near the center to minimize seek times. Deciding how to resolve these conflicts is usually a matter of guesswork; without running experiments, it's not easy to know which configuration will work best. You may want to compromise; for instance, you could put the partition on which you want fast access near the center of the disk, but put it at the beginning of a group of such partitions.

Team LIB

0 0

Post a comment