{"id":6982,"date":"2018-08-15T06:00:18","date_gmt":"2018-08-14T20:00:18","guid":{"rendered":"https:\/\/www.penguinpunk.net\/blog\/?p=6982"},"modified":"2018-08-13T10:32:22","modified_gmt":"2018-08-13T00:32:22","slug":"getting-started-with-the-pure-storage-cli","status":"publish","type":"post","link":"https:\/\/www.penguinpunk.net\/blog\/getting-started-with-the-pure-storage-cli\/","title":{"rendered":"Getting Started With The Pure Storage CLI"},"content":{"rendered":"<p><a href=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2016\/05\/PureStorage_logo.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3832\" src=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2016\/05\/PureStorage_logo.jpg\" alt=\"\" width=\"450\" height=\"152\" srcset=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2016\/05\/PureStorage_logo.jpg 450w, https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2016\/05\/PureStorage_logo-300x101.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p>I used to <a href=\"https:\/\/www.penguinpunk.net\/blog\/tag\/naviseccli\/\">write a lot about how to manage CLARiiON and VNX storage environments with EMC&#8217;s naviseccli tool<\/a>. I&#8217;ve been doing some stuff with <a href=\"https:\/\/www.purestorage.com\/\">Pure Storage<\/a>\u00a0FlashArrays in our lab and thought it might be worth covering off some of the basics of their CLI. This will obviously be no replacement for the official administration guide, but I thought it might come in useful as a starting point.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Basics<\/strong><\/p>\n<p>Unlike EMC&#8217;s CLI, there&#8217;s no executable to install &#8211; it&#8217;s all on the controllers. If you&#8217;re using Windows, <a href=\"https:\/\/www.putty.org\/\">PuTTY is still a good choice<\/a>\u00a0as an ssh client. Otherwise the macOS ssh client does a reasonable job too. When you first setup your FlashArray, a virtual IP (VIP) was configured. It&#8217;s easiest to connect to the VIP, and Purity then directs your session to whichever controller is the current primary controller. Note that you can also connect via the physical IP address if that&#8217;s how you want to do things.<\/p>\n<p>The first step is to login to the array as <em>pureuser<\/em>, with the password that you&#8217;ve definitely changed from the default one.<\/p>\n<pre class=\"p1\"><strong>login as: pureuser<\/strong>\r\n<strong>pureuser@10.xxx.xxx.30's password:<\/strong>\r\n<strong>Last login: Fri Aug 10 09:36:05 2018 from 10.xxx.xxx.xxx<\/strong>\r\n\r\n<strong>Mon Aug 13 10:01:52 2018<\/strong>\r\n<strong>Welcome pureuser. This is Purity Version 4.10.4 on FlashArray purearray<\/strong>\r\n<strong>http:\/\/www.purestorage.com\/<\/strong><\/pre>\n<p>&#8220;purehelp&#8221; is the command to run to list available commands.<\/p>\n<pre><strong>pureuser@purearray&gt; purehelp<\/strong>\r\n<strong>Available commands:<\/strong>\r\n<strong>-------------------<\/strong>\r\n<strong>pureadmin<\/strong>\r\n<strong>purealert<\/strong>\r\n<strong>pureapp<\/strong>\r\n<strong>purearray<\/strong>\r\n<strong>purecert<\/strong>\r\n<strong>pureconfig<\/strong>\r\n<strong>puredns<\/strong>\r\n<strong>puredrive<\/strong>\r\n<strong>pureds<\/strong>\r\n<strong>purehelp<\/strong>\r\n<strong>purehgroup<\/strong>\r\n<strong>purehost<\/strong>\r\n<strong>purehw<\/strong>\r\n<strong>purelog<\/strong>\r\n<strong>pureman<\/strong>\r\n<strong>puremessage<\/strong>\r\n<strong>purenetwork<\/strong>\r\n<strong>purepgroup<\/strong>\r\n<strong>pureplugin<\/strong>\r\n<strong>pureport<\/strong>\r\n<strong>puresmis<\/strong>\r\n<strong>puresnmp<\/strong>\r\n<strong>puresubnet<\/strong>\r\n<strong>puresw<\/strong>\r\n<strong>purevol<\/strong>\r\n<strong>exit<\/strong>\r\n<strong>logout<\/strong><\/pre>\n<p>If you want to get some additional help with a command, you can run &#8220;command -h&#8221; (or &#8211;help).<\/p>\n<pre><strong>pureuser@purearray&gt; purevol -h<\/strong>\r\n<strong>usage: purevol [-h]<\/strong>\r\n<strong>\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 {add,connect,copy,create,destroy,disconnect,eradicate,list,listobj,monitor,recover,remove,rename,setattr,snap,truncate}<\/strong>\r\n<strong>\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ...<\/strong>\r\n\r\n<strong>positional arguments:<\/strong>\r\n<strong>\u00a0 {add,connect,copy,create,destroy,disconnect,eradicate,list,listobj,monitor,recover,remove,rename,setattr,snap,truncate}<\/strong>\r\n<strong>\u00a0 \u00a0 add \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 add volumes to protection groups<\/strong>\r\n<strong>\u00a0 \u00a0 connect \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 connect one or more volumes to a host<\/strong>\r\n<strong>\u00a0 \u00a0 copy\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 copy a volume or snapshot to one or more volumes<\/strong>\r\n<strong>\u00a0 \u00a0 create\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 create one or more volumes<\/strong>\r\n<strong>\u00a0 \u00a0 destroy \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 destroy one or more volumes or snapshots<\/strong>\r\n<strong>\u00a0 \u00a0 disconnect\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 disconnect one or more volumes from a host<\/strong>\r\n<strong>\u00a0 \u00a0 eradicate \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 eradicate one or more volumes or snapshots<\/strong>\r\n<strong>\u00a0 \u00a0 list\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 display information about volumes or snapshots<\/strong>\r\n<strong>\u00a0 \u00a0 listobj \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 list objects associated with one or more volumes<\/strong>\r\n<strong>\u00a0 \u00a0 monitor \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 display I\/O performance information<\/strong>\r\n<strong>\u00a0 \u00a0 recover \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 recover one or more destroyed volumes or snapshots<\/strong>\r\n<strong>\u00a0 \u00a0 remove\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 remove volumes from protection groups<\/strong>\r\n<strong>\u00a0 \u00a0 rename\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 rename a volume or snapshot<\/strong>\r\n<strong>\u00a0 \u00a0 setattr \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 set volume attributes (increase size)<\/strong>\r\n<strong>\u00a0 \u00a0 snap\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 take snapshots of one or more volumes<\/strong>\r\n<strong>\u00a0 \u00a0 truncate\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 truncate one or more volumes (reduce size)<\/strong>\r\n\r\n<strong>optional arguments:<\/strong>\r\n<strong>\u00a0 -h, --help\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 show this help message and exit<\/strong><\/pre>\n<p>There&#8217;s also a facility to access the man page for commands. Just run &#8220;pureman command&#8221; to access it.<\/p>\n<p><a href=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2018\/08\/pureman_purearray.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7001\" src=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2018\/08\/pureman_purearray.png\" alt=\"\" width=\"645\" height=\"394\" srcset=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2018\/08\/pureman_purearray.png 645w, https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2018\/08\/pureman_purearray-300x183.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/a><\/p>\n<p>Want to see how much capacity there is on the array? Run &#8220;purearray list &#8211;space&#8221;.<\/p>\n<pre><strong>pureuser@purearray&gt; purearray list --space<\/strong>\r\n<strong>Name\u00a0 \u00a0 \u00a0 \u00a0 Capacity\u00a0 Parity\u00a0 Thin Provisioning\u00a0 Data Reduction\u00a0 Total Reduction\u00a0 Volumes\u00a0 Snapshots\u00a0 Shared Space\u00a0 System\u00a0 Total<\/strong>\r\n<strong>purearray\u00a0 12.45T\u00a0 \u00a0 100%\u00a0 \u00a0 86%\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 2.4 to 1\u00a0 \u00a0 \u00a0 \u00a0 17.3 to 1\u00a0 \u00a0 \u00a0 \u00a0 350.66M\u00a0 3.42G\u00a0 \u00a0 \u00a0 3.01T \u00a0 \u00a0 \u00a0 \u00a0 0.00\u00a0 \u00a0 3.01T<\/strong><\/pre>\n<p>Need to check the software version or generally availability of the controllers? Run &#8220;purearray list &#8211;controller&#8221;.<\/p>\n<pre><strong>pureuser@purearray&gt; purearray list --controller<\/strong>\r\n<strong>Name\u00a0 Mode \u00a0 \u00a0 \u00a0 Model \u00a0 Version\u00a0 Status<\/strong>\r\n<strong>CT0 \u00a0 secondary\u00a0 FA-450\u00a0 4.10.4 \u00a0 ready<\/strong>\r\n<strong>CT1 \u00a0 primary\u00a0 \u00a0 FA-450\u00a0 4.10.4 \u00a0 ready<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Connecting A Host<\/strong><\/p>\n<p>To connect a host to an array (assuming you&#8217;ve already zoned it to the array), you&#8217;d use the following commands.<\/p>\n<pre><strong>purehost create hostname<\/strong>\r\n<strong>purehost create -wwnlist WWNs hostname<\/strong>\r\n<strong>purehost list<\/strong>\r\n<strong>purevol connect --host [host] [volume]<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Host Groups<\/strong><\/p>\n<p>You might need to create a Host Group if you&#8217;re running ESXi and want to have multiple hosts accessing the same volumes. Here&#8217;re the commands you&#8217;ll need. Firstly, create the Host Group.<\/p>\n<pre><strong>purehgroup create [hostgroup]<\/strong><\/pre>\n<p>Add the hosts to the Host Group (these hosts should already exist on the array)<\/p>\n<pre><strong>purehgroup setattr --hostlist host1,host2,host3 [hostgroup]<\/strong><\/pre>\n<p>You can then assign volumes to the Host Group<\/p>\n<pre><strong>purehgroup connect --vol [volume] [hostgroup]<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Other Volume Operations<\/strong><\/p>\n<p>Some other neat (and sometimes destructive) things you can do with volumes are listed below.<\/p>\n<p>To resize a volume, use the following commands.<\/p>\n<pre><strong>purevol setattr --size 500G [volume]<\/strong>\r\n<strong>purevol truncate --size 20GB [volume]<\/strong><\/pre>\n<p>Note that a snapshot is available for 24 hours to roll back if required. This is good if you&#8217;ve shrunk a volume to be smaller than the data on it and have consequently munted the filesystem.<\/p>\n<p>When you destroy a volume it immediately becomes unavailable to host, but remains on the array for 24 hours. Note that you&#8217;ll need to remove the volume from any hosts connected to it first.<\/p>\n<pre><strong>purevol disconnect [volume] --host [hostname]<\/strong>\r\n<strong>purevol destroy [volume]<\/strong><\/pre>\n<p>If you&#8217;re running short of capacity, or are just curious about when a deleted volume will disappear, use the following command.<\/p>\n<pre><strong>purevol list --pending<\/strong><\/pre>\n<p>If you need the capacity back immediately, the deleted volume can be eradicated with the following comamnd.<\/p>\n<pre><strong>purevol eradicate [volume]<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Further Reading<\/strong><\/p>\n<p>The Pure CLI is obviously not a new thing, and plenty of bright folks have already done a few articles about how you can use it as part of a provisioning workflow. <a href=\"https:\/\/blog.purestorage.com\/implementation-series-part-1-cli-scripting-for-dummies-large-deployment\/\">This one<\/a> from Chadd Kenney is a little old now but still demonstrates how you can bring it all together to do something pretty useful. You can obviously extend that to do some pretty interesting stuff, and there&#8217;s solid parity between the GUI and CLI in the Purity environment.<\/p>\n<p>It seems like a small thing, but the fact that there&#8217;s no need to install an executable is a big thing in my book. Array vendors (and infrastructure vendors in general) insisting on installing some shell extension or command environment is a pain in the arse, and should be seen as an act of hostility akin to requiring Java to complete simple administration tasks. The sooner we get everyone working with either HTML5 or simple ssh access the better. In any csase, I hope this was a useful introduction to the Purity CLI. Check out the Administration Guide for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I used to write a lot about how to manage CLARiiON and VNX storage environments with EMC&#8217;s naviseccli tool. I&#8217;ve been doing some stuff with Pure Storage\u00a0FlashArrays in our lab and thought it might be worth covering off some of the basics of their CLI. This will obviously be no replacement for the official administration [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[692,5],"tags":[297,396,110,693,787],"class_list":["post-6982","post","type-post","status-publish","format-standard","hentry","category-pure-storage","category-storage","tag-basics","tag-cli","tag-howto","tag-pure-storage-2","tag-storage"],"_links":{"self":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts\/6982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/comments?post=6982"}],"version-history":[{"count":10,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts\/6982\/revisions"}],"predecessor-version":[{"id":7005,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts\/6982\/revisions\/7005"}],"wp:attachment":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/media?parent=6982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/categories?post=6982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/tags?post=6982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}