ReiserFS

team bbl


The ReiserFS open source journaling file system is available in most Linux distributions and supports metadata journaling. ReiserFS was merged into the 2.4.1 release of the kernel.org source tree. ReiserFS provides the following unique features that help differentiate it from the other journaling file systems:

  • Stores all file system objects in a single b* balanced tree. The tree supports the following:

    • Compact, indexed directories

    • Dynamic inode allocation

    • Resizable items

    • 60-bit offsets

    The tree contains the following four basic components: stat data, directory components, direct components, and indirect components. You can find components by searching for a key (where the key has an ID), the offset in the object that is being searched, and the item type.

    Directories can increase and decrease as their contents change. A hash of the filename is used to keep an entry's offset in the directory permanent.

    For files, indirect components point to data blocks, and direct components contain packed file data.

    All the components can be resized by rebalancing the tree.

  • Supports small fileslots and lots of small files. The Reiser philosophy is simple: Small files encourage coding simplicity. Rather than use a database or create a filecaching scheme, use the file system to handle lots of small pieces of information. ReiserFS can be about eight times faster than Ext2 at handling files smaller than 1K.

  • Stores about 6% more data than Ext2 on the same physical file system (when properly configured). Rather than allocate space in fixed 4K blocks, ReiserFS can allocate the exact space that's needed. A b* tree manages all file system metadata and stores and compresses tails, portions of files smaller than a block.

Tail packaging does cause a slight performance penalty when it forces ReiserFS to rearrange the data as files are reduced or grow in size. This is one reason that this feature can be tuned by turning off the notail mount option.

Kernel Configuration Support for ReiserFS

You can select ReiserFS options from the File Systems section of the configuration menu and enable the following option:

 Reiserfs support (CONFIG_REISERFS_FS=y,m,n) 

Click y next to the Reiserfs entry if you want to build ReiserFS into the kernel. Click m next to the Reiserfs entry if you want to build ReiserFS as a module.

Other options are available in the ReiserFS selection for ReiserFS configuration. If you need any of these options, select them here.

Working with ReiserFS

There are three ways to tune a ReiserFS file system:

  1. When the file system is created, which is the most efficient way

  2. Through the tuning utility reiserfstune, which can be used to tune the file system after the file system has been created

  3. Through options that can be used when the file system is mounted

All three of these tuning options are discussed in the following sections.

Creating a ReiserFS File System

ReiserFS uses the mkreiserfs utility to create a ReiserFS file system. The performance tuning options are as follows:

 -h | --hash HASH 

HASH specifies the name of the hash function that filenames in directories will be sorted with. (See the mount option section of the ReiserFS man page for a more complete description of each hash option.)

Choose one of the following:

  • r5 (default)

  • rupasov

  • tea

See the subsection on the mount options for a description of these alternatives.

 -j | --journal-device FILE 

FILE specifies the name of the block device where the file system places the journal.

 -o | journal-offset N 

N specifies the offset where the journal starts when the journal is on a separate block device. The default is 0.

 -s | journal-size N 

N specifies the journal in blocks. When it is on a separate block device, the default size is the number of blocks on that device. When the journal is not on a separate block device, the default is 8193 and the maximum is 32749. The minimum is 513 blocks for both cases.

 -t | --transaction-max-size N   

N is the maximum transaction size for the journal. The default and maximum is 1024 blocks.

For a complete description of the mkreiserfs options, see the mkreiserfs man page.

To create the ReiserFS file system with the log inside the ReiserFS partition, issue the following command:

 # mkreiserfs /dev/sdb1 

After the file system has been created, mount it using the mount command. Determine the mount point and create a new, empty directory, such as /reiserfs, to mount the file system. The following example mounts the new file system:

 # mount -t reiserfs /dev/sdb1 /reiserfs 

To unmount the ReiserFS file system, use the umount command with the same mount point as the argument:

 # umount /reiserfs 

Increasing Speed with an External Log

An external log improves performance because the log updates are saved to a different partition than the log for the corresponding file system. This reduces the number of hard disk seeks.

To create the ReiserFS file system with the log on an external device, your system needs to have two unused partitions. In the following example, /dev/hda1 and /dev/hdb1 are spare partitions. The /dev/hda1 partition is used for the external log.

 # mkreiserfs  -j /dev/hda1 /dev/hdb1 

Mounting the File System

To mount the file system, use the following mount command:

 # mount -t reiserfs /dev/hdb1 /reiserfs 

To avoid having to mount the file system every time the system boots, add the file system to the /etc/fstab file. Make a backup of /etc/fstab and edit it with your favorite editor to add the /dev/hdb1 device. For example:

 /dev/hdb1 /reiserfs reiserfs defaults 1 2 

Mount Options

Three mount options can change the performance of the ReiserFS file system:

  1. The hash option lets you select which hash algorithm will be used to locate and write files within directories:

     hash=rupasov|tea|r5|detect  

    This specifies the hashing algorithm used to locate and write files within directories. The different hashing algorithms provided by the file system are rupasov, tea, r5, and detect.

    • The rupasov hashing algorithm is a fast hashing method that places and pre serves locality, mapping lexicographically close filenames to the close hash values.

    • The tea hashing algorithm is a Davis-Meyer function that creates keys by thor oughly permuting bits in the name. It gets high randomness and, therefore, low probability of hash collision, but this entails performance costs. This hashing is a good selection for large directories causing EHASHCOLLISION with r5 hash. For example:

       mount -t reiserfs -o hash=tea /dev/sdb2 /mnt/reiserfs 

    • The r5 hashing algorithm is a modified version of the rupasov hash with a reduced probability of hashing collisions. This is the default hashing algorithm.

    • The detect option instructs mount to detect the hash function in use by the instance of the file system being mounted. It writes this information into the super block. This option is useful only on the first mount of an old file system.

  2. The nolog option disables journaling. It also provides a slight performance improvement in some situations at the cost of forcing fsck if the file system is not cleanly shut down. This is a good option to use when restoring a file system from backup. For example:

     mount -t reiserfs -o nolog /dev/sdb2 /mnt/reiserfs 

  3. The notail option disables the packing of files into the tree. By default, ReiserFS stores small files and "file tails" directly into the tree. For example:

     mount -t reiserfs -o notail /dev/sdb2 /mnt/reiserfs 

    It is possible to combine mount options by separating them with a comma. The following example uses two mount options (noatime, notail) that increase file system performance:

     # mount -t reiserfs -o noatime,notail /dev/sdc1 /fs1 

    Linux records an atime, or access time, whenever a file is read. However, this information is not very useful and can be costly to track. To get a quick performance boost, simply disable access time updates with the mount option noatime.

Tuning ReiserFS

reiserfstune tunes the ReiserFS file system. reiserfstune changes the journal size and maximum transaction size. The journal's location can also be changed:

 -j | --journal-device FILE 

FILE specifies the name of the block device where the file system places the journal.

 -o | journal-offset N 

N specifies the offset where the journal starts when it is on a separate block device. The default is 0.

 --no-journal-available  

This allows the file system to continue when the current journal's block device is no longer available by having a disk that has gone bad.

 --journal-new-device FILE 

FILE is the name of the block device that will contain the new journal for the file system.

 -s | journal-size N 

N specifies the journal in blocks. When the journal is on a separate block device, the default size is the number of blocks on that device. When the journal is not on a separate block device, the default is 8193 and the maximum is 32749. The minimum is 513 blocks for both cases.

 -t | --transaction-max-size N   

N is the journal's maximum transaction size. The default and maximum is 1024 blocks.

See the reiserfstune man page for information about all the options for this utility.

ReiserFS Utilities

The following ReiserFS utilities are located in the reiserfsprogs package:

  • mkreiserfs. Creates a ReiserFS file system.

  • reiserfsck. Checks a ReiserFS file system.

  • resize_reiserfs. Resizes a ReiserFS file system.

  • debugreiserfs. Debugs a ReiserFS file system.

For more information, see the man page for each of the ReiserFS utilities.

    team bbl



    Performance Tuning for Linux Servers
    Performance Tuning for Linux Servers
    ISBN: 0137136285
    EAN: 2147483647
    Year: 2006
    Pages: 254

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net