The Veritas File System (VxFS) provides the "/usr/lib/fs/vxfs/fsadm" command whose few amongst other functions are to report on directory and extent defragmentation, perform directory level and extent level reorganization and perform free space defragmentation.
It is identified that the extent reorganization by using the "fsadm -e" command may be very slow and inefficient when the following conditions may be true:
(NOTE: Please refer to the man page of 'fsadm_vxfs(1M)' OR the Storage Foundation Product Documentation available from the SORT portal OR refer to the following article 000034301 to check if a VxFS File System is fragmented and the steps to defragment a VxFS File System)
If either of the above two conditions are true that affect the efficiency and performance of 'fsadm' operations as explained above, then to overcome these situations and improve the overall efficiency, speed and performance of the 'fsadm' operations, we recommends the following:
The actual time required to generate reports on fragmentation (fsadm -D -E) OR to perform a directory or extent reorganization (fsadm -d -e) OR to perform the free space defragmentation (fsadm -C) on a VxFS file system will depend upon many factors like the size of the file system, file system usage, system activity, number of files, sizes of files, etc. However what matters most for the amount of time taken to complete the 'fsadm' tasks is the number of files in the file system and how many extents that each file have on an average. The 'fsadm –E' command on a VxFS file system provides an extent fragmentation report, however this too can sometimes take a very long time to run if the file system contains many (millions) of files (inodes).
Additional Information about free space defragmentation feature in VxFS:
From Storage Foundation 6.0 onwards, the 'fsadm' defragmentation operations have changed and fragmentation can be determined based on a fragmentation index. There are two types of indices generated by fsadm: the file fragmentation index and the free space fragmentation index. The fragmentation index is an integer value between 0 and 100, which gives an idea about the level of file fragmentation and free space fragmentation. A value of 0 for the fragmentation index means no fragmentation, and value of 100 means the highest level of fragmentation. The free space defragmentation is a new feature introduced in Storage Foundation 6.0 release, which will minimize the free space fragmentation.
Since the free space defragmentation is critical to improve the performance of 'fsadm' operations, we have enabled free space defragmentation to the 5.1 SP1* releases on all the platforms with reference to the following escalation enhancement etrack:
Etrack 2283893 - Add functionality of free space defragmentation through fsadm
The fixes to the above etrack can be located via the SORT portal search facility by using the etrack number: 2283893
The following command is used to defragment free space on VxFS File Systems on the SF 5.1 SP1* releases that include the escalation enhancement for etrack 2283893:
Syntax: fsadm -C [-U free space percent]
'fsadm –C –U 50' - This is specific to 5.1SP1* where VxFS code fakes a shrink in the same way as aggressive thin reclaim (fsadm –R –A), so it can evacuate extents near the end of the device but do not perform the shrink itself; This effectively defragments the free space. With -U option (option only available in 5.1 SP1*) one can specify what percent of total free space is required to be defragmented.
In SF 6.0 onwards we still use 'fsadm –C' but the operation is done differently and the 'fsadm -U' option is not applicable or available from SF 6.0 onwards.