My scheduled collection of statistics is giving very large output because of an high number of ssd device not associated to any disk
The iostat -x command is collecting statistics from them and the output is very large.
I.g.
if a run
iostat -x|tail +3|awk '{print $1}'>f0.txt.$$
iostat -nx|tail +3|awk '{print "/dev/dsk/"$11}'>f1.txt.$$
paste -d= f[01].txt.$$ > assoc.txt
then in assoc.txt I find not only rows like
ssd5=/dev/dsk/c8t6005076309FFC3E40000000000000006d0
but also many rows as
ssd3220=/dev/dsk/ssd3220
ssd3221=/dev/dsk/ssd3221
an the output is plenty of statistics about device that not really exists
iostat -x ssd3220
extended device statistics
device r/s w/s kr/s kw/s wait actv svc_t %w %b
ssd3220 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
How can I delete such ssd ?
use the -z option. This example assumes those dummy devices do no I/O and you do not want the first "run" of iostat which shows activity averaged over time since boot:
iostat -zx 2 5 | awk '/svc_t/ {cnt++} cnt>1' > file2keep
Otherwise create a file that lists the ones you do not want:
iostat -x | grep -vf excludefile
Example excludefile:
ssd19
ssd21
ssd44
ssd77
1 Like
You might want to clean the disk device map with:
devfsadm -C -c disk -v
2 Likes
It's useful, but I cannot change collecting scripts
---------- Post updated at 01:46 PM ---------- Previous update was at 01:44 PM ----------
I've already changed device map with devfsadm, but dummy devices are still there
So you are saying that you have giant input files, and cannot do anyhting change how they are created. That would have been nice to know earlier.
- generate a list of ssd devices that are useless to you. Call the file exclude.txt
- use nawk on the two files, exclude.txt and giant.txt
nawk 'FILENAME=="exclude.txt" {arr[$0]=1;next}
FILENAME=="giant.txt" { if($1 in arr)
{next}
else
{print $0}
} ' exclude.txt giant.txt > reportfile
Note: the order of file names on the command is required: exclude.txt comes first.
I'm afraid I can't apply this workaround
giant ouput files are not in ascii format (it's the output of sadc command)
what I'm looking for is a way to exclude such ghost devices from any system check (without restarting the system)