|
SGI has released a version of its high-end XFS file system for Linux. Based on the SGI Irix XFS file system technology, XFS supports metadata journaling and extremely large disk farms. A single XFS file system is designed to be 18,000 petabytes and a single file can be 9,000 petabytes. In addition, XFS is designed to scale and have high performance. XFS uses many of the same techniques available in JFS. XFS is a 64-bit file system. All the file system counters in the system are 64 bits in length, as are the addresses used for each disk block and the unique number assigned to each file inode number. Currently, Linux supports only 32-bit inode numbers, so this limits XFS to a 32-bit inode number. A single file system can in theory be as large as 18 million terabytes. Currently, Linux has a 2TB limit for the 2.4.x kernel and a 16TB limit for the 2.6.x kernel. XFS partitions the file system into regions called allocation groups (AGs). Each AG manages its own free space and inodes, as shown in Figure 11-7. In addition, AGs provide scalability and parallelism for the file system. AGs range in size from 0.5GB to 4GB. Files and directories are not limited to a single AG. Figure 11-7. XFS file system allocation groups.Free space and inodes within each AG are managed so that multiple processes can allocate free space throughout the file system simultaneously, thus reducing the bottleneck that can occur on large, active file systems. XFS was merged into the 2.4.25 release of the kernel.org source tree. Kernel Configuration Support for XFSYou can set XFS options through the File Systems section of the configuration menu by enabling the following option: XFS filesystem support (CONFIG_XFS_FS=y,m,n) Click y next to the XFS entry if you want to build XFS into the kernel. Click m next to the XFS enTRy if you want to build XFS as a module. Other options are available in the XFS section for XFS configuration. If you need any of these options, select them there. Working with XFS File SystemsThere are two ways to tune an XFS file system:
Both of these tuning options are discussed in the following sections. Creating an XFS File SystemThe program that creates XFS file systems is called xfs_mkfs. This program can also be invoked by using the name mkfs.xfs. For a list of all the options of the mkfs utility, see the mkfs.xfs man page. The next example shows how to create an XFS file system using a spare partition (/dev/hda1). To create the XFS file system with the log inside the XFS partition, issue the following command: # mkfs.xfs /dev/hda1 One option that can make a difference in the file system is the -i size=xxx option. The default inode size is 256 bytes. The inode size can be increased (up to 4KB). Doing so means that more directories keep their contents in the inode and need less disk I/O to read and write. However, inodes conversely need more I/O to read; because they are read and written in clusters, this is not a straightforward calculation. Because extents are also held in the inode if there is room, the number of files with out-of-inode metadata is reduced. Another option that makes a difference in the file system's performance is the log size: -l size=xxx. A larger log means that when there is a large amount of metadata activity, more time elapses before modified metadata is flushed to the disk. However, a larger log also slows down recovery. Finally, for very large file systems, keep the agcount as low as possible (specified with the -d agcount= option). An allocation group can be up to 4GB in size; more allocation groups means more of them to scan in low free-space conditions. The allocation group size also governs the maximum extent size you can have in a file. After the file system has been created, mount it using the mount command. Determine a mount point and create a new empty directory, such as /xfs, to mount the file system: # mount -t xfs /dev/hda1 /xfs After the file system is mounted, you can try out XFS. To unmount the XFS file system, use the umount command with the same mount point as the argument: # umount /xfs Full File SystemAn XFS file system performs allocations more slowly when the file system is very fullnearly 99%. Basically, XFS composes the file system into allocation groups (1 to 4 GB each), and free space is managed independently in each of these. The slowdown occurs when the system has to scan through a large number of allocation groups, looking for space to extend a file. An in-memory summary structure tells you if it is worth the effort to look in an allocation group, so a major slowdown does not usually occur, unless a significant number of parallel actions occur. Increasing Speed with an External Log for XFSAn external log improves performance because the log updates are saved to a different partition than their corresponding file system. To create an XFS 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 as the external log. # mkfs.xfs -l logdev=/dev/hda1 /dev/hdb1 Mounting the File SystemTo mount the file system, use the following mount command: # mount -t xfs /dev/hdb1 /xfs 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 /xfs xfs defaults 1 2 Mount OptionsAt mount time, three XFS options are related to performance:
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 XFSFor a metadata-intensive workload, the default log size could be the limiting factor that reduces the file system's performance. Better results are achieved by creating file systems with a larger log size. The following mkfs command creates a log size of 32768b: # mkfs -t xfs -l size=32768b -f /dev/hdb1 Currently, to resize a log, you need to remake the file system. Also, it is a good idea to mount metadata-intensive file systems with the following: # mount -t xfs -o logbufsize=8,logbsize=32768b /dev/device /mntpoint XFS UtilitiesThe XFS utilities are available in two packages: xfsprogs and xfsdump. The xfsprogs package contains the following utilities:
The xfsdump package contains the following utilities:
Following are descriptions of some of the key file system utilities:
|
|