source: gpfs_3.1_ker2.6.20/lpp/mmfs/samples/debugtools/filehist @ 91

Last change on this file since 91 was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/ksh
2#
3# Usage : filehist
4#
5# Shell script will process required environment variables and
6# analyze GPFS filesystems which are mounted
7#
8
9PATH=/tmp/mmfs:/usr/lpp/mmfs/bin:/usr/lpp/mmfs/samples/util:/usr/lpp/mmfs/samples/debugtools:/usr/sbin:/bin:$PATH
10#check for required commands
11if ! which tsinode 1>/dev/null
12then
13  print "filehist: tsinode not found. Run 'make tsinode' in /usr/lpp/mmfs/samples/util"
14  return 1
15fi
16if ! which tsfilehist.awk 1>/dev/null
17then
18  print "filehist: /usr/lpp/mmfs/samples/debugtools/tsfilehist.awk not found"
19  return 2
20fi
21
22#get mount points for GPFS filesystems
23opsys=$(uname -s)
24if [[ $opsys = AIX ]]; then
25  mtpts=$(mount|awk '$3 == "mmfs" {print $2":"substr($1,6)}')
26elif [[ $opsys = Linux ]]; then
27  mtpts=$(mount|awk '$5 == "gpfs" {print $3":"substr($1,6)}')
28else
29  print "$opsys not AIX or Linux"
30  return 1
31fi
32echo "Getting file histogram for: $mtpts"
33
34#get free space, blocksize of the filesystem, and nsd's
35for mf in $mtpts; do
36  mp=${mf%:*}; fs=${mf#*:}
37  df=$(df -k $mp | tail -1 | awk '{print $2 "k"}')
38  blksz=$(tslsfs $fs -B | tail -1 | awk '{print $2/1024}')
39  diskls="$(tslsdisk $fs -i 2>/dev/null)"
40  integer disks=$(echo "$diskls"| wc -l)
41  let bk=disks
42  let bk4m=4096/blksz
43  [[ $bk -lt $bk4m ]] && bk=$bk4m
44  [[ $bk -lt 100 ]] && bk=100
45  echo "Writing output to $fs.filesum "
46  echo "=======================\n$fs: $(hostname) $(date)\n=======================\n" > $fs.filesum
47  df -k $mp >> $fs.filesum
48  echo "\n" >> $fs.filesum
49  mmlsfs $fs >> $fs.filesum
50  echo "\n\n$diskls\n\n" >> $fs.filesum
51  echo "Background: tsinode $mp | tsfilehist.awk availablespace=$df nbuckets=$bk blocksize=$blksz"
52  tsinode $mp | tsfilehist.awk availablespace=$df nbuckets=$bk blocksize=$blksz >> $fs.filesum &
53
54done
55echo "Waiting for background processes to complete"
56wait
Note: See TracBrowser for help on using the repository browser.