Problem
How to estimate time and disk space requirements for collecting a metasave
Solution
This article is a part of a set on troubleshooting file system corruption. Click here to start at the beginning: https://www.veritas.com/docs/000017547 |
Table of Contents
Introduction
Size estimate
Time estimate
Introduction
(Back to top)
The metasave process reads through the metadata of a VxFS file system, processes through each individual inode entry. The amount of time that is required to create a metasave depends on how quickly the system can perform I/O reads, along with the overall level of system resources available (e.g. physical memory, cpu speed, etc.)
It is possible to estimate the time and size requrements for a metasave by using the "fsadm -DE" command. This utility reads the same metadata as those read by the metasave process. As a result, the time required to run both utilities should be similar.
Note: Significant levels of file system corruption may affect time and size estimates. For example, if the metadata contains inode that incorrectly references an extent that is impossibly large (as a result of corruption) the metasave could be significantly larger than the estimate. Either monitor the metasave output, as it takes place, or direct the output file to a non-critical volume to avoid the possibility of filling up a critical volume.
Size estimate
(Back to top)
Basically the size of the metasave output will the sum of following.
1. The sum of the sizes of all structural inodes in fileset 1
2. Directory blocks in all filesets (file system checkpoint)
3. Indirect blocks used in the extent maps of all the files and directories in all filesets
Item 1 can be obtained by running the shell script "metasize" in the attachment section of this acticle. Basically, the "metasize" reads all the inodes in the fileset 1, eliminates the redundant copies (matchino) and sums up the blocks used by each inode.
Figure 1
# ./metasize /dev/vx/rdsk/adg/volfrag Total space used by all 1fset inodes: 444554 FS blocks, FS block size 1024 444554 KB 434 MB |
Items 2 and 3 can be obtained from the 'fsadm -DE" output.
Figure 2 - Using /opt/VRTS/bin/fsadm with the native time command
Syntax: time /opt/VRTS/bin/fsadm -DE /<mountpoint> Example, with typical output: # time /opt/VRTS/bin/fsadm -DE /fragmented Directory Fragmentation Report Dirs Total Immed Immeds Dirs to Blocks to Searched Blocks Dirs to Add Reduce Reduce total 1144 24635 9 0 0 0 File System Extent Fragmentation Report Free Space Fragmentation Index : 5 File Fragmentation Index : 78 # Files Fragmented by Fragmentation Index 0 1-25 26-50 51-75 76-100 1145272 558 1 566 2 Total Average Average Total Files File Blks # Extents Free Blks 1146399 2723 2156 646194 blocks used for indirects: 42968 % Free blocks in extents smaller than 64 blks: 0.01 % Free blocks in extents smaller than 8 blks: 0.00 % blks allocated to extents 64 blks or larger: 19.04 Free Extents By Size 1: 2 2: 2 4: 1 8: 1 16: 0 32: 1 64: 0 128: 0 256: 0 512: 0 1024: 1 2048: 1 4096: 1 8192: 0 16384: 1 32768: 1 65536: 1 131072: 0 262144: 0 524288: 1 1048576: 0 2097152: 0 4194304: 0 8388608: 0 16777216: 0 33554432: 0 67108864: 0 134217728: 0 268435456: 0 536870912: 0 1073741824: 0 2147483648: 0 real 0m51.301s user 0m0.608s sys 0m1.415s The reported numbers are in file system blocks. The file system block size can be obtained by running the "fstyp" command. /opt/VRTS/bin/fstyp -v <volume device> For example, # /opt/VRTS/bin/fstyp -v /dev/vx/rdsk/adg/volfrag | grep bsize bsize 1024 size 4194304 dsize 4194304 ninode 0 nau 0 <<< bsize is 1024 bytes (1KB) Note: Notice the time statistics that are provided
|
The estimated size of the metasave output can be obtained by summing up the 3 items. In the above example, we have the following.
- The sum of the sizes of all structural inodes in fileset 1 = 434.0 MB
- Directory blocks in all filesets (Directory Total Blocks) = 24.6 MB
- Indirect blocks used in the extent maps = 43.0 MB
- The estimated size of the metasave output will be 434.0 + 24.6 + 43.0 = 501.6 MB
The following is the actual size of the metasave output.
# du -sk metadata.fragmented
505012 metadata.fragmented
Time estimate
(Back to top)
Use the native command "time" with "fsadm -dE" to emulate the process of a metasave.
For the above example in Figure 2, one can estimate that the metasave process will take approximately 51 seconds.
Figure 3
# time /opt/VRTS/bin/fsadm -DE /fragmented ... real 1m21.686s |
For real time monitoring of the metasave process, we can divide the estimated size of the metasave output by the I/O rate of the volume. For example, the following vxstat command will display the number of volume blocks (512 bytes) read per 5 seconds. By dividing the number of blocks read by 2 (blocks per KB), it gives the number of KB read per 5 seconds. Further dividing the previous result by 5 seconds will give us the read rate per second. For example, 63616 means 6361 KB/s or 6.3 MB/s.
Figure 4
# vxstat -i 5 -g adg -v volfrag OPERATIONS BLOCKS AVG TIME(ms) TYP NAME READ WRITE READ WRITE READ WRITE rhel7vm10 Fri 14 Oct 2016 12:42:30 PM AEDT vol volfrag 3976 0 63616 0 1.23 0.00 rhel7vm10 Fri 14 Oct 2016 12:42:35 PM AEDT vol volfrag 3867 0 61872 0 1.27 0.00 rhel7vm10 Fri 14 Oct 2016 12:42:40 PM AEDT vol volfrag 4095 0 65520 0 1.20 0.00 |
Now, divide the estimated size of the metasave output by 6 MB per second. It gives us an estimated run time of the metasave process. Continuing with the above example:
Figure 5
Estimated size of the metasave output / I/O rate of the the volume = 501.6 MB / 6 MB/sec = 83 seconds |