Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [105]

By Root 1425 0
chapter includes information about each of these filesystems, but a complete primer on the different filesystems is well beyond the scope of this book. I have provided enough information here so that you can make an informed decision about which filesystem to choose, how to patch your kernel, and how to build the filesystem. I strongly recommend reading more about each of the filesystems at their respective web sites (for which I've provided references).

Each of the filesystems that I cover in this chapter, including ext2, can be fine-tuned using filesystem parameters and mount options. In this chapter, I will explain how to make some adjustments that will improve overall system performance.

Basic Filesystem Concepts

This section provides some basic information about filesystems. While this overview is far from complete, it should help you decide which filesystem will best meet your needs.

If you're interested in learning more about filesystems, I recommend Moshe Bar's book Linux Filesystems (McGraw-Hill). William Von Hagen's book of the same name (Sams) also comes highly recommended, although I haven't had time to purchase and read a copy. There is an abundance of online resources about filesystems, both for Linux and for other operating systems. Without question, the site that stands out Daniel Robbins's Advanced Filesystem Implementor's Guide, available from the IBM DeveloperWorks web site at http://www.ibm.com/developerworks/library/l-fs.html. I've also pointed out online material that is specific to each filesystem throughout the rest of this chapter.

Blocks and Inodes

All Unix filesystems use two basic components to organize and store data: blocks and inodes. Just as a physical disk is organized into sectors, data on a filesystem is abstracted into blocks. Blocks have a fixed size, determined at the time the filesystem is created. The block size of a filesystem determines how many bytes are allocated to each block on the filesystem. Generally, block sizes are 1 KB, 2 KB, or 4 KB for 32-bit systems. A block size of 8 KB is also available on 64-bit systems.

Inodes are used to map blocks to physical disk locations on Unix filesystems. Every file created, whether it's a directory, normal file, or special file, is assigned an inode. Inodes work in much the same way as pointers do in programming languages such as C, Perl, and Java. Inodes also store information about a file, including its type, size, and parent directory. On traditional Unix filesystems, inodes are typically allocated when the filesystem is created. ext2, for example, allocates one inode for every 8 KB worth of data blocks when a new filesystem is initialized, although this value can be manually altered. That means an ext2 filesystem with a block size of 4 KB allocates a single inode for every two data blocks.

When a filesystem runs out of inodes, no new files can be created until existing files are deleted, thereby freeing up inodes that are already in use. For this reason, many new filesystems implement dynamic inode allocation, freeing system administrators from worrying about such limitations.

Space efficiency versus performance

Most filesystems use a default block size of 4 KB, but that size might not be efficient for all situations. Let's say that you have a partition that contains many files that are smaller than 4096 bytes. When those files are created, the remaining space in each block is wasted. So on a filesystem that contains many files that are smaller than the block size, you end up with a lot of wasted disk space. Tailoring the block size to meet the needs of your data helps you use disk space efficiently. A block size of 1024 or 2048 bytes on partitions that are expected to utilize many small files will help maximize disk usage, though files smaller than the block size will still waste disk space on some filesystems.

There is a trade-off when using smaller block sizes. Bigger block sizes mean that fewer I/O operations are required when reading larger files. For example, on a filesystem with a block size of 4096 bytes, only

Return Main Page Previous Page Next Page

®Online Book Reader