Operating System - OpenVMS
1752708 Members
5894 Online
108789 Solutions
New Discussion юеВ

How to see the disk's fragment status or file's fragment

 
SOLVED
Go to solution
skynet1980
Occasional Advisor

How to see the disk's fragment status or file's fragment

Hi,
Is there any command that can see disk's fragment status or file's fragment?
4 REPLIES 4
Hein van den Heuvel
Honored Contributor
Solution

Re: How to see the disk's fragment status or file's fragment


The HP Defrag tool DFO has a free reporting functions.

Personally I would recommend picking up the DFU freeware tool. It is a must have for disk/file management with fragmentation reports and file search based on fragments, and extent-headers and more.

For trivial/simple single file fragmenation analysis just use DUMP/HEADER/BLOCK=COUNT=0

Good luck,
Hein.
Wim Van den Wyngaert
Honored Contributor

Re: How to see the disk's fragment status or file's fragment

or use this .com to report it (slowly).

Wim
Wim
Robert Gezelter
Honored Contributor

Re: How to see the disk's fragment status or file's fragment

skynet1980,

The DUMP/HEADER command will display the file header for an individual file, with complete information about the mapping pointers about which blocks (LBNs) on the disk are used by the file.

- Bob Gezelter, http://www.rlgsc.com
Hein van den Heuvel
Honored Contributor

Re: How to see the disk's fragment status or file's fragment

For your entertainment...
On the DUMP/HEAD, and processing the data.
Here is some more playing with perl:

One liner for 1 file, avoiding 2 temp files:

$ pipe DUMP/HEAD/BLOC=COUNT=0 test.mai | perl -ne "$frag++ if /^\s+Count:/; print ""$frag fragments\n"" if eof"


Script with args globbed from command line:
-------------------------------
while ($file=shift @ARGV) {
$frag = 0;
foreach (`DUMP/HEAD/BLOC=COUNT=0 $file`) {
$frag++ if /^\s+Count:/
}
print "$frag fragments in $file\n";
}


Please note the the wildcard file expansion is done before the script runs. This is often helpful, but actually tricky to avoid. One has to protect the wildcards with strong (') or double-double quotes to stop the help, and later strip those.

Script with args explicitly processed
-------------------------------
while ($files = shift @ARGV) {
# print "--$files\n"
$files =~ s/"|'//g; # strip quotes
while ( $file = glob $files ) {
$frag = 0;
foreach (`DUMP/HEAD/BLOC=COUNT=0 $file`) {
$frag++ if /^\s+Count:/
}
print " $frag fragments in $file\n";
}
}


Sample of ugly quote usage:
perl frags.pl """[...]*.mai""" *.log "'*.tmp'"

Hein.