AIX

 View Only

Filesystem Space Reclaim in AIX for JFS2

By AXEL ISMIRLIAN posted Mon October 19, 2020 04:11 PM

  

Overview:

Filesystem space reclaim is used to return space to the disk in order to enact a Thin Provisioning scheme. Under a Thin Provisioning scheme, space is not allocated until a write is issued by the host to the disk. But as a filesystem grows, more and more space is allocated, and even if files are deleted later, this space is not given back.

In AIX 7.2 TL 03, a new chfs option is introduced to reclaim unused space in the filesystem. With this new chfs option, we can reclaim most of this space from the underlying disk, allowing it to be reused without shrinking the size of the filesystem.

The filesystem layer only provides a user command to execute this option. The actual work of the reclamation is done by the Logical Volume Manager (LVM). This option is only supported on JFS2.


Functional Overview:

There is a new attribute for the chfs command to reclaim unused space in JFS2: chfs -a reclaim=[normal | fast]

If the normal mode is chosen, this command will pack the filesystem as much as possible. Then it will look for the biggest contiguous chunk of free space and then reclaim as much of it as it can.

If the fast mode is chosen, this command will look for the biggest contiguous chunk of free space (without first packing the filesystem) and then reclaim as much of it as it can.

The chfs command will not be able to tell exactly how much free space is recovered. To get an estimate, the user should run, "lvmstat -v <volume group> -r," after running the chfs command to provide a rough estimate of how much space was reclaimed.


Example:

This example shows reclaim running a on 10GB filesystem with a partition size of 1GB. The first lvmstat command clears the statistics previously gathered for that volume group. Then example makes a filesystem, and creates 5 1GB files. Then it deletes every other one, and calls reclaim. This leaves the filesystem with 8GB of free space. Out of that free space, the chfs command managed to reclaim 6GB.


Key points of note:

1. Size: Although filesystem space reclaim frees disk partitions for reuse, this does not alter the actual filesystem size.
2. Performance Considerations: Filesystem space reclaim is recommended during periods of low I/O activity.

3. Restrictions:

  1. Filesystem space reclaim can only be run on a filesystem whose disks all support the

    reclaim operation. If all the disks on a volume group support the reclaim operation,

    the lvmstat -v <volume group> -r command will display “on” on the reclaim column.

  2. This cannot be run while live update is running, nor will live update start if this

    command is in progress.

  3. It cannot be used on a filesystem that is read-only.

  4. It cannot be used concurrently with any filesystem resize operation like shrinkfs or

    extendfs.

  5. For a normal logical volume, if the free space in the filesystem is less than one

    partition size, no space will be reclaimed. For a striped logical volume, the free space in the filesystem has to be at least the stripe width of the logical volume for space to be reclaimed.

  6. The amount of free space reclaimed depends on the number of free partitions in the filesystem as well as the underlying storage’s reclaim block size. Please run the lvmstat command to check the amount of free space reclaimed.


Additional Information:

https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/c_commands/chfs.html

This link provides additional information about the chfs command, and the reclaim option.


Contact:

Axel Ismirlian (ismirlia@us.ibm.com)

 

1 comment
22 views

Permalink

Comments

Sun February 19, 2023 03:17 AM

Axel, in the chfs documentation it is mentioned that with the normal option the "the file system becomes frozen".

does this also happen with the "fast" option?

thank you