{"id":10551,"date":"2021-08-09T06:49:37","date_gmt":"2021-08-08T20:49:37","guid":{"rendered":"https:\/\/nsrd.info\/blog\/?p=10551"},"modified":"2021-08-09T06:49:41","modified_gmt":"2021-08-08T20:49:41","slug":"networker-basics-virtual-machine-change-rates","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2021\/08\/09\/networker-basics-virtual-machine-change-rates\/","title":{"rendered":"NetWorker Basics \u2013 Virtual Machine Change Rates"},"content":{"rendered":"\n<p>If you&#8217;re doing image-based backups of virtual machines, it&#8217;s useful to see the actual change rate of those virtual machines. After all, in typical scenarios, NetWorker only needs to look at and backup the data that&#8217;s changed from one backup to the next. <\/p>\n\n\n\n<p>For example, if you have a thousand virtual machines averaging 200 GB each, your daily changed data could be:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>1% average daily change rate: 2 TB<\/li><li>2% average daily change rate: 4 TB<\/li><li>5% average daily change rate: 10 TB<\/li><\/ul>\n\n\n\n<p>Of course, change rates vary from virtual machine to virtual machine, particularly based on what sort of workload is running inside. A VM hosting a database will typically see a much higher daily change rate than a VM hosting an application or filesystem. There are ways of interrogating virtual machine change rates through various VMware tools, but two challenges can occur here:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What if, as the NetWorker administrator, you don&#8217;t have access to run those tools, and<\/li><li>What if the tool reports data written rather than change rate?<\/li><\/ul>\n\n\n\n<p>There&#8217;s a big difference of course between the amount of data written to a virtual machine in a 24 hour period and the <em>change rate <\/em>for it as far as a backup is concerned. A system could theoretically have hundreds of gigabytes written to it daily, but if those writes all occur on a 10 MB chunk of a single virtual disk (e.g., constantly overwriting some logging file), the changed data from a <em>backup<\/em> perspective is just 10 MB.<\/p>\n\n\n\n<p>If you need to work out the change rates for virtual machines, you&#8217;ll be pleased to know the policy logs for virtual machine backups contain this information. They can be found on the NetWorker server under the appropriate policy logs directory &#8212; on a Linux NetWorker server, for instance, that&#8217;s <strong>\/nsr\/policy\/<em>policyName<\/em>\/<em>workflowName<\/em><\/strong>. In my lab, I have an &#8216;Infrastructure&#8217; policy, and underneath that a &#8216;Virtual&#8217; workflow, so on my NetWorker Server, it looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/PolicyLogs.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1233\" height=\"652\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/PolicyLogs.png\" alt=\"\" class=\"wp-image-10556\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/PolicyLogs.png 1233w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/PolicyLogs-300x159.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/PolicyLogs-1024x541.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/PolicyLogs-768x406.png 768w\" sizes=\"auto, (max-width: 1233px) 100vw, 1233px\" \/><\/a><figcaption><strong><em>NetWorker Policy\/Workflow Logs<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>In the screen-grab above, the backup_<em>number<\/em>.raw and clone_<em>number<\/em>.raw represent the overall action logs, but each virtual machine backup is logged individually in a file using a filename of <em>number<\/em>&#8211;<em>vmName<\/em>&#8211;<em>datetime<\/em>.log. If you&#8217;re a backup administrator, there is a wealth of information in those log files!<\/p>\n\n\n\n<p>Now, every line in the log file starts with a date\/time stamp and build number for the vProxy. I&#8217;m going to strip that from the output I show below to make things easier to read, but an example of what that might look like is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">2021-08-04T11:00:16Z NOTICE: [@(#) Build number: 73] <\/pre>\n\n\n\n<p>So, what sort of details can you get from the log? <\/p>\n\n\n\n<p><strong>Backup Target Details<\/strong><\/p>\n\n\n\n<p>Target storage, the username used to connect to the storage, and even the path to the actual saveset file written:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"TargetSpec\": {\n  \"DeviceType\": \"DataDomain\",\n  \"HostName\": \"neutronium.turbamentis.int\",\n  \"UserName\": \"boost\",\n  \"UserPassword\": \"********\",\n  \"ThumbPrint\": \"\",\n  \"BackupMode\": \"VSS\",\n  \"BackupPath\": \"orilla\/BoostBackup\/\/orilla\/BoostBackup\/5\n3\/78\/d69d2ea2-00000006-780a733e-610a733e-02899ed8-a41317f3\",\n  \"EncryptOnWire\": false,\n  \"PreviousBackupPath\": \"\/orilla\/BoostBackup\/25\/08\/6f7bc0\nf3-00000006-ac0921be-610921be-02559ed8-a41317f3\",\n  \"CurrentBackupPath\": \"\/orilla\/BoostBackup\/active\/d69d2e\na2-00000006-780a733e-610a733e-02899ed8-a41317f3\",<\/pre>\n\n\n\n<p><strong>Backup Transport Mode<\/strong><\/p>\n\n\n\n<p>You can quickly see what the requested and actual transport type was in the logs &#8211; just search for transport:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/TransportMode.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1233\" height=\"652\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/TransportMode.png\" alt=\"\" class=\"wp-image-10558\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/TransportMode.png 1233w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/TransportMode-300x159.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/TransportMode-1024x541.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/TransportMode-768x406.png 768w\" sizes=\"auto, (max-width: 1233px) 100vw, 1233px\" \/><\/a><figcaption><strong><em>Checking Backup Transport Mode<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p><strong>Did the Virtual Disk Even Get Touched?<\/strong><\/p>\n\n\n\n<p>Image-based backups should be as minimum-impact as possible. So if a virtual machine has disks that don&#8217;t change between backups, they don&#8217;t need to be touched:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">'Hard disk 1': No changed blocks detected, skipping unnecessary access to Virtual Disk.\n'Hard disk 2': No changed blocks detected, skipping unnecessary access to Virtual Disk.\nSkipping disk mover for 'Hard disk 1', copying from previous backup.\nSkipping disk mover for 'Hard disk 2', copying from previous backup.<\/pre>\n\n\n\n<p><strong>Change Rate<\/strong><\/p>\n\n\n\n<p>And, as you&#8217;d have gathered from the title of this post, you can also get the change rate.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$<strong> grep \"change rate\" 579656-andoria-2021-8-4-21-5-23.log<\/strong>\nUsed bytes = 5610930176, changed bytes = 163250176, change rate = 002.91%.\nUsed bytes = 523948523520, changed bytes = 132382720, change rate = 000.03%.<\/pre>\n\n\n\n<p>In the above example, there are two virtual disks for the machine, hence two lines. In the simplest analysis method, you can average the change rates for all disks reported, giving you the change rate for the virtual machine.<\/p>\n\n\n\n<p>For instance, I wrote a simple Perl script called <strong>get-vm-changerates.pl<\/strong> that is passed a list of log files and calculates the average change rate for each virtual machine backup, printing it all out in a table. Running it against my logs, I got this output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/Calculated-Change-Rates.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1072\" height=\"1012\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/Calculated-Change-Rates.png\" alt=\"\" class=\"wp-image-10561\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/Calculated-Change-Rates.png 1072w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/Calculated-Change-Rates-300x283.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/Calculated-Change-Rates-1024x967.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/Calculated-Change-Rates-768x725.png 768w\" sizes=\"auto, (max-width: 1072px) 100vw, 1072px\" \/><\/a><figcaption><strong><em>Calculated VM Change Rates<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>The script I wrote is below:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">#!\/usr\/bin\/perl -w\n\nuse strict;\nmy @files = @ARGV;\n\nmy %dataSet = ();\nforeach my $file (@files) {\n\tif (open(LOGFILE,$file)) {\n\t\tmy $vmName = \"\";\n\t\tmy $changeRate = 0;\n\t\tmy $backupTime = \"\";\n\t\tmy $backupNtime = 0;\n\t\tmy $crCount = 0;\n\t\twhile (&lt;LOGFILE>) {\n\t\t\tif ($_ =~ \/VmSpec\/) {\n\t\t\t\tmy $nameLine = &lt;LOGFILE>;\n\t\t\t\tchomp $nameLine;\n\t\t\t\tif ($nameLine =~ \/^.*\\\"Name\\\":\\s+\\\"(.*)\\\"\\,\/) {\n\t\t\t\t\t$vmName = $1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($_ =~ \/^.*Used bytes = \\d+, changed bytes = \\d+, change rate = (.*)%\/) {\n\t\t\t\tmy $cr = $1;\n\t\t\t\tif ($changeRate == 0) {\n\t\t\t\t\t$changeRate = $cr;\n\t\t\t\t} else {\n\t\t\t\t\t$changeRate += $cr;\n\t\t\t\t}\n\t\t\t\t$crCount++;\n\t\t\t}\n\t\t\tif ($backupTime eq \"\" &amp;&amp; $_ =~ \/^.*\\\"BackupTime\\\":\\s+\\\"(\\d+)\\\"\/) {\n\t\t\t\t$backupNtime = $1;\n\t\t\t\tmy ($sec,$min,$hour,$mday,$mon,$year) = (localtime($backupNtime))[0,1,2,3,4,5];\n\t\t\t\t$mon++;\n\t\t\t\t$year+=1900;\n\t\t\t\t$backupTime = sprintf(\"%d-%02d-%02d @ %02d:%02d:%02d\",$year,$mon,$mday,$hour,$min,$sec);\n\t\t\t}\n\t\t}\n\t\tclose(LOGFILE);\n\t\t$dataSet{$backupNtime}{vm} = $vmName;\n\t\t$dataSet{$backupNtime}{datetime} = $backupTime;\n\t\t$dataSet{$backupNtime}{changerate} = $changeRate \/ $crCount;\n\t}\n}\n\n# Print it nicely.\nprintf(\"%-40s %-24s %-10s\\n\",\"Virtual Machine Name\",\"Date\/Time\",\"Change (%)\");\nprintf(\"%-40s %-24s %-10s\\n\",\"=\" x 40,\"=\" x 24,\"=\" x 10);\nforeach my $nsave (sort {$a &lt;=> $b} keys %dataSet) {\n\tprintf(\"%-40s %-24s %-.3f\\n\",$dataSet{$nsave}{vm},$dataSet{$nsave}{datetime},$dataSet{$nsave}{changerate});\n}<\/code><\/pre>\n\n\n\n<p>It&#8217;s not a complex process at all &#8212; it&#8217;s just a case of quickly grabbing out the details we want from each log file, then pretty-printing it at the end.<\/p>\n\n\n\n<p>In fact, the day after I finished the script, it occurred to me that calculating the actual amount of changed data for each virtual machine and showing it would also be handy, so I updated the script to also extract that \u2013 here&#8217;s a sample output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/VM-Change-Rate-with-Changed-Data.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1037\" height=\"1054\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/VM-Change-Rate-with-Changed-Data.png\" alt=\"\" class=\"wp-image-10566\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/VM-Change-Rate-with-Changed-Data.png 1037w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/VM-Change-Rate-with-Changed-Data-295x300.png 295w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/VM-Change-Rate-with-Changed-Data-1007x1024.png 1007w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/VM-Change-Rate-with-Changed-Data-768x781.png 768w\" sizes=\"auto, (max-width: 1037px) 100vw, 1037px\" \/><\/a><figcaption><strong><em>Calculated VM Change Rates + Changed GB<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>The &#8216;enhanced&#8217; script is below:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">#!\/usr\/bin\/perl -w\n\nuse strict;\nmy @files = @ARGV;\n\nmy %dataSet = ();\nforeach my $file (@files) {\n\tif (open(LOGFILE,$file)) {\n\t\tmy $vmName = \"\";\n\t\tmy $changeRate = 0;\n\t\tmy $changedGB = 0;\n\t\tmy $backupTime = \"\";\n\t\tmy $backupNtime = 0;\n\t\tmy $crCount = 0;\n\t\twhile (&lt;LOGFILE>) {\n\t\t\tif ($_ =~ \/VmSpec\/) {\n\t\t\t\tmy $nameLine = &lt;LOGFILE>;\n\t\t\t\tchomp $nameLine;\n\t\t\t\tif ($nameLine =~ \/^.*\\\"Name\\\":\\s+\\\"(.*)\\\"\\,\/) {\n\t\t\t\t\t$vmName = $1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($_ =~ \/^.*Used bytes = \\d+, changed bytes = (\\d+), change rate = (.*)%\/) {\n\t\t\t\tmy $changedBytes = $1;\n\t\t\t\tmy $cr = $2;\n\t\t\t\t\n\t\t\t\t$changedGB += ($changedBytes \/ 1000 \/ 1000 \/ 1000);\n\t\t\t\t\n\t\t\t\tif ($changeRate == 0) {\n\t\t\t\t\t$changeRate = $cr;\n\t\t\t\t} else {\n\t\t\t\t\t$changeRate += $cr;\n\t\t\t\t}\n\t\t\t\t$crCount++;\n\t\t\t}\n\t\t\tif ($backupTime eq \"\" &amp;&amp; $_ =~ \/^.*\\\"BackupTime\\\":\\s+\\\"(\\d+)\\\"\/) {\n\t\t\t\t$backupNtime = $1;\n\t\t\t\tmy ($sec,$min,$hour,$mday,$mon,$year) = (localtime($backupNtime))[0,1,2,3,4,5];\n\t\t\t\t$mon++;\n\t\t\t\t$year+=1900;\n\t\t\t\t$backupTime = sprintf(\"%d-%02d-%02d %02d:%02d:%02d\",$year,$mon,$mday,$hour,$min,$sec);\n\t\t\t}\n\t\t}\n\t\tclose(LOGFILE);\n\t\tif (length($vmName) >= 27) {\n\t\t\t$dataSet{$backupNtime}{vm} = substr($vmName,0,27) . \"...\";\n\t\t} else {\n\t\t\t$dataSet{$backupNtime}{vm} = $vmName;\n\t\t}\n\t\t$dataSet{$backupNtime}{datetime} = $backupTime;\n\t\t$dataSet{$backupNtime}{changerate} = $changeRate \/ $crCount;\n\t\t$dataSet{$backupNtime}{changedGB} = $changedGB;\n\t}\n}\n\n# Print it nicely.\nprintf(\"%-30s %-19s %-10s %15s\\n\",\"Virtual Machine Name\",\"Date\/Time\",\"Change (%)\",\"Changed GB\");\nprintf(\"%-30s %-19s %-10s %-15s\\n\",\"=\" x 30,\"=\" x 19,\"=\" x 10,\"=\" x 15);\nforeach my $nsave (sort {$a &lt;=> $b} keys %dataSet) {\n\tprintf(\"%-30s %-19s %10.3f %15.4f\\n\",$dataSet{$nsave}{vm},$dataSet{$nsave}{datetime},$dataSet{$nsave}{changerate},$dataSet{$nsave}{changedGB});\n}<\/code><\/pre>\n\n\n\n<p>So as you can see, it&#8217;s very simple to see the change rates for virtual machine backups &#8212; and trivial to script, too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re doing image-based backups of virtual machines, it&#8217;s useful to see the actual change rate of those virtual machines.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":10553,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,16],"tags":[1628,1079],"class_list":["post-10551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-basics","category-networker","tag-change-rate","tag-virtual-machine"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/08\/bigStock-Abstract-Data.jpg","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-2Kb","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/10551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/comments?post=10551"}],"version-history":[{"count":5,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/10551\/revisions"}],"predecessor-version":[{"id":10570,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/10551\/revisions\/10570"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media\/10553"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=10551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=10551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=10551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}