1820396 Members
3200 Online
109623 Solutions
New Discussion юеВ

Disk Fragmentation

 
SOLVED
Go to solution
Jared Westgate_1
Valued Contributor

Disk Fragmentation

I saw a note about how to defragment a disk on the forums today and it got me thinking... How often should you defragment your disks? Is it really a performance issue? I noticed some documents that suggest fragmentation does not significantly affect performance. I'm a little suprised by this, so I figured that I'd ask you.
3 REPLIES 3
Carsten Krege
Honored Contributor

Re: Disk Fragmentation

I thought I cut & paste the important section from the fsadm_vxfs manual page:

Defragmentation
For optimal performance, the kernel-extent allocator must be able to
find large extents when it wants them. To maintain file-system
performance, fsadm should be run periodically against all VxFS file
systems to reduce fragmentation. fsadm should be run somewhere
between once a day and once a month against each file system. The
frequency depends on file system usage and activity patterns, and the
importance of performance. The -v option can be used to examine the
amount of work performed by fsadm. The frequency of reorganization
can be adjusted based on the rate of file system fragmentation.

There are two options that are available to control the amount of work
done by fsadm. The -t option is used to specify a maximum length of
time to run. The -p option is used to specify a maximum number of
passes to run. If both are specified, the utility exits if either of
the terminating conditions is reached. By default, fsadm will run 5
passes. If both the -e and -d options are specified, the utility will
run all the directory reorganization passes before any extent
reorganization passes.


If you have a very static filesystem, where not many files are created/removed or change in size, the intervals can be longer.

The easiest is to check the fragmentation by running:

# fsadm -F vxfs -D -E

This gives a report on your fragmentation. To perform the defragmentation you run

# fsadm -F vxfs -d -e -D -E

This works only with the Advanced JFS product.

Carsten
-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
Thomas Schler_1
Trusted Contributor
Solution

Re: Disk Fragmentation

Hi,

Carsten told how to use fsadm for defragmentation. The man page of fsadm also gives some hints on decision when it is worth to defragment and when not based on calculated values by fsadm. Actually, I didn't make tests to see when performance does increase or not before and after defragmentation. I do defragmention of filesystems twice a year, immediately after creating complete system backups.

If you decide doing defragmentation you should be sure having the latest fsadm patches with all its patch dependencies (including the newest patches dealing with vxfs or hfs) installed/configured on your system. (About two years ago, I had to re-install my system after trying to defragment without having installed the latest relevant patches.) In addition, you should create complete and working system backups before starting any defragmentation.

Regards,
Thomas
no users -- no problems
Carsten Krege
Honored Contributor

Re: Disk Fragmentation

I tend to agree with Thomas, especially concerning the backup and patch strategy. Personally I wouldn't run the defragmentation on the standard HPUX filesystems (/, /opt, /usr, /var) as these are really static.

Another caveat is that the filesystem should not be full (100% usage), as defragmentation requires some free space for the defragmentation operations (copies basically).

We often found it necessary to run fsadm -d -e on active filesystems, specifically we ran directory defragmentation (fsdam -d) on growing filesystems (in terms of number of files or file size), such as /usr/sap/trans on an SAP/R3 system. The reason is that directory inodes grow slowly and allocate one extent after another. Since they grow so slow, the extents are not allocated in sequential order on the physical disk, but are widely distributed. If not defragmented reading the directory inode can consume a lot of time!

Carsten

-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG