Journaled File System (JFS)

team bbl


Journaled File System (JFS) for Linux is based on the IBM JFS file system for OS/2 Warp. JFS was donated to open source in early 2000 and was ported to Linux soon after. JFS is well suited to enterprise environments. It uses many advanced techniques to boost performance, provide for very large file systems, and journal changes to the file system. Some of the features of JFS include the following:

  • Extent-based addressing structures. JFS uses extent-based addressing structures, along with aggressive block-allocation policies to produce compact, efficient, and scalable structures for mapping logical offsets within files to physical addresses on disk. This feature yields excellent performance.

  • Dynamic inode allocation. JFS dynamically allocates space for disk inodes as required, freeing the space when it is no longer required. This is a radical improvement over Ext2, which reserves a fixed amount of space for disk inodes at file system creation time. With dynamic inode allocation, users do not have to estimate the maximum number of files and directories that a file system will contain. Additionally, this feature decouples disk inodes from fixed-disk locations.

  • Directory organization. Two different directory organizations are provided: one is used for small directories and the other for large directories. The contents of a small directory (up to eight entries, excluding the self (. or "dot") and parent (.. or "dot dot") entries) are stored in the directory's inode. This eliminates the need for separate directory block I/O and the need to allocate separate storage. The contents of larger directories are organized in a B+ tree keyed on name. B+ trees provide faster directory lookup, insertion, and deletion capabilities when compared to traditional unsorted directory organizations.

  • Online resizing. This feature allows the file system to grow while it is mounted. This feature is used with a volume manager.

  • Online snapshot. This option provides an online backup mechanism by creating a point-in-time image of the file system. It helps eliminate the need for the system to be offline to obtain a consistent backup. This feature is used with a volume manager.

  • "No integrity" mount option. This feature of JFS disables the option to journal file system metadata changes. It can be used by a restore program to decrease the restore time.

  • 64 bits. JFS is a full 64-bit file system. All the appropriate file system structure fields are 64 bits in size. This allows JFS to support large files and partitions.

JFS has other advanced features, such as allocation groups (which speed file access times by maximizing locality) and various block sizes ranging from 512 bytes to 4096 bytes (which can be tuned to avoid internal and external fragmentation). Note that at this time 4K is the only block size currently supported.

Kernel Configuration Support for JFS

JFS was merged into the 2.4.20 release of the kernel.org source tree.

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

 JFS filesystem support (CONFIG_JFS_FS=y,m,n) 

Click y next to the JFS enTRy if you want to build JFS into the kernel. Click m beside the JFS entry if you would like to build JFS as a module.

Other options are available in the JFS section for JFS configuration.

Working with JFS

There are two ways to tune a JFS file system:

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

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

These tuning options are discussed in the following sections.

Creating a JFS File System

The program that creates a JFS file system is called jfs_mkfs. This program can also be invoked by using the name mkfs.jfs. For a list of all the options of the mkfs utility, see the mkfs.jfs man page.

The next example shows how to create a JFS file system using a spare partition (/dev/hdb1). (If there is unpartitioned space on your disk, you can create a partition using fdisk. After you create the partition, reboot the system to make sure that the new partition is available to create a JFS file system on it.)

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

 # mkfs.jfs /dev/hdb1 

After the file system has been created, mount it by using the mount command. Determine the mount point and create a new empty directory, such as /jfs, to mount the file system with the following command:

 # mount -t jfs /dev/hdb1 /jfs 

After the file system is mounted, you can try out JFS.

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

 # umount /jfs 

Increasing Speed with an External Log for JFS

An external log improves performance because the log updates are saved to a different partition than their corresponding file system.

To create a JFS file system with the log on an external device, the system needs to have two unused partitions. In the following example, /dev/hda1 and /dev/hdb1 are spare partitions. /dev/hda1 is used as the external log.

 # mkfs.jfs -j /dev/hda1 /dev/hdb1 

Mounting the File System

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

 # mount -t jfs /dev/hdb1 /jfs 

To avoid having to mount the file system every time you boot, you can add it to the /etc/fstab file. First, make a backup of /etc/fstab and then edit the file and add the /dev/hdb1 device. For example, add

 /dev/hdb1 /jfs jfs defaults 1 2 

Mount Options

By default, the JFS mount option integrity is set, which causes metadata changes to be committed to the journal. To change the performance of the JFS file system, use the nointegrity mount option. nointegrity causes the file system to not be written to the journal. The primary use of this option is to allow for higher performance when restoring a volume from backup media. However, the volume's integrity is not guaranteed if the system abnormally abends. Specify the integrity option to remount a volume where the nointegrity option was previously specified in order to restore normal behavior.

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

Tuning JFS

A performance option that the jfs_tune utility provides is the capability to change the journal's location, which allows you to move the journal to an external device. Changing a journal's location involves the following steps:

1.

Create a journal on an external device /dev/hda2:

 # mkfs.jfs -J journal_dev /dev/hda2 

2.

Attach the external journal to the file system, which is located on /dev/hdb1:

 # jfs_tune -J device=/dev/hda2 /dev/hdb1 

JFS Utilities

The following JFS utilities are available in the jfsutils package:

  • jfs_fsck. Initiates a replay of the JFS transaction log and checks and repairs a JFS formatted device.

  • jfs_mkfs. Creates a JFS formatted partition.

  • jfs_logdump. Dumps the journal log of a JFS formatted device.

  • jfs_tune. Adjusts tunable file system parameters on JFS.

  • jfs_fscklog. Extracts a JFS fsck service log into a file or format and displays the extracted file.

  • jfs_debugfs. A shell-type JFS file system editor.

For more information, see the man pages for the JFS 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