A major change in Red Hat Enterprise 7 is the switch from ext4 to XFS as the default filesystem. So, for many of RHEL experts may have to think to migrate ext4 to XFS.
This article is not mean to show you how to migrate/convert ext3/4 to XFS, rather, is mean to highlight the differences which may be enountered when using or administering an XFS filesystem.
The ext4 file system is still fully supported in Red Hat Enterprise Linux 7 and may be selected at installation if desired. While it is possible to migrate from ext4 to XFS it is not required.
Ext 3/4 commands and tools and their XFS counterparts
The following table shows common commands for ext3 and ext4, and their XFS-specific counterparts.
Common Commands for ext3/4 and XFS
|File System check||e2fsck||xfs_repair|
|REsizing a File System||resize2fs||xfs_growfs|
|Save an image of a file system||e2image||xfs_metadump and xfs_mdrestore|
|Label or tune a File System||tune2fs||xfs_admin|
|Backup a File System||dump and restore||xfsdump xfsrestore|
Generic tools that function on both XFS and ext3/4
The following table shows generic tools that function on XFS file systems as well, but the XFS versions have more specific functionality and as such are recommended.
Behavioral and Administrative Differences Between Ext 3/4 and XFS
File system repair
Ext3/4 runs e2fsck in userspace at boot time to recover the journal as needed. XFS, by comparison, performs journal recovery in kernelspace at mount time. An fsck. xfs shell script is provided but does not perform any useful action as it is only there to satisfy initscript requirements.
When an XFS file system repair or check is requested, use the xfs_repair command. Use the -n option for a read-only check.
The xfs_repair command will not operate on a file system with a dirty log. To repair such a file system mo unt and unmo unt must first be performed to replay the log. If the log is corrupt and cannot be replayed, the -L option can be used to zero out in the log.
Metadata error behavior
The ext3/4 file system has configurable behavior when metadata errors are encountered, with the default being to simply continue. When XFS encounters a metadata error that is not recoverable it will shutdown the file system and return a EFSCORRUPTED error. The system logs will contain details of the error enountered and will recommend running xfs_repair if necessary.
XFS quotas are not a remountable option. The -o quota option must be specified on the initial mount for quotas to be in effect.
While the standard tools in the quota package can perform basic quota administrative tasks (tools such as set quota and repquota), the xfs_quota tool can be used for XFSspecific features, such as Project Quota administration.
The quota check command has no effect on an XFS file system. The first time quota accounting is turned on XFS does an automatic quota check internally. Because XFS quota metadata is a first-class, journaled metadata object, the quota system will always be consistent until quotas are manually turned off.
File system resize
The XFS file system has no utility to shrink a file system. XFS file systems can be grown
online via the xfs_g ro wfs command.
For file systems above 1T with 256 byte inodes, or above 2T with 512 byte inodes, XFS inode numbers may exceed 2^32. These large inode numbers will cause 32-bit stat calls to fail with EOVERFLOW. In general, applications should properly handle these larger inode numbers but, if necessary XFS may be mounted with -o i no d e32 to enforce inode numbers below 2^32.
This will not affect inodes already allocated with 64-bit numbers.
This option changes allocation behavior and may lead to early ENOSPC if no space is available to allocate inodes in the lower disk blocks. The inode32 option should not be used unless required by a specific environment.
XFS uses speculative preallocation to allocate blocks past EOF as files are written. This avoids file fragmentation due to concurrent streaming write workloads on NFS servers. By default, this preallocation increases with the size of the file and will be apparent in " du" output. If a file with speculative preallocation is not dirtied for five minutes the preallocation will be discarded. If the inode is cycled out of cache before that time, then the preallocation will be discarded when the inode is reclaimed.
If premature ENOSPC problems are seen due to speculative preallocation, a fixed preallocation amount may be specified with the -o allocsize= amount mount option. Fragmentation - related tools Fragmentation is rarely a significant issue on XFS file systems due to heuristics and behaviors, such as delayed allocation and speculative preallocation. However, tools exist for measuring file system fragmentation as well as defragmenting file systems. Their use is not encouraged.
The xfs_dbfrag command attempts to distill all file system allocations into a single fragmentation number, expressed as a percentage. The output of the comand requires significant expertise to understand its meaning. For example, a fragmentation factor of 75% means only an average of 4 extents per file. For this reason the output of xfs_db's frag is not considered useful and more careful analysis of any fragmentation problems isrecommended.