{"id":3666,"date":"2023-02-15T08:56:44","date_gmt":"2023-02-15T08:56:44","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=3666"},"modified":"2023-02-15T08:56:44","modified_gmt":"2023-02-15T08:56:44","slug":"bash-storage-check-script-and-load-generator","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=3666","title":{"rendered":"BASH Storage Check Script and Load Generator"},"content":{"rendered":"\n<p>Sometimes it is helpful just to get a script running on a machine to generate some disk IO load. I use this for two main reasons, one is during the testing or proving of a storage platform in terms of its availability during a fail-over or maintenance situation (e.g. it&#8217;s storage processors), the other is to generate some random storage IO to see performance impact (often with multiple machines at once). <\/p>\n\n\n\n<p>The script is very simple, just put it onto a Linux machine, add execute permissions with &#8220;chmod u+x&#8221; and then run with the command, where in this case &#8220;\/tmp\/test&#8221; is the location where the script will generate a load of random test files as it runs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>check_disk \/tmp\/test<\/code><\/pre>\n\n\n\n<p>The script is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\r\n\r\n\rnfsv3_path=$1\r\n\r\nwhile :\r\ndo\r\n        date\r\n\r\n        for n in {1..1000}; do\r\n          echo -n \"Creating a random file called random.img.\"$n\" in \"$nfsv3_path\".....\"\r\n          dd if=\/dev\/urandom of=$nfsv3_path\/random.img.$n count=100 bs=8K\r\n        echo \"Done!\"\r\ndone\r\n        sleep 1\r\n        echo \"Deleting the random files....\"\r\n        rm $nfsv3_path\/random.img.*\r\n\r\n        sleep 1\r\ndone\r<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes it is helpful just to get a script running on a machine to generate some disk IO load. I use this for two main reasons, one is during the testing or proving of a storage platform in terms of its availability during a fail-over or maintenance situation (e.g. it&#8217;s storage processors), the other is &#8230; <a title=\"BASH Storage Check Script and Load Generator\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=3666\" aria-label=\"Read more about BASH Storage Check Script and Load Generator\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,20],"tags":[],"class_list":["post-3666","post","type-post","status-publish","format-standard","hentry","category-linux","category-random"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3666"}],"version-history":[{"count":2,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3666\/revisions"}],"predecessor-version":[{"id":3668,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3666\/revisions\/3668"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}