{"id":649,"date":"2009-07-08T05:31:09","date_gmt":"2009-07-07T19:31:09","guid":{"rendered":"http:\/\/nsrd.wordpress.com\/?p=649"},"modified":"2018-12-12T15:59:32","modified_gmt":"2018-12-12T05:59:32","slug":"basics-null-vs-skip-directives","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2009\/07\/08\/basics-null-vs-skip-directives\/","title":{"rendered":"Basics &#8211; Null vs Skip Directives"},"content":{"rendered":"<p>One of the most common mistakes made by people new to NetWorker when setting up directives is using the <em>skip<\/em> directive when what they actually <em>need<\/em> to use is the <em>null<\/em> directive.<\/p>\n<p>Both directives can be used to <em>prevent<\/em> the backup of nominated content on a client, but using <em>skip<\/em> in situations where <em>null<\/em> should be used can result in very dicey recovery situations.<\/p>\n<p>If you&#8217;re wanting to (no pun intended) &#8220;skip the working&#8221; here, this is the rule you should typically follow:<\/p>\n<ul>\n<li>If wanting to exclude directories, <em>use null<\/em>.<\/li>\n<li>If wanting to exclude files, <em>use skip<\/em>.<\/li>\n<\/ul>\n<p>However, it&#8217;s not as cut and dried as the above suggests, so I recommend you keep reading.<\/p>\n<p>The difference between <em>null<\/em> and <em>skip<\/em> is simple yet important at the same time, and it strongly affects how recoveries work, for it plays a factor in how NetWorker updates indices. One of the best ways I have of describing this is that:<\/p>\n<ul>\n<li>The <em>skip<\/em> directive acts as an opaque shutter on the indices;<\/li>\n<li>The <em>null<\/em> directive acts as a window on the indices.<\/li>\n<\/ul>\n<p>This means that if you use <em>skip<\/em> against <em>different<\/em> directories in the same tree for different backups, each <em>recovery<\/em> you run aftwards will only show what <em>wasn&#8217;t<\/em> skipped. If you use <em>null<\/em> however, then each <em>recovery<\/em> will show both what has been null&#8217;d, and what wasn&#8217;t.<\/p>\n<p>The best way to see how this works is by example, so I&#8217;ve prepared in my server&#8217;s home directory two subdirectories:<\/p>\n<ul>\n<li>\/home\/preston\/test_null<\/li>\n<li>\/home\/preston\/test_skip<\/li>\n<\/ul>\n<p>In each directory, I&#8217;ve created and populated 2 subdirectories, &#8220;01&#8221; and &#8220;02&#8221;. So the full structure is:<\/p>\n<ul>\n<li>\/home\/preston\/test_null\/01<\/li>\n<li>\/home\/preston\/test_null\/02<\/li>\n<li>\/home\/preston\/test_skip\/01<\/li>\n<li>\/home\/preston\/test_skip\/02<\/li>\n<\/ul>\n<p>In each case, &#8220;.nsr&#8221; client side directives were setup in the &#8216;parent&#8217; directories &#8211; \/home\/preston\/test_null and \/home\/preston\/test_skip.<\/p>\n<p>For the first backup, the directives were to &#8220;null&#8221; or &#8220;skip&#8221; the 02 directories and allow the 01 directories to be backed up. For the second backup, the directives were to &#8220;null&#8221; or &#8220;skip&#8221; the 01 directories, allowing the 02 directories to be backed up.<\/p>\n<p>Here&#8217;s what it looked like for the <em>test_null<\/em> directory:<\/p>\n<pre># cd \/home\/preston\/test_null\n# ls -l\ntotal 8\ndrwxr-xr-x 2 root root 4096 Jul&nbsp; 6 18:23 01\ndrwxr-xr-x 2 root root 4096 Jul&nbsp; 6 18:23 02\n\n# cat .nsr\n&lt;&lt; . &gt;&gt;\nnull: 02\n\n# save -b Default -e \"+2 weeks\" .\n&lt;output removed&gt;\n# recover -s nox\nCurrent working directory is \/home\/preston\/test_null\/\nrecover&gt; ls\n 01&nbsp;&nbsp;&nbsp;&nbsp; .nsr\n\n# NOTE: Reverse contents of .nsr\n# cat .nsr\n&lt;&lt; . &gt;&gt;\nnull: 01\n\n# save -b Default -e \"+2 weeks\" .\n&lt;output removed&gt;\n# recover -s nox\nCurrent working directory is \/home\/preston\/test_null\/\nrecover&gt; ls\n 01&nbsp;&nbsp;&nbsp;&nbsp; 02&nbsp;&nbsp;&nbsp;&nbsp; .nsr<\/pre>\n<p>As you can see above, even after the second backup, where the &#8217;01&#8217; directory was most recently excluded, <em>both<\/em> directories are shown in the recovery browser.<\/p>\n<p>Here&#8217;s what it looked like for the <em>test_skip<\/em> directory:<\/p>\n<pre># cd \/home\/preston\/test_skip\n# ls -l\ntotal 8\ndrwxr-xr-x 2 root root 4096 Jul&nbsp; 6 18:28 01\ndrwxr-xr-x 2 root root 4096 Jul&nbsp; 6 18:28 02\n\n# cat .nsr\n&lt;&lt; . &gt;&gt;\nskip: 02\n\n# save -b Default -e \"+2 weeks\" .\n&lt;output removed&gt;\n# recover -s nox\nCurrent working directory is \/home\/preston\/test_skip\/\nrecover&gt; ls\n 01&nbsp;&nbsp;&nbsp;&nbsp; .nsr\n\n# NOTE: Reverse contents of .nsr\n# cat .nsr\n&lt;&lt; . &gt;&gt;\nskip: 01\n\n# save -b Default -e \"+2 weeks\" .\n&lt;output removed&gt;\n# recover -s nox\nCurrent working directory is \/home\/preston\/test_skip\/\nrecover&gt; ls\n 02&nbsp;&nbsp;&nbsp;&nbsp; .nsr<\/pre>\n<p>As you can see, that&#8217;s a substantial difference in what is shown for recovery purposes. Indeed, to be able to recover the &#8220;01&#8221; part of the test_skip directory, we need to explicitly target a time between when the first backup was run, and when the second backup was run:<\/p>\n<pre># mminfo -q \"name=\/home\/preston\/test_skip\" -r \"name,savetime(23)\"\n name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; date&nbsp;&nbsp;&nbsp;&nbsp; time\n\/home\/preston\/test_skip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 07\/06\/2009 06:29:53 PM\n\/home\/preston\/test_skip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 07\/06\/2009 06:31:17 PM\n\n# recover -s nox\nCurrent working directory is \/home\/preston\/test_skip\/\nrecover&gt; ls\n 02&nbsp;&nbsp;&nbsp;&nbsp; .nsr\nrecover&gt; changetime 18:30\n6497:recover: time changed to Mon 06 Jul 2009 06:30:00 PM EST\nrecover&gt; ls\n 01&nbsp;&nbsp;&nbsp;&nbsp; .nsr<\/pre>\n<p>As you can see, there&#8217;s <em>substantial<\/em> difference between <em>skip<\/em> and <em>null<\/em>. For this reason, <em>please<\/em> ensure you pick the right mechanism for excluding content from backup!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the most common mistakes made by people new to NetWorker when setting up directives is using the skip&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,16],"tags":[324,464,469,470,593,683,895],"class_list":["post-649","post","type-post","status-publish","format-standard","hentry","category-basics","category-networker","tag-directive","tag-index","tag-indexes","tag-indices","tag-missing-files","tag-null","tag-skip"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-at","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/649","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=649"}],"version-history":[{"count":1,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/649\/revisions"}],"predecessor-version":[{"id":7639,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/649\/revisions\/7639"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}