Operating System - HP-UX
1832609 Members
2569 Online
110043 Solutions
New Discussion

Re: Oneline JFS defragmentation

 
SOLVED
Go to solution
Felix Maurer
Occasional Advisor

Oneline JFS defragmentation

I'm actually trying to defragment a FS. I tried both to perform the defrag. during production and after stopping the applications. In both cases I can't see a big change on the fragmentation (see attachment). I can use any number of pass I want.

I'm using the following command line:

fsadm -F vxfs -p 20 -v -s -de /filesystem

Do I have wrong expectations?

Thanks in advance for any hints.

Felix
10 REPLIES 10
Bill McNAMARA_1
Honored Contributor

Re: Oneline JFS defragmentation

I don't see a lot of defragmentation in your
case. There are not many free blocks in small
extents.

% Free blocks in extents smaller than 64 blks: 1.95
% Free blocks in extents smaller than 8 blks: 0.35
% blks allocated to extents 64 blks or larger: 86.01

What was it like before.
What is your file system like.. lots of small
text files, lots of big binaries? What kind
of fragmentation do you expect?

Later,
Bill
It works for me (tm)
Felix Maurer
Occasional Advisor

Re: Oneline JFS defragmentation

I did a restore on an other disk and this give me the result in the attachment.

Maybe I'm miss-interpreting the difference, but it seems to me that I have much less contigous space on the previous report?
Bill McNAMARA_1
Honored Contributor

Re: Oneline JFS defragmentation

they're pretty much the same...
I guess you can't expect miracles and
get it to be identical!
How often do you run the defragmentation?

Later,
Bill
It works for me (tm)
Bill McNAMARA_1
Honored Contributor
Solution

Re: Oneline JFS defragmentation

FYI
http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B3929-90011/B3929-90011_top.html&con=/hpux/onlinedocs/B3929-90011/00/00/18-con.html&toc=/hpux/onlinedocs/B3929-90011/00/00/18-toc.html&searchterms=fsadm&queryid=20010316-052424


Monitoring Fragmentation

Fragmentation reduces performance and availability. Regular use of fsadm's fragmentation reporting and reorganization facilities is therefore advisable.

The easiest way to ensure that fragmentation does not become a problem is to schedule regular defragmentation runs from cron.

Defragmentation scheduling should range from weekly (for frequently used file systems) to monthly (for infrequently used file systems). Extent fragmentation should be monitored with fsadm_vxfs(1M) or the -o s options of df_vxfs(1M). There are three factors which can be used to determine the degree of fragmentation:

percentage of free space in extents of less than eight blocks in length


percentage of free space in extents of less than 64 blocks in length


percentage of free space in extents of length 64 blocks or greater
An unfragmented file system will have the following characteristics:

less than 1 percent of free space in extents of less than eight blocks in length


less than 5 percent of free space in extents of less than 64 blocks in length


more than 5 percent of the total file system size available as free extents in lengths of 64 or more blocks
A badly fragmented file system will have one or more of the following characteristics:

greater than 5 percent of free space in extents of less than 8 blocks in length


more than 50 percent of free space in extents of less than 64 blocks in length
less than 5 percent of the total file system size available as free extents in lengths of 64 or more blocks
The optimal period for scheduling of extent reorganization runs can be determined by choosing a reasonable interval, scheduling fsadm runs at the initial interval, and running the extent fragmentation report feature of fsadm before and after the reorganization.

The "before" result is the degree of fragmentation prior to the reorganization. If the degree of fragmentation is approaching the figures for bad fragmentation, then the interval between fsadm runs should be reduced. If the degree of fragmentation is low, the interval between fsadm runs can be increased.

The "after" result is an indication of how well the reorganizer is performing. The degree of fragmentation should be close to the characteristics of an unfragmented file system. The file system may be a candidate for expansion. (Full file systems tend to fragment and are difficult to defragment.) It is also possible that the reorganization is not being performed at a time during which the file system in question is relatively idle.

Directory reorganization is not nearly as critical as extent reorganization, but regular directory reorganization will improve performance. It is advisable to schedule directory reorganization for file systems when the extent reorganization is scheduled. The following is a sample script that is run periodically at 3:00 A.M. from cron for a number of file systems:

outfile=/tmp/fsadm_out.&212#;/bin/date +'%m%d'&212#;
for i in /home /home2 /project /db
do
/bin/echo "Reorganizing $i"
/bin/timex fsadm -F vxfs -e -E -s $i
/bin/timex fsadm -F vxfs -s -d -D $i
done > $outfile 2>&1

--------------------------------------------------------------------------------
It works for me (tm)
Felix Maurer
Occasional Advisor

Re: Oneline JFS defragmentation

Thanks a lot for the previous answers, it helped me a lot to anderstand the HP defrag.

I have some more questions regarding defragmentation experiences.

Would you make it running on all file systems? And is there any risk of data?

Felix
Bill McNAMARA_1
Honored Contributor

Re: Oneline JFS defragmentation

I would only really run it on filesystems
that are under heavy usage.. and where defragmentation will actually result in a significant performance improvement.

I have heard of some troubles such as
entire directory trees vanishing after a defrag, but the problem was related to a bad CPU rather than OnlinJFS.

If you go to the search here in the ITRC and search for JFS patches you can find out if there is any critically important patches to install OnlineJFS related by looking at your current version and seeing in the patch release notes what bugs have been fixed.

I suggest doing a backup before defragging
just in case...

Later,
Bill
It works for me (tm)
Felix Maurer
Occasional Advisor

Re: Oneline JFS defragmentation

I'm still having one problem. The main reason why I want defragment is because I want to reduce the size of a partition. Unfortunatly even after the defragmentation, I still cant reduce the filesystem:

fsadm -F vxfs -b 700000 /swcom >> t.t
fsadm: cannot shrink /dev/vg00/rswcom - upgraded fs - inodes are currently in use.

Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 204800 89465 108172 45% /
/dev/vg00/lvol1 99669 27622 62080 31% /stand
/dev/vg00/lvol7 770048 569710 188905 75% /var
/dev/vg00/lvol6 614400 486277 120136 80% /usr
/dev/vg00/lvol5 614400 2042 574860 0% /tmp
/dev/vg00/lvol4 1536000 410959 1055979 28% /opt
/dev/vg00/lvol8 102400 1610 94492 2% /home
/dev/vg00/swcom 8000000 3450978 4274419 45% /swcom

I would expect that the free space is being contigous, so that the partition could reduced?

Felix
Bill McNAMARA_1
Honored Contributor

Re: Oneline JFS defragmentation

You're missing a zero..
just note also that the units are different
between an lvdisplay and the bdf output.
You need to divide/multiply by 512.

Later,
Bill
It works for me (tm)
Felix Maurer
Occasional Advisor

Re: Oneline JFS defragmentation

You are right, but the 0 is just missing in my note, not in the command I used. Adding one 0 give the same result, and that's what I'm complaining about.
Mike Mayer
Occasional Advisor

Re: Oneline JFS defragmentation

Looking at the defragmentation issue, and perhaps this is a well-asked question: Can you run defragmentation (via the fsadmin command or other available utility) on an HFS file system? If so, can it be done "live" like on a vxfs filesystem (with Online JFS), or does it have to be unmounted?

Are there any 3rd party utilities that can do defrag on an HFS file system, whether live or offline?
System Administrator