User Tools

Site Tools


aix:aix_scsi_unmap

Reclaim space on disk

Defrag filesystem

The defragfs command attempts to coalesce free space in the file system to increase the file system's contiguous free space. A new option -f is added to also coalesce internal fragmentation of all files in the file system.

# defragfs -r /usr
Total allocation groups                                            : 104
Allocation groups skipped - entirely free                          : 31
Allocation groups skipped - too few free blocks                    : 64
Allocation groups that are candidates for defragmenting            : 9
Average number of free runs in candidate allocation groups         : 60
# defragfs -f /usr
Warning: Filesystem /usr shares a log with other filesystems. 
It is recommended that the filesystem be remounted with its own dedicated log volume 
to avoid performance issues. Continue anyway? (y/n): y
..
527 files defragged.

Reclaiming JFS2 space

AIX 7.2 TL 03 and later

There is a new attribute for the chfs command to reclaim unused space in JFS2 for the -a option without shrinking the file system:

chfs -a reclaim=[normal | fast] /<filesystem>

If the normal mode is chosen, this command packs the file system as much as possible.

The chfs command cannot estimate exactly how much free space is recovered. To get an estimate, run lvmstat -v VGNAME -r after running the chfs command to provide a rough estimate of how much space was reclaimed.

SCSI unmap, reclaim space on disk

SCSI Unmap is available on AIX 7.2 TL1 and later. This

All volume groups created in this OS version will be able to use SCSI UNMAP. This function is also related to disks characteristics, it must be thin-provisionned (not compressed), and storage must support SCSI-UNMAP.

The operation that will use reclamation are: rmlv, rmlvcopy, chfs (shrink), rmlv

Allows you to enable or disable the support for the Logical Block Provisioning (thin-provisioning) in the AIX operating system. When disabled, AIX will not attempt to release the blocks that is not used from a thin-provisioned disk. A value of 1 enables the LBP support.

[root@aix1]/root# ioo -o dk_lbp_enabled
dk_lbp_enabled = 1

Check if reclamation is available on the VG data1vg, then space will be automaticaly reclaimed

[root@aix1]/root#  /usr/sbin/lvmstat -v data1vg -r
PV_name     reclaim Mb_freed    Mb_pending  Mb_success  Mb_failed   Mb_reused
hdisk2      on      0           0           0           0           0

To check if some space-release requests have failed because of insufficient buffers, run the following command.

[root@aix1]/root# cat /proc/sys/disk/lbp/statistics
Out-of-Memory counter                = 0
Number of Unmap requests received    = 21
Number of Unmap requests accepted    = 21
Number of Unmap requests dispatched  = 21
Number of Unmap requests failed      = 0
Number of Unmap requests aborted     = 0

To set the number of buffers in the pool to be 128 (default is 64), use the following command:

ioo -o dk_lbp_num_bufs=64 -p
ioo -L

Traditionally, most disks use a sector size of 512-bytes but some new storage products now also support a 4096-byte sector. For space release requests to work on a thin-provisioned disk that uses 4096-bytes sectors, the buffer size of the pool should be defined as 4096. Note that a buffer size of 4096 bytes can also work with thin-provisioned disks that use block size of 512-bytes.

ioo -o dk_lbp_buf_size=4096 -p
aix/aix_scsi_unmap.txt · Last modified: 2021/01/01 22:15 (external edit)