chfs Command

Purpose

Changes attributes of a file system.

Syntax

chfs [ -n NodeName ] [ -m NewMountPoint ] [ -u MountGroup ] [ -A { yes | no } ] [ -p { ro | rw } ] [ -t { yes | no } ] [-a Attribute=Value ] [ -d Attribute ] FileSystem

Description

The chfs command changes the attributes of a file system. The new mount point, automatic mounts, permissions, and file system size can be set or changed. The FileSystem parameter specifies the name of the file system, expressed as a mount point.

Some file system attributes are set at the time the file system is created and cannot be changed. For the Journaled File System (JFS), such attributes include the fragment size, block size, number of bytes per i-node, compression, and the minimum file system size. For the Enhanced Journaled File System (JFS2), the block size cannot be changed.

The chfs command also accepts attributes that have no meaning to the file system. The attributes are saved in the /etc/filesystems file, but the file system does not act on the attributes. Additional attributes must be limited. The total size of a stanza in the /etc/filesystems file cannot exceed 512 bytes. If the size exceeds the limit, the stanza is no longer recognized.

The chfs command ignores any Attribute=Value pair that the command does not understand but adds them to an appropriate stanza in the /etc/filesystems file.

Example:

chfs -a abcd=1G /

This will set the new abcd attribute to the value of 1G in the root stanza in /etc/filesystems file.

Flags

Item Description
-a Attribute=Value Specifies the Attribute=Value pairs dependent on virtual file system type. To specify more than one Attribute=Value pair, provide multiple -a Attribute=Value parameters.

The following attribute or value pairs are specific to the Journaled File System (JFS):

 
-a copy=Copy#
Specifies which mirror copy to split off when used in conjunction with the splitcopy attribute. The default copy is the second copy. Valid values are 1, 2, or 3.
 
-a log=LVName
Specifies the full path name of the filesystem logging logical volume name of the existing log to be used. The log device for this filesystem must reside on the same volume group as the filesystem.
 
-a size=NewSize
Specifies the size of the Journaled File System. The size can be specified in units of 512-byte blocks, megabytes or gigabytes. If Value has the M suffix, it is interpreted to be in megabytes. If Value has a G suffix, it is interpreted to be in gigabytes. If Value begins with a +, it is interpreted as a request to increase the file system size by the specified amount. If the specified size is not evenly divisible by the physical partition size, it is rounded up to the closest number that is evenly divisible.

The volume group in which the file system resides defines a maximum logical volume size and also limits the file system size.

The maximum size of a JFS file system is a function of its fragment size and the nbpi value. These values yield the following size restrictions:
  NBPI  Minimum AG Size    Fragment Size        Maximum Size (GB)
   512         8        512, 1024, 2048, 4096          8
  1024         8        512, 1024, 2048, 4096         16
  2048         8        512, 1024, 2048, 4096         32
  4096         8        512, 1024, 2048, 4096         64
  8192         8        512, 1024, 2048, 4096        128
 16384         8             1024, 2048, 4096        256
 32768        16                   2048, 4096        512
 65536        32                         4096       1024
131072        64                         4096       1024
 
-a splitcopy=NewMountPointName
Splits off a mirrored copy of the file system and mounts it read-only at the new mount point. This provides a copy of the file system with consistent JFS meta-data that can be used for backup purposes. User data integrity is not guaranteed, so it is recommended that file system activity be minimal while this action is taking place. Only one copy may be designated as an online split mirror copy.
  The following attribute or value pairs are specific to the Enhanced Journaled File System (JFS2):
-a Attribute=Value
-a ea=v2
Converts the JFS2 file system extended attribute (ea) format. A JFS2 file system using the v1 format can be converted to one using v2 format. After it is converted the file system cannot be converted back to v1. The conversion is done in an on-demand manner such that any extended attribute or ACL writes cause the conversion for that file object to occur. The v2 format provides support for scalable named extended attributes as well as support for NFS4 ACLs. The v1 format is compatible with prior releases of AIX®operating system.
 
-a efs=yes
Converts a file system to an Encrypted File System (EFS).

The chfs command changes an existing file system into an EFS file system. When the file system is EFS enabled, the ea attribute is automatically converted to store scalable extended attributes (v2). This command fails if you have not run the efsenable command on the system.

Restriction: The chfs commands prevents conversion of the following file systems (mount points) to EFS because the security infrastructures (kernel extensions, libraries and so on) are not available during boot:
  • /
  • /usr
  • /var
  • /opt
 
-a freeze = { timeout | 0 | off }
Specifies that the file system must be frozen or thawed, depending on the value of timeout. The act of freezing a file system produces a nearly consistent on-disk image of the file system, and writes all dirty file system metadata and user data to the disk. In its frozen state, the file system is read-only, and anything that attempts to modify the file system or its contents must wait for the freeze to end. The value of timeout must be either 0, off, or a positive number. If a positive number is specified, the file system is frozen for a maximum of timeout seconds. If timeout is 0 or off, the file system will be thawed, and modifications can proceed.

Attention: Freezing base file systems (/, /usr, /var, /tmp) can result in unexpected behavior.

 
-a [ log | logname ]=LVName
Specifies the full path name of the filesystem logging logical volume name of the existing log to be used. The log device for this filesystem must reside on the same volume group as the filesystem. Keyword INLINE can be used to specify that the log is in the logical volume with the JFS2 file system. The file system must have been created with an INLINE log to use this option. This option updates the /etc/filesystems file so that if the name of the logical volume containing the file system changes the log will be recognized.
Note: For a file system using OUTLINE log, this option can be used to change the outline log from one logical volume to another logical volume as long as the logical volume is properly formatted and the type of the logical volume is jfs2log. If a file systems is mounted at the time chfs is called to change the outline log, the /etc/filesystems file will show the change, but the actual log will not be changed until the next mount for the file system (which follows a umount operation or a system crash and recovery). For a file system using INLINE log, this option does not support switching logs between INLINE and OUTLINE log. Currently, to switch from inlinelog to outlinelog (or vise versa), the file system has to be removed and recreated.
In release AIX 5L and AIX 5.1, if the file system is using inlinelog, the log entry is the same as the file system in /etc/filesystems file:
/j2.1:         
dev             = /dev/fslv00         
vfs             = jfs2         
log             = /dev/fslv00         
mount           = false         
account         = false
But, from AIX 5.2 and later releases, if the file system is using inlinelog, the log entry is the keyword INLINE in /etc/filesystems file:
/j2.23:         
dev             = /dev/fslv04         
vfs             = jfs2         
log             = INLINE         
mount           = false         
options         = rw         
account         = false
If the file system was created at AIX 5L or AIX 5.1, and later upgraded to AIX 5.2 or later releases, then chfs can be used to alter the inlinelog name in /etc/filesystems file.
 
-a logsize=LogSize
Specifies the size for an INLINE log in MBytes. The input size must be a positive value. If the inline log size is greater than or equal to 1, the input size must be an integer. If the input is floating point value of less than 1 and greater than or equal to 0, the input size is ignored and the default inline log size is taken. If value begins with a + (plus sign), it is interpreted as a request to increase the INLINE log size by the specified amount. If value begins with a - (minus sign), it is interpreted as a request to reduce the INLINE log size by the specified amount.

The input is ignored if an INLINE log not being used. The INLINE log size cannot be greater than 10% of the size of the file system and it cannot be greater than 2047 MB.

 
-a managed={yes | no}
Enables Data Management Application Programming Interface (DMAPI) on a JFS2 file system.
 
-a maxext=Value
Specifies the maximum size of a file extent in file system blocks. A zero value implies that the JFS2 default maximum should be used. Values less than 0 or exceeding maximum supported extent size of 16777215 are invalid. Note that existing file extents are not affected by this change.
 
-a mountguard={yes | no}
Guards the file system against the unsupported concurrent mounts in a PowerHA® SystemMirror® or other clustering environment. If the mountguard is enabled, the file system cannot be mounted if it appears to be mounted on another node or system. To temporarily override the mountguard setting, see the noguard option of the mount command.
 
-a options = mountOptions
Specifies which mount option is passed into the chfs command. For a list of the valid options, refer to the mount command.
 
-a reclaim={normal | fast}
If the normal option is chosen, the reclaim command packs the filesystem as much as possible. The reclaim command looks for the biggest contiguous chunk of free space and then reclaims as much of it as it can. This makes the reclaimed free space available for reuse elsewhere in the system. However, when you use the normal option for the reclaim command, the file system becomes frozen. Therefore, if large amount of data is packed, the freeze time can be significant.

If the fast option is chosen, the reclaim command looks for the biggest contiguous chunk of free space and then reclaims as much of it as it can. This makes the reclaimed free space available for reuse elsewhere in the system.

It is not possible to determine exactly how much free space is recovered by the reclaim command. In order to get a rough estimate of the space reclaimed before running the chfs command, which will actually reclaim the space, you must first run, lvmstat –v <volume group> –e, and then after the chfs command finishes, run lvmstat –v <volume group> –r.

The first lvmstat command enables statistic collection for that volume group, and the second prints out the recorded statistics.

All of the disks in the file system must support the reclaim operation. The reclaim operation does not alter the actual file system size. The reclaim option cannot be specified if there are snapshots in the file system and cannot be run while live update is running, or if the file system is read-only. The reclaim option cannot be used along with any file system resize operation. Live update will not start if this command is in progress.

 
-a refreeze={timeout}
Specifies that the timeout for a frozen file system be reset. The timeout is reset to the value specified. The file system must still be frozen (using the -a freeze option or the fscntl interface).
 
-a size=NewSize
Specifies the size of the Enhanced Journaled File System in 512-byte blocks, megabytes or gigabytes. If Value has the M suffix, it is interpreted to be in megabytes. If Value has a G suffix, it is interpreted to be in gigabytes. If Value begins with a +, it is interpreted as a request to increase the file system size by the specified amount. If Value begins with a -, it is interpreted as a request to reduce the file system size by the specified amount.

If the specified size does not begin with a + or -, but it is greater or smaller than the file system current size, it is also a request to increase or reduce the file system size.

If the file system has an inlinelog, the inlinelog size remains unchanged if the new size of this file system is the same as the current file system size. If the specified size is not evenly divisible by the physical partition size, it is rounded up to the closest number that is evenly divisible. If the file system is on a striped logical volume, the size of the new file system is rounded to the nearest multiple of the striping width multiplied by the physical partition size. The striping width is the number of hard disks that form the striped logical volume.

This attribute is required when creating a JFS2 file system unless the -d flag has been specified. The volume group in which the file system resides defines a maximum logical volume size and limits the file system size. The maximum size is determined by the file system block size:
fs block size (byte)        MAX fssize (TB)
===========================================
512                         4
1024                        8
2048                        16
4096                        32

When a request to reduce the file system size is successful, the logical volume should be equal to or smaller than the original LV size depending on the requested filesystem size.

Both size and logsize attributes can be specified in one chfs request to resize the filesystem and its inlinelog sizes.

Note: The file system might be frozen for a significant time during the shrink operations. To minimize the impact on applications, you must shrink the file system in small amounts and during low workloads.
 
-a vix={yes|no}
Specifies whether the file system can allocate inode extents smaller than the default of 16 KB if there are no contiguous 16 KB extents free in the file system. After a file system is enabled for small free extents, it cannot be accessed on earlier versions of AIX and the marking cannot be removed.
yes
File system can allocate variable length inode extents.
no
File system must use default size of 16 KB for inode extents. This has no effect if the file system already contains variable length inode extents.
 
Note:
  1. JFS2 does not have nbpi or fragment size values to affect the resulting size of the file system.
  2. You cannot shrink a file system if the requested size is less that a physical partition size. At least one physical partition size is asked to be reduced.
  3. Shrinking a file system that has snapshots is not allowed.
  4. During the shrink operation of the filesystem, the write operations to the file system might be restricted intermittently.
  5. The file system is not accessible when the extend operation is running. Large file systems with inline logs might not be usable for several minutes. The inline log must be reformatted.
  6. When the new file system size is specified, but its inlinelog size is NOT specified, the new logsize will be adjusted (extended/shrunk) proportionally, based on the specified extended/shrunk file system size. The log size increase or reduction should not be more than 40% of the file system size increase or reduction.
  7. When a new file system size is not specified and there is an inlinelog, if a new logsize is specified, the file system size might be changed to include the new log size.
  8. The freed space reported by the df command is not necessary the space that can be truncated by a shrinkFS request due to filesystem fragmentation. A fragmented filesystem may not be shrunk if it does not have enough free space for an object to be moved out of the region to be truncated, and shrinkFS does not perform filesystem defragmentation. In this case, the chfs command should fail with the returned code 28 (ENOSPC)
  9. The maxext attribute is ignored in older releases even if the filesystem was created with it on a later release.
  10. In AIX 7.2 Technology Level 1, or later, after the partition is freed by running the chfs command, the space reclamation process is started on the freed partition.
-A Specifies the attributes for auto-mount.
yes
File system is automatically mounted at system restart.
no
File system is not mounted at system restart.
-d Attribute Deletes the specified attribute from the /etc/filesystems file for the specified file system.
-m NewMountPoint Specifies a new mount point for the specified file system.
-n NodeName Specifies a node name for the specified file system. The node name attribute in the /etc/filesystems file is updated with the new name. The node name attribute is specific to certain remote virtual file system types, such as the NFS (Network File System) virtual file system type.
-p Sets the permissions for the file system.
ro
Specifies read-only permissions.
rw
Specifies read-write permissions.
-t Sets the accounting attribute for the specified file system.
yes
File system accounting is to be processed by the accounting subsystem.
no
File system accounting is not to be processed by the accounting subsystem; this is the default.
-u MountGroup Specifies the mount group. Mount groups are used to group related mounts, so that they can be mounted as one instead of mounting each individually. For example, when performing certain tests, if several scratch file systems always need to be mounted together, they can each be placed in the test mount group. They can then all be mounted with a single command, such as the mount -t test command.

Security

Access Control

Only the root user or a member of the system group can run this command.

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To change the file system size of the /test Journaled File System, enter:
    chfs  -a size=24576 /test
    This command changes the size of the /test Journaled File System to 24576 512-byte blocks, or 12MB (provided it was previously no larger than this).
  2. To increase the size of the /test Journaled File System, enter:
    chfs  -a size=+8192 /test
    This command increases the size of the /test Journaled File System by 8192 512-byte blocks, or 4 MB.
  3. To convert a JFS2 file system to a version which can support NFS4 ACLs, type:
    chfs -a ea=v2 /test
  4. To change the mount point of a file system, enter:
    chfs  -m /test2 /test
    This command changes the mount point of a file system from /test to /test2.
  5. To delete the accounting attribute from a file system, enter:
    chfs -d account /home
    This command removes the accounting attribute from the /home file system. The accounting attribute is deleted from the /home: stanza of the /etc/filesystems file.
  6. To split off a copy of a mirrored file system and mount it read-only for use as an online backup, enter:
    chfs -a splitcopy=/backup -a copy=2 /testfs
    This mount a read-only copy of /testfs at /backup.
  7. To change the file system size of the /test Journaled File System, enter:
    chfs -a size=64M /test
    This command changes the size of the /test Journaled File System to 64MB (provided it was previously no larger than this).
  8. To reduce the size of the /test JFS2 file system, enter:
    chfs  -a size=-16M /test
    This command reduces the size of the /test JFS2 file system by 16MB.
  9. To freeze a file system, enter:
    chfs  -a freeze=60 /adl
    This command freezes the /adl file system for a maximum of 60 seconds.
  10. To thaw a file system, enter:
    chfs  -a freeze=off /zml
    This command thaws the /zml file system.

File

Item Description
/etc/filesystems Lists the known file systems and defines their characteristics.