| 1 | Disclaimers | 
|---|
| 2 | ----------- | 
|---|
| 3 |  | 
|---|
| 4 | The files in this directory are provided by IBM on an "AS IS" basis | 
|---|
| 5 | without warranty of any kind. | 
|---|
| 6 |  | 
|---|
| 7 |  | 
|---|
| 8 | Introduction | 
|---|
| 9 | ------------ | 
|---|
| 10 |  | 
|---|
| 11 | The files in this directory contain generally useful utilities that use | 
|---|
| 12 | GPFS specific APIs to scan filesystem metadata.  The source code is provided | 
|---|
| 13 | to give examples of how to use some of the APIs.  Execution of these commands | 
|---|
| 14 | requires root authority. | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | Utilities | 
|---|
| 18 | --------- | 
|---|
| 19 | tsgetusage   - Fast scan of all files in a filesystem and calculate how | 
|---|
| 20 | much disk space is used by each unique user and/or group. | 
|---|
| 21 |  | 
|---|
| 22 | tsinode      - Fast scan of all files in a filesystem and display one line | 
|---|
| 23 | of ls information about each one. | 
|---|
| 24 |  | 
|---|
| 25 | tslistall    - Fast scan of all files in a filesystem and display one line | 
|---|
| 26 | of inodenumber pathname type ctime mtime | 
|---|
| 27 |  | 
|---|
| 28 | tsfindinode  - Fast parallel scan of all directories in a filesystem | 
|---|
| 29 | listing inodenumber type pathname for each inode specified | 
|---|
| 30 |  | 
|---|
| 31 | tsreaddir    - Fast parallel scan of all directories in a filesystem | 
|---|
| 32 | listing inodenumber type pathname for each file | 
|---|
| 33 | (used by tslistall) | 
|---|
| 34 |  | 
|---|
| 35 | tstimes      - Fast scan of all files in a filesystem and display one line | 
|---|
| 36 | of inode mtime ctime for each file | 
|---|
| 37 | (used by tslistall) | 
|---|
| 38 |  | 
|---|
| 39 | tsbackup     - Fast parallel backup utility using multiple TSM clients | 
|---|
| 40 | and a single TSM server.  Parallelism is achieved via | 
|---|
| 41 | the use of multi-threading and the use of multiple TSM | 
|---|
| 42 | client processes.  This utility makes use of the GPFS | 
|---|
| 43 | inode scan APIs. | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | ------------------------------------------------------------------------------ | 
|---|
| 47 |  | 
|---|
| 48 | tsgetusage   - Fast scan of all files in a filesystem and calculate how | 
|---|
| 49 | much disk space is used by each unique user and/or group. | 
|---|
| 50 |  | 
|---|
| 51 | Usage:  tsgetusage [-g][-h][-q][-v][-u][-H hashTableSize] fsPath | 
|---|
| 52 |  | 
|---|
| 53 | where:  fsPath  path to file system | 
|---|
| 54 | -u      outputs data in diskusg format for acctdisk | 
|---|
| 55 | -g      collect stats for groups | 
|---|
| 56 | -H      sets the hash table size (default 1027) | 
|---|
| 57 | -h      prints this message | 
|---|
| 58 | -q      outputs only the resulting stats | 
|---|
| 59 | -v      print information about each file | 
|---|
| 60 |  | 
|---|
| 61 | Using the -u option will produce a file with a format like | 
|---|
| 62 | /usr/sbin/acct/diskusg that is used for other types of filesystems. | 
|---|
| 63 | This can be used as input to the /usr/sbin/acct/acctdisk program, and then | 
|---|
| 64 | merged with the other disk accounting data using /usr/sbin/acct/acctmerg. | 
|---|
| 65 |  | 
|---|
| 66 | For more information about the AIX Accounting System, the preparation | 
|---|
| 67 | of daily and monthly reports, and the accounting files, see the AIX | 
|---|
| 68 | Accounting Overview. | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 | ------------------------------------------------------------------------------ | 
|---|
| 72 |  | 
|---|
| 73 | tsinode      - Fast scan of all files in a filesystem and display one line | 
|---|
| 74 | of information about each one. | 
|---|
| 75 |  | 
|---|
| 76 | Usage:  tsinode fsPath [startinode [endinode]] | 
|---|
| 77 |  | 
|---|
| 78 | where:  fsPath      path to file system | 
|---|
| 79 | startinode  first inode number to be listed | 
|---|
| 80 | endinode    last inode number to be listed | 
|---|
| 81 |  | 
|---|
| 82 | Hint: | 
|---|
| 83 | For the best performance on a filesystem with millions of inodes, | 
|---|
| 84 | run several copies of tsinode with different inode ranges and | 
|---|
| 85 | concatenate the output files. | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 | ------------------------------------------------------------------------------ | 
|---|
| 89 |  | 
|---|
| 90 | tsfindinode  - Fast parallel scan of all directories in a filesystem | 
|---|
| 91 | listing: inodenumber pathname | 
|---|
| 92 |  | 
|---|
| 93 | Usage:  tsfindinode {-i {inum | inumfile}} [-t nThreads] [--] fsPath | 
|---|
| 94 |  | 
|---|
| 95 | where:  fsPath       path to file system | 
|---|
| 96 | -i inum      adds one inode number to the list | 
|---|
| 97 | (this can be used multiple times) | 
|---|
| 98 | -i inumfile  names a file containing inode numbers | 
|---|
| 99 | to be added to the list | 
|---|
| 100 | (this can be used multiple times) | 
|---|
| 101 | -t           set the number of threads (default = 16) | 
|---|
| 102 | --           marker so that names starting with "-" | 
|---|
| 103 | are not treated like options. | 
|---|
| 104 |  | 
|---|
| 105 | This program recursively traverses the directory structure to list all | 
|---|
| 106 | accessible files and directories in the file system whose inode numbers | 
|---|
| 107 | match those specified in the list of inodes.  Each file prints one line | 
|---|
| 108 | on stdout containing the file's inode number, and the pathname to the | 
|---|
| 109 | file.  The number and names are separated by a tab character. | 
|---|
| 110 | The starting directory is listed with the pathname given as the argument. | 
|---|
| 111 | All other lines have pathnames relative to the starting directory. | 
|---|
| 112 |  | 
|---|
| 113 | The program uses the GPFS directory scan interface to quickly read the | 
|---|
| 114 | directory entries without calling "stat" on each file.  The directories | 
|---|
| 115 | are scanned in parallel by multiple threads which results in an unsorted | 
|---|
| 116 | output file.  Inode numbers that are not found in the tree are printed to | 
|---|
| 117 | stderr with the name "(notfound)". | 
|---|
| 118 |  | 
|---|
| 119 | Example: | 
|---|
| 120 |  | 
|---|
| 121 | >tsfindinode -i 23612 -i 1452 -i 47666 /gpfs | 
|---|
| 122 | 23612  include/stdio.h | 
|---|
| 123 | 1452  include/curses.h | 
|---|
| 124 | 47666  (notfound) | 
|---|
| 125 | > | 
|---|
| 126 |  | 
|---|
| 127 |  | 
|---|
| 128 | ------------------------------------------------------------------------------ | 
|---|
| 129 |  | 
|---|
| 130 | tslistall    - Fast scan of all files in a filesystem and display one line | 
|---|
| 131 | per file with the following information: | 
|---|
| 132 | inodenumber/generation mtime ctime type pathname | 
|---|
| 133 |  | 
|---|
| 134 | Usage:  tslistall fsPath  [tmpdirname] | 
|---|
| 135 |  | 
|---|
| 136 | where:  fsPath      path to file system | 
|---|
| 137 | tmpdirname  is a directory where intermediate files for sort | 
|---|
| 138 | can be generated. The default directory id /tmp. | 
|---|
| 139 | This is necessary for GPFS filesystem that have | 
|---|
| 140 | large numbers of files. | 
|---|
| 141 |  | 
|---|
| 142 | This is a shell script that invokes tsreaddir and tstimes | 
|---|
| 143 | then merges the resulting files.  The output is printed to stdout | 
|---|
| 144 | with 1 line per file and is sorted by inode number. | 
|---|
| 145 |  | 
|---|
| 146 | By saving the output of this command, you can compare it with a later list | 
|---|
| 147 | to find out what has changed in the filesystem since the old list was made. | 
|---|
| 148 |  | 
|---|
| 149 | Example: | 
|---|
| 150 |  | 
|---|
| 151 | >tslistall /gpfs | 
|---|
| 152 | 0000000003/0000000001 1012390401.913049600  1012390401.913049600  DIR /gpfs | 
|---|
| 153 | 0000001452/0000000003 1024702059.694025000  1024702059.694025000  LNK include/curses.h | 
|---|
| 154 | 0000001812/0000000000 1024702015.294047000  1024702015.294047000  DIR include | 
|---|
| 155 | 0000019578/0000000000 1026797433.109149000  1026794560.584238000  REG mail.rc | 
|---|
| 156 | 0000023612/0000000017 1024702090.705801000  1024702090.705801000  REG include/stdio.h | 
|---|
| 157 | 0000023874/0000000000 1024702024.982645000  1024702024.982645000  REG include/string.h | 
|---|
| 158 | > | 
|---|
| 159 |  | 
|---|
| 160 |  | 
|---|
| 161 | ------------------------------------------------------------------------------ | 
|---|
| 162 |  | 
|---|
| 163 | tsreaddir    - Fast parallel scan of all directories in a filesystem | 
|---|
| 164 | listing inodenumber type pathname | 
|---|
| 165 |  | 
|---|
| 166 | Usage:  tsreaddir [-d] [-n] [-t nThreads] [--] fsPath | 
|---|
| 167 |  | 
|---|
| 168 | where:  fsPath  path to file system | 
|---|
| 169 | -d      list only directories. | 
|---|
| 170 | -n      do not list directories. | 
|---|
| 171 | -t      set the number of threads (default = 16) | 
|---|
| 172 | --      marker so that names starting with "-" | 
|---|
| 173 | are not treated like options. | 
|---|
| 174 |  | 
|---|
| 175 | This program recursively traverses the directory structure | 
|---|
| 176 | to list all accessible files and directories in the file system. | 
|---|
| 177 | Each file prints one line on stdout containing the file's inode number, | 
|---|
| 178 | the generation number, the file's type and the pathname | 
|---|
| 179 | to the file.  The fields are separated by tab characters. | 
|---|
| 180 | If directories are listed, the starting directory is listed with | 
|---|
| 181 | the pathname given as the argument.  All other lines have pathnames | 
|---|
| 182 | relative to the starting directory. | 
|---|
| 183 |  | 
|---|
| 184 | The file types are "DIR" for directories, "REG" for regular | 
|---|
| 185 | files, "LNK" for symbolic links and "UNK" for all others. | 
|---|
| 186 | If the -d option is specified only directories are listed, | 
|---|
| 187 | and if the -n option is specified directories are not included in | 
|---|
| 188 | the output list. | 
|---|
| 189 |  | 
|---|
| 190 | The program uses the GPFS directory scan interface to quickly read the | 
|---|
| 191 | directory entries without calling "stat" on each file.  The directories | 
|---|
| 192 | are scanned in parallel by multiple threads which results in an unsorted | 
|---|
| 193 | output file. | 
|---|
| 194 |  | 
|---|
| 195 | Example: | 
|---|
| 196 |  | 
|---|
| 197 | >tsreaddir /gpfs | 
|---|
| 198 | 0000000003/0000000001 DIR /gpfs | 
|---|
| 199 | 0000001812/0000000000 DIR include | 
|---|
| 200 | 0000023612/0000000017 REG include/stdio.h | 
|---|
| 201 | 0000023874/0000000000 REG include/string.h | 
|---|
| 202 | 0000001452/0000000003 LNK include/curses.h | 
|---|
| 203 | 0000019578/0000000000 REG mail.rc | 
|---|
| 204 | > | 
|---|
| 205 |  | 
|---|
| 206 |  | 
|---|
| 207 | ------------------------------------------------------------------------------ | 
|---|
| 208 |  | 
|---|
| 209 | tstimes      - Fast scan of all files in a filesystem and display one line | 
|---|
| 210 | of inode mtime ctime for each file | 
|---|
| 211 |  | 
|---|
| 212 | Usage:  tstimes fsPath | 
|---|
| 213 |  | 
|---|
| 214 | where:  fsPath  path to file system | 
|---|
| 215 |  | 
|---|
| 216 | This program performs a gpfs inode scan on the specified file system | 
|---|
| 217 | to obtain the mtime and ctime for each file.  The results are output | 
|---|
| 218 | on stdout, with one line per file containg the inode number, the | 
|---|
| 219 | generation number, the mtime seconds and nanoseconds GMT, and the ctime seconds | 
|---|
| 220 | and nanoseconds GMT.  The output file is sorted by the inode numbers. | 
|---|
| 221 | The fields are separated by tab characters. | 
|---|
| 222 |  | 
|---|
| 223 | Example: | 
|---|
| 224 |  | 
|---|
| 225 | >tstimes /gpfs | 
|---|
| 226 | 0000000003/0000000001   1012390401.913049600    1012390401.913049600 | 
|---|
| 227 | 0000001452/0000000003 1024702059.694025000  1024702059.694025000 | 
|---|
| 228 | 0000001812/0000000000 1024702015.294047000  1024702015.294047000 | 
|---|
| 229 | 0000019578/0000000000 1026797433.109149000  1026794560.584238000 | 
|---|
| 230 | 0000023612/0000000017 1024702090.705801000  1024702090.705801000 | 
|---|
| 231 | 0000023874/0000000000 1024702024.982645000  1024702024.982645000 | 
|---|
| 232 | > | 
|---|
| 233 |  | 
|---|
| 234 |  | 
|---|
| 235 | ------------------------------------------------------------------------------ | 
|---|
| 236 |  | 
|---|
| 237 | mmbackup/tsbackup (see documentation for mmbackup in the GPFS Admin Guide) | 
|---|
| 238 |  | 
|---|
| 239 | tsbackup     - Fast parallel backup utility using multiple TSM clients | 
|---|
| 240 | and a single TSM server.  Parallelism is achieved via | 
|---|
| 241 | the use of multi-threading and the use of multiple TSM | 
|---|
| 242 | client processes.  This utility makes use of the GPFS | 
|---|
| 243 | inode scan APIs. | 
|---|
| 244 |  | 
|---|
| 245 | Usage: | 
|---|
| 246 | mmbackup Device -n ControlFile [-t {full | incremental}] [-r IOrate] | 
|---|
| 247 | or | 
|---|
| 248 | mmbackup Device -R [-r IOrate] | 
|---|
| 249 |  | 
|---|
| 250 | Parts: | 
|---|
| 251 |  | 
|---|
| 252 | tsbackup.C       (sample code in this directory) | 
|---|
| 253 | tsbackup.h       (sample code in this directory) | 
|---|
| 254 | mmbackup.sh      (script in /usr/lpp/mmfs/bin) | 
|---|
| 255 | mmexectsmcmd.sh  (script in /usr/lpp/mmfs/bin) | 
|---|
| 256 |  | 
|---|