Operating System - HP-UX
1834704 Members
2325 Online
110069 Solutions
New Discussion

Re: Online JFS defrag question

 
SOLVED
Go to solution
likid0
Honored Contributor

Online JFS defrag question

Hy, i periodically defrag the FS in an 11.23 box, i want to check if the defrags are working ok, and i am not sure, i understand the defrag stats, i have been looking at the fsadm man page, but i dont get it, can somebody give me a clue on where you have to look to see if the fs is fragmentated ?


Thnx!.

Extent Fragmentation Report
Total Average Average Total
Files File Blks # Extents Free Blks
1369376 19 1 17417055
blocks used for indirects: 1672
% Free blocks in extents smaller than 64 blks: 1.79
% Free blocks in extents smaller than 8 blks: 0.80
% blks allocated to extents 64 blks or larger: 90.96
Free Extents By Size
1: 36447 2: 19700 4: 15918
8: 6754 16: 3941 32: 1734
64: 1413 128: 1388 256: 1173
512: 708 1024: 327 2048: 268
4096: 179 8192: 97 16384: 42
32768: 51 65536: 44 131072: 21
262144: 12 524288: 3 1048576: 1
2097152: 0 4194304: 0 8388608: 0
16777216: 0 33554432: 0 67108864: 0
134217728: 0 268435456: 0 536870912: 0
1073741824: 0 2147483648: 0
Windows?, no thanks
10 REPLIES 10
Geoff Wild
Honored Contributor

Re: Online JFS defrag question

How do you run it?

I use a script:

#!/bin/sh
# defrag all mounted file systems
# modified to NOT include oracle filesystems

LOG=/tmp/fsadm.defrag.log
if [ -f $LOG ]
then
mv $LOG $LOG.old
fi
cat /dev/null > $LOG

for i in `mount -l | egrep -v "stand|oracle|\/v0" |awk '{print $1}'`
do
echo "defraging " $i "at "`date` >> $LOG
fsadm -F vxfs -d -D -e -E $i >> $LOG
done


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
A. Clay Stephenson
Acclaimed Contributor

Re: Online JFS defrag question

This is probably the most significant line:
% blks allocated to extents 64 blks or larger: 90.96

As long as that value is high you are fine.

In almost all cases, the gains you are going to get from defragging a vxfs filesystem are going to extremely difficult to measure --- much less actually perceive. Most of the times I done this, I've gained perhaps 1% in throughput or access times. The reason for this is that vxfs always tries to allocate space in large contiguous chunks (extents) and UNIX systems typically create and delete thousands of files per hour so that any defragging gains are rapidly wiped out.

This is a task I seldom bother with and for the vast majority of filesystems no defragging at all performs almost as well as daily defragging.
If it ain't broke, I can fix that.
likid0
Honored Contributor

Re: Online JFS defrag question

Thnx for the answers,

I launch:

fsadm -F vxfs -Dd -Ee -s $FS


And as you say, i only launch this in one, machine where the io on the fs is really big and it fragmets at a tremedous speed, and because is a fifo fs for the aplication is important it is defragmentated, the thing I wantes to check as you say, is an easy way to check if the fs are defragmentated.


so for example in a fs i have this?

% Free blocks in extents smaller than 64 blks: 0.03
% Free blocks in extents smaller than 8 blks: 0.00
% blks allocated to extents 64 blks or larger: 0.00

does it mean, its not ok ?


THnx!
Windows?, no thanks
Geoff Wild
Honored Contributor
Solution

Re: Online JFS defrag question

Depends on the file system - what is in it, how big?

Usually, that means it is fragmented....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: Online JFS defrag question

Or,

"so for example in a fs i have this?

% Free blocks in extents smaller than 64 blks: 0.03
% Free blocks in extents smaller than 8 blks: 0.00
% blks allocated to extents 64 blks or larger: 0.00
"

means there is nothing in the file system - IE - no data...

Example - I get the same on /var/adm/crash

blocks used for indirects: 0
% Free blocks in extents smaller than 64 blks: 0.00
% Free blocks in extents smaller than 8 blks: 0.00
% blks allocated to extents 64 blks or larger: 0.00


# bdf /var/adm/crash
Filesystem kbytes used avail %used Mounted on
/dev/vg01/lvol2 12582912 3686 12186134 0% /var/adm/crash

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
A. Clay Stephenson
Acclaimed Contributor

Re: Online JFS defrag question

If thousands of files are being created and removed from your filesystem then chances are that these are many relatively small files so that file defragmentation is hardly needed --- and you will not often see any measurable benefits --- and the overhead of defragging a very active filesystem is not trivial. In fact, the performance hit you take while defragging may swamp the actual gains from the defrag operation.

I would try to only reorganize directories. This may produce a gain in search times by removing all the "holes" in a directory. Even here, however, the contention in trying to lock a very busy directory may offset any gains if you defrag often.

You assume that the filesystem is the culprit. Have you actually verified this or are you applying Windows techniques/knowledge to a UNIX box?
If it ain't broke, I can fix that.
likid0
Honored Contributor

Re: Online JFS defrag question

ok, i see, as you say is an almost empty FS, any other thing you can look at to have an idea if the fs is defraged ?



In this part is better to have small free extents ?

Free Extents By Size
1: 36447 2: 19700 4: 15918
8: 6754 16: 3941 32: 1734
64: 1413 128: 1388 256: 1173
512: 708 1024: 327 2048: 268
4096: 179 8192: 97 16384: 42
32768: 51 65536: 44 131072: 21
262144: 12 524288: 3 1048576: 1
2097152: 0 4194304: 0 8388608: 0
16777216: 0 33554432: 0 67108864: 0
134217728: 0 268435456: 0 536870912: 0
1073741824: 0 2147483648: 0
Windows?, no thanks
likid0
Honored Contributor

Re: Online JFS defrag question

No, is not from windows, this application was hosted on a true64 machine, and there they used to defrag these FS, whith jfs is hardly ever a must to defrag, but just in case we are doing it, now we are having some problems whith the application that writes to this FS, and i just wantes to check,fragmentation is not and issue, but looking at the:

% blks allocated to extents 64 blks or larger: 0.56

it looks like it needs a defrag.

Extent Fragmentation Report
Total Average Average Total
Files File Blks # Extents Free Blks
4052496 4 1 58769968
blocks used for indirects: 70424
% Free blocks in extents smaller than 64 blks: 2.26
% Free blocks in extents smaller than 8 blks: 2.23
% blks allocated to extents 64 blks or larger: 0.56


We launch the defrag just once a week in a 6 hour window.

Thnx for the help

Windows?, no thanks
Patrick Wallek
Honored Contributor

Re: Online JFS defrag question

>>now we are having some problems

What kind of problems? Are you sure the problems are related to the file system? Have you looked at things other than file system fragmentation while troubleshooting these problems?
likid0
Honored Contributor

Re: Online JFS defrag question

yes, we are looking at all kind of things(net related, ndd parameters, problems on the origin box, where the files comes from).

I am looking at that fs, because i know thats where the application writes.

But i just wanted to check fragmetation, to get one thing out of the way, as you say it can be a lot more things.

But when i checked the defrag stats i realised, i didn't have a clue, if it was ok or not, thats why i asked.

thnx
Windows?, no thanks