{"id":10123,"date":"2021-03-16T10:10:29","date_gmt":"2021-03-16T00:10:29","guid":{"rendered":"https:\/\/nsrd.info\/blog\/?p=10123"},"modified":"2021-03-16T10:10:33","modified_gmt":"2021-03-16T00:10:33","slug":"avamar-basics-command-line-restores-using-avtar","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2021\/03\/16\/avamar-basics-command-line-restores-using-avtar\/","title":{"rendered":"Avamar Basics &#8211; Command Line Restores using avtar"},"content":{"rendered":"\n<p>I admit, when I first encountered Avamar, some of my first impressions were a little jaded by my lengthy experience with NetWorker and other products.<\/p>\n\n\n\n<p>Whereas NetWorker has a very rich set of command line options, particularly on the client, Avamar only has a few. But the difference between the two is that Avamar&#8217;s few command line tools on the client are packed with a rich gamut of options.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Avamar Restore Options<\/h2>\n\n\n\n<p>There are a few standard options that you might use for an Avamar restore:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A database-integrated plugin, directly on the client (e.g., Avamar embedded in the Oracle RMAN utility)<\/li><li>A GUI restore (either the new web-based AUI or the Java console)<\/li><li>From the command line on the client using <strong>avtar<\/strong>.<\/li><\/ul>\n\n\n\n<p>I might have previously split out options around vCenter\/VMware restore processes. However, these now plug directly into the AUI anyway, so they&#8217;re just another variation of the AUI restore scenario.<\/p>\n\n\n\n<p>(In addition to the above methods, you can also access Avamar restores via the REST API, which is leveraged to excellent effect in extensions such as the vRealize Automator and vRealize Orchestrator plugins.)<\/p>\n\n\n\n<p>GUI-based restores are easy enough to navigate via the GUI, particularly now with the Avamar UI. But it&#8217;s worthwhile knowing how to make your way around a command line restore.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Aside: Setting up a User Account for Restores<\/h2>\n\n\n\n<p>In a normal Avamar environment, you&#8217;ve probably got a plethora of different user accounts setup (either integrated into Active Directory, or as direct Avamar accounts). I had never got around to configuring additional accounts in my Avamar lab environment, and I think you ought to avoid using the MCUser account for client initiated recoveries. (Because individual users\/administrators on clients are unlikely to be trusted with the root credentials for Avamar.)<\/p>\n\n\n\n<p>So as a precursor to this, I decided to create a new account in Avamar I&#8217;d be using for this process. To start the process, I went to <strong>Administrator &gt; Setting<\/strong> under the AUI. From there I selected <strong>Setting &gt; Users<\/strong> in the main window, and because I didn&#8217;t want a new account that could administer the entire server, I chose the <strong>clients<\/strong> domain:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1681\" height=\"727\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain.png\" alt=\"Avamar WebUI Console showing Administration - Setting - User in the Clients Domain\" class=\"wp-image-10120\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain.png 1681w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain-300x130.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain-1024x443.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain-768x332.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain-1536x664.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_01-Users-for-Clients-Domain-1600x692.png 1600w\" sizes=\"auto, (max-width: 1681px) 100vw, 1681px\" \/><\/a><figcaption>Preparing to add a new user to the \/clients domain<\/figcaption><\/figure>\n\n\n\n<p>I clicked <strong>+Add<\/strong> to add a new account and filled in the desired details:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_02-pmdg-account.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1150\" height=\"444\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_02-pmdg-account.png\" alt=\"User management - creating a new admin-cannot-retire account\" class=\"wp-image-10121\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_02-pmdg-account.png 1150w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_02-pmdg-account-300x116.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_02-pmdg-account-1024x395.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_02-pmdg-account-768x297.png 768w\" sizes=\"auto, (max-width: 1150px) 100vw, 1150px\" \/><\/a><figcaption>User management &#8211; adding a new administrator without client-retire role<\/figcaption><\/figure>\n\n\n\n<p>The role I chose for my user account was &#8216;Administrator cannot retire&#8217;, which is, as you may have guessed by the name, an Administrator user that can&#8217;t retire clients. In actual fact, I only needed to create a Restore-enabled user, but I figured I&#8217;ll use this user account elsewhere so gave it a bit more oomph.<\/p>\n\n\n\n<p>After I filled in the details and clicked OK, the User Settings updated to show my new account:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1680\" height=\"491\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible.png\" alt=\"Avamar WebUI Administration - Setting - Showing new user account\" class=\"wp-image-10122\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible.png 1680w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible-300x88.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible-1024x299.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible-768x224.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible-1536x449.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_rec_03-Account-visible-1600x468.png 1600w\" sizes=\"auto, (max-width: 1680px) 100vw, 1680px\" \/><\/a><figcaption>AUI Administration &#8211; Setting &#8211; Showing new user account<\/figcaption><\/figure>\n\n\n\n<p>So that&#8217;s the account created. Next up &#8211; using it to do a restore.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Acquainted with avtar<\/h2>\n\n\n\n<p>If you&#8217;re at all familiar with Unix and Linux platforms, you&#8217;ll have no doubt guessed that avtar is a little modelled on the Unix <em>tar<\/em> command. The avtar command takes <strong>most <\/strong>command-line options via the long-form method &#8211; i.e., a whole word preceded by a minus-minus. (There are some variations, but the majority of options will use a &#8216;&#8211;&#8216;).<\/p>\n\n\n\n<p>The first variant of avtar you&#8217;ll want to familiarise yourself with is &#8211;help:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_help.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1115\" height=\"1023\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_help.png\" alt=\"Using avtar --help\" class=\"wp-image-10127\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_help.png 1115w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_help-300x275.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_help-1024x940.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_help-768x705.png 768w\" sizes=\"auto, (max-width: 1115px) 100vw, 1115px\" \/><\/a><figcaption>Using avtar &#8211;help<\/figcaption><\/figure>\n\n\n\n<p>This will produce a rather lengthy amount of information, so either pipe it to more or be prepared to scroll back up. Details are broken into two key categories:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Tasks <\/strong>&#8211; What you&#8217;ll want to do with avtar, and<\/li><li><strong>Options <\/strong>&#8211; How you set granular controls on the tasks you run with avtar.<\/li><\/ul>\n\n\n\n<p>Taking a closer look at the <em>tasks<\/em>, you&#8217;ll see you can use avtar to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>create <\/strong>&#8211; Make a new backup<\/li><li><strong>extract <\/strong>&#8211; Pull files out of a backup (i.e., restore)<\/li><li><strong>list <\/strong>&#8211; List the contents of a backup<\/li><li><strong>backups <\/strong>&#8211; List backups<\/li><li><strong>delete <\/strong>&#8211; Delete a backup<\/li><li><strong>viewlog <\/strong>&#8211; Show the logs for a particular backup<\/li><li><strong>validate <\/strong>&#8211; Validate a backup<\/li><\/ul>\n\n\n\n<p>Each of these tasks are useful, of course, but in this post we&#8217;ll concentrate on options around restoring from backups.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using avtar to find the backup you want to restore from<\/h2>\n\n\n\n<p>So your first step will be to list the backups available for the host you want to restore data for. This will be via <strong>avtar &#8211;backups<\/strong>.<\/p>\n\n\n\n<p>Now, when you intend to talk to an Avamar server with avtar (pretty much any time other than just running avtar &#8211;help), you&#8217;ll need to authenticate, and you&#8217;ll likely need to specify a host path you want to work on. You can bundle the password on the command line, but for my examples, I&#8217;ll be typing in the password each time.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_backups.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1115\" height=\"510\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_backups.png\" alt=\"Producing a list of Avamar backups for a client\" class=\"wp-image-10130\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_backups.png 1115w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_backups-300x137.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_backups-1024x468.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_backups-768x351.png 768w\" sizes=\"auto, (max-width: 1115px) 100vw, 1115px\" \/><\/a><figcaption>Producing a list of Avamar backups for a client<\/figcaption><\/figure>\n\n\n\n<p>So here&#8217;s the command I used:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># <strong>avtar --backups --id=pmdg@\/clients --account=totesrhelly.turbamentis.int<\/strong><\/pre>\n\n\n\n<p>(All one line.)<\/p>\n\n\n\n<p>You use the &#8216;&#8211;id&#8217; option to authenticate an account name. In this case, because the account I created wasn&#8217;t in the root domain for Avamar, I had to specify the account name and the account <em>domain<\/em>. So, that was &#8216;<strong>pmdg@\/clients<\/strong>&#8216;, meaning &#8220;User &#8216;pmdg&#8217; in the &#8216;\/clients&#8217; domain&#8221;.<\/p>\n\n\n\n<p>You also have to tell avtar the <em>account<\/em> you want to use it against. Within Avamar and avtar in particular, the account refers to the host or client name whose backups you want to interact with. For my example here, the account is &#8216;totesrhelly.turbamentis.int&#8217;. (Note that I didn&#8217;t have to specify the <strong>\/clients <\/strong>domain here. I&#8217;ve specified \/clients in my id.)<\/p>\n\n\n\n<p>Running the command gives me a list of all the backups for the nominated account, including details including but not limited to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The backup label<\/li><li>When the backup was generated<\/li><li>The size of the backup<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Using avtar to list the contents of a backup<\/h2>\n\n\n\n<p>Sometimes you&#8217;ll know exactly what you want to restore from a backup, but sometimes you&#8217;ll want to query the content of a backup to see if it has what you want. (Remember that since each Avamar backup is <strong>full<\/strong>, any backup you query will present you that full filesystem view you might know and love from NetWorker&#8217;s &#8216;recover&#8217; command.)<\/p>\n\n\n\n<p>If I wanted to list the contents of the second backup (top of the list of two backups, sequence #2), I&#8217;ll want to grab the backup label to run the backup listing, and my command will look like the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># <strong>avtar --list --id=pmdg@\/clients --account=totesrhelly.turbamentis.int --label=LinuxFSWithPreCommand-LinuxPreBackup-16150392000<\/strong><\/pre>\n\n\n\n<p>I added a &#8220;| less&#8221; to the end of the above command so I could pause the output for a screen capture. (When you do that, the command may appear to hang, but in that scenario it&#8217;s just Unix\/Linux buffering while avtar prompts you to enter your password.)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1115\" height=\"966\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list.png\" alt=\"Using avtar to list the contents of a specific backup\" class=\"wp-image-10134\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list.png 1115w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list-300x260.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list-1024x887.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list-768x665.png 768w\" sizes=\"auto, (max-width: 1115px) 100vw, 1115px\" \/><\/a><figcaption>Using avtar to list the contents of a specific backup<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using avtar for a command-line restore<\/h2>\n\n\n\n<p>So far we&#8217;ve looked at:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>How to list the backups<\/li><li>How to list the contents of a backup<\/li><\/ul>\n\n\n\n<p>Now we&#8217;re ready for the main event &#8211; how to restore files from a backup. There are a lot of different restore options, but I&#8217;m going to keep it simple. In this scenario, I want to recover the path <strong>\/DATA\/NetWorker\/19.4<\/strong> to <strong>\/tmp\/recovery<\/strong> from the backup I previously listed above. That makes the command line as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># <strong>avtar --extract --id=pmdg@\/clients --account=totesrhelly.turbamentis.int --label=LinuxFSWithPreCommand-LinuxPreBackup-16150392000 --target=\/tmp\/recovery \/DATA\/NetWorker\/19.4<\/strong><\/pre>\n\n\n\n<p>The new CLI options I&#8217;m using here are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>&#8211;extract<\/strong> to restore<\/li><li><strong>&#8211;target <\/strong>to specify <em>where<\/em> I want to write the restored data to, and<\/li><li><em>fileSpec<\/em> &#8211; The file path\/spec to apply for matches for restoration &#8211; in this case, &#8216;\/DATA\/NetWorker\/19.4&#8217;.<\/li><\/ul>\n\n\n\n<p>So, here&#8217;s what the restore looks like in action:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_extract.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1115\" height=\"1040\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_extract.png\" alt=\"Running the avtar extract command\" class=\"wp-image-10136\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_extract.png 1115w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_extract-300x280.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_extract-1024x955.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_extract-768x716.png 768w\" sizes=\"auto, (max-width: 1115px) 100vw, 1115px\" \/><\/a><figcaption>Running the avtar extract command<\/figcaption><\/figure>\n\n\n\n<p>With the restore complete, I did a quick directory listing to confirm the results of the operation:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list_restore_contents.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1115\" height=\"1040\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list_restore_contents.png\" alt=\"Listing restored files\" class=\"wp-image-10137\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list_restore_contents.png 1115w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list_restore_contents-300x280.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list_restore_contents-1024x955.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/avtar_list_restore_contents-768x716.png 768w\" sizes=\"auto, (max-width: 1115px) 100vw, 1115px\" \/><\/a><figcaption>Listing restored files<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping up Avamar command line restores using avtar<\/h2>\n\n\n\n<p>As I mentioned earlier &#8211; the <strong>avtar <\/strong>command has a <em>lot<\/em> of options to it, and even in terms of finding backups and running restores, I&#8217;ve really only touched the top of it with this article. But always keep in mind that <strong>avtar <\/strong>is a powerful option available to you to run Avamar restores.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I admit, when I first encountered Avamar, some of my first impressions were a little jaded by my lengthy experience&hellip;<\/p>\n","protected":false},"author":1,"featured_media":10139,"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":[1154,19],"tags":[1486,219,1215],"class_list":["post-10123","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-avamar-2","category-recovery","tag-avtar","tag-cli","tag-restore"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/03\/bigStock-Command-Line.jpg","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-2Dh","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/10123","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=10123"}],"version-history":[{"count":5,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/10123\/revisions"}],"predecessor-version":[{"id":10167,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/10123\/revisions\/10167"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media\/10139"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=10123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=10123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=10123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}