{"id":1268,"date":"2009-11-02T08:51:32","date_gmt":"2009-11-01T22:51:32","guid":{"rendered":"http:\/\/nsrd.wordpress.com\/?p=1268"},"modified":"2009-11-02T08:51:32","modified_gmt":"2009-11-01T22:51:32","slug":"why-nsrtmp-is-wrong","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2009\/11\/02\/why-nsrtmp-is-wrong\/","title":{"rendered":"Why \/nsr\/tmp is wrong"},"content":{"rendered":"<p>On both Windows and Unix platforms, NetWorker maintains a &#8220;tmp&#8221; directory within nsr.<\/p>\n<p>This directory contains a variety of information, from output received by savegroup completion notifications to lock\/state files for certain NetWorker resource.<\/p>\n<p>To first explain why \/nsr\/tmp is wrong, let me first tell you a little story about the first system administration team I joined. They rigorously followed <a title=\"RFC 1178\" href=\"http:\/\/www.faqs.org\/rfcs\/rfc1178.html\" target=\"_blank\">RFC-1178<\/a>, and it&#8217;s ever since then that I&#8217;ve also done my best to follow that RFC \u2013 I&#8217;ve even written an article here on the blog about choosing appropriate names for backup servers. Sometime before I joined the team, they were in the process of setting up a replacement DNS server for local datacentre. There was either a dispute about what to name it, or it was only meant to hang around for a short while, but for whatever reason, it was named <em>tmp<\/em>.<\/p>\n<p>I worked in the group from 1996 through to 2000, and from what I heard, it wasn&#8217;t until several years after I left that <em>tmp<\/em> was decommissioned.<\/p>\n<p>One of the most valuable lessons I took away is <em>name things appropriately<\/em>. The DNS server <em>tmp<\/em> was not named appropriately. Thus, the name <em>tmp<\/em> or <em>temp<\/em> should be used only for <em>transient<\/em> data or systems. (To this day I never give machines names along the lines of &#8216;tmp&#8217;; the closest I&#8217;ll go is naming them after synonyms to do with trash or garbage \u2013 meaning that I&#8217;m fully aware that at any moment they can be blown away.)<\/p>\n<p>To return to our topic, \/nsr\/tmp is <em>wrong<\/em> because it&#8217;s misnamed. Temporary files only make up some of its content. Other files, state files, can hang around between restarts of NetWorker and (particularly if NetWorker was incorrectly shutdown) give backup administrators <em>really bad days<\/em>. In fact, the &#8220;magical random&#8221; nature of \/nsr\/tmp is so well known that it&#8217;s actually started to really bug EMC engineering. My understanding is that engineering want the contents of \/nsr\/tmp captured <em>any<\/em> time an EMC support representative tells some to shutdown+delete+restart so that if it <em>does<\/em> fix the problem, they can try to debug <em>why<\/em> and remove the need.<\/p>\n<p>The problem with shutdown+delete+restart is that in doing so, you clear out other information as well. Selectively deleting &#8220;the right file&#8221; can sometimes be a bit of a needle in a hay stack operation, and I suspect that debugging these deletes post-event will either be frustratingly slow or a bit like whack-a-mole.<\/p>\n<p>Architecturally, to include both state and temporary files in the same common directory structure is silly. Having a few extra directories in the &#8216;nsr&#8217; base directory on the other hand is a minor change. I&#8217;d suggest that more improvements might be made by first actually splitting \/nsr\/tmp into:<\/p>\n<ul>\n<li>\/nsr\/lck \u2013 Resource lock files<\/li>\n<li>\/nsr\/tmp \u2013 Real temporary files (e.g., savegroup output text)<\/li>\n<li>\/nsr\/state \u2013 State files (if necessary)<\/li>\n<\/ul>\n<p>That way \/nsr\/tmp will actually start to obey the <a title=\"Principle of Least Astonishment\" href=\"http:\/\/en.wikipedia.org\/wiki\/Principle_of_least_astonishment\" target=\"_blank\">Principle of Least Astonishment<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On both Windows and Unix platforms, NetWorker maintains a &#8220;tmp&#8221; directory within nsr. This directory contains a variety of information,&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":[3,16],"tags":[546,938,1009],"class_list":["post-1268","post","type-post","status-publish","format-standard","hentry","category-architecture","category-networker","tag-lock","tag-state","tag-tmp"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-ks","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/1268","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=1268"}],"version-history":[{"count":0,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/1268\/revisions"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=1268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=1268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=1268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}