<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://oldwiki.scinet.utoronto.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pinto</id>
	<title>oldwiki.scinet.utoronto.ca - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://oldwiki.scinet.utoronto.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pinto"/>
	<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php/Special:Contributions/Pinto"/>
	<updated>2026-05-13T00:43:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.12</generator>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Transfer&amp;diff=9423</id>
		<title>Data Transfer</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Transfer&amp;diff=9423"/>
		<updated>2018-09-20T15:23:26Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Globus data transfer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== General guidelines ===&lt;br /&gt;
&lt;br /&gt;
All traffic to and from the data centre has to go via [http://en.wikipedia.org/wiki/Secure_Shell SSH], or secure shell.&lt;br /&gt;
This is a protocol which sets up a secure connection between two sites.  In all cases, incoming connections to SciNet go through relatively low-speed connections to the login.scinet gateways, but there are many ways to copy files on top of the ssh protocol.&lt;br /&gt;
&lt;br /&gt;
What node to use for data transfer to and from SciNet depends mostly on the amount of data to transfer:&lt;br /&gt;
&lt;br /&gt;
==== Moving &amp;lt;10GB through the login nodes ====&lt;br /&gt;
&lt;br /&gt;
The login nodes are accessible from outside SciNet, which means that you can transfer data between your own office/home machine and SciNet using scp or rsync (see below). Although the login nodes have a cpu_time timeout of 5 minutes (emphasis on cpu_time, not wall_time), most likely if you try to transfer more than 10GB probably you wouldn't succeed.  While the login nodes can be used for transfers of less than 10GB, using a datamover node would still be faster.&lt;br /&gt;
&lt;br /&gt;
Note that transfers through a login node will timeout after a certain time (currently set to 5 minutes cpu_time), so if you have a slow connection you may need to go through datamover1.&lt;br /&gt;
&lt;br /&gt;
==== Moving &amp;gt;10GB through the datamover1 node ====&lt;br /&gt;
&lt;br /&gt;
Serious moves of data (&amp;gt;10GB) to or from SciNet should be done from &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt; nodes. From any of the interactive SciNet nodes, one should be able to &amp;lt;tt&amp;gt;ssh datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;ssh datmover2&amp;lt;/tt&amp;gt; to log in. Those are the machines that have the fastest network connections to the outside world (by a factor of 10; a 10Gb/s link as vs 1Gb/s).  &lt;br /&gt;
&lt;br /&gt;
Transfers must be ''originated'' from &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt;; that is, one can not copy files from the outside world directly to or from the datamovers; one has to log in to a datamover and copy the data to or from the outside network. Your local machine must be reachable from the outside as well, either by its name or its IP address. If you are behind a firewall or a (wireless) router, this may not be possible. You may need to ask your network administrator to allow the datamovers to ssh to your machine. If you need to open a hole on your firewall we provide their IPs:&lt;br /&gt;
&lt;br /&gt;
 datamover1 142.150.188.121&lt;br /&gt;
 datamover2 142.150.188.122&lt;br /&gt;
&lt;br /&gt;
==== Hpn-ssh ====&lt;br /&gt;
&lt;br /&gt;
The usual ssh protocols were not designed for speed.   On the &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt; nodes, we have installed hpn-ssh, or [http://www.psc.edu/networking/projects/hpn-ssh/ High-Performance-enabled ssh].   You use this higher-performance ssh/scp/sftp variant by loading the `hpnssh' module.   Hpn-ssh is backwards compatible with the `usual' ssh, but is capable of significantly higher speeds.   If you routinely have large data transfers to do, we recommend having your system administrator look into installing [http://www.psc.edu/networking/projects/hpn-ssh/ hpn-ssh] on your system.  &lt;br /&gt;
&lt;br /&gt;
Everything we discuss below, unless otherwise stated, will work regardless of whether you have hpn-ssh installed on your remote system.&lt;br /&gt;
&lt;br /&gt;
==== For Microsoft Windows users ====&lt;br /&gt;
&lt;br /&gt;
Linux-windows transfers can be a bit more involved than linux-to-linux, but using [http://www.cygwin.com Cygwin], this should not be a problem. Make sure you install Cygwin with the openssh package.&lt;br /&gt;
&lt;br /&gt;
If you want to remain 100% a Windows environment, another very good tool is [http://winscp.net/eng/index.php WinSCP]. It will let you easily transfer and synchronize data between your Windows workstation and the login nodes using your ssh credentials (provided that it's not much more than 10GB on each sync pass).&lt;br /&gt;
&lt;br /&gt;
If you are going to use the [[Data_Management#Moving_.3E10GB_through_the_datamover1_node | datamover1 method]], and assuming your machine is not a wireless laptop (if it &lt;br /&gt;
is, best to find a nearby computer that's not wireless and use a usb &lt;br /&gt;
memory stick), you'll need the IP address of your machine, which you find by &lt;br /&gt;
typing &amp;quot;ipconfig /all&amp;quot; on your local windows machine. Also, you will need to have the ssh daemon (sshd) running locally in Cygwin.&lt;br /&gt;
&lt;br /&gt;
Also note that your windows user name does not have to be the same as on SciNet, this just &lt;br /&gt;
depends on how your local windows system was set up. &lt;br /&gt;
&lt;br /&gt;
All locations given to scp or rsync in cygwin have to be in unix format (using &amp;quot;/&amp;quot; not &amp;quot;\&amp;quot;), and will be relative to cygwin's path, not windows (e.g.&lt;br /&gt;
use /cygdrive/c/...... to get to the windows C: drive).&lt;br /&gt;
&lt;br /&gt;
=== Ways to transfer data ===&lt;br /&gt;
&lt;br /&gt;
==== Globus data transfer ====&lt;br /&gt;
&lt;br /&gt;
Globus is a file-transfer service with an easy-to-use web interface to allow people to transfer file with ease.  To get started, please sign up for a Globus account at [https://www.globus.org/ Globus website].  Once you sign up for an account, go to [https://www.globus.org/xfer/StartTransfer this page] to start the file transfer.  Please enter computecanada#niagara as one endpoint for file transfer. If you are trying to transfer data from a laptop or desktop, you will need to install Globus Connect Personal software available [https://www.globus.org/globus-connect-personal here] to setup an endpoint for the laptop or desktop and perform the transfer.&lt;br /&gt;
&lt;br /&gt;
Please see the following [https://docs.computecanada.ca/wiki/Globus page] on how to setup Globus to perform data transfer.&lt;br /&gt;
&lt;br /&gt;
==== scp ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt;, or secure copy, is the easiest way to copy files, although we generally find rsync below to be faster.&lt;br /&gt;
&lt;br /&gt;
scp works like cp to copy files:&lt;br /&gt;
&lt;br /&gt;
 $ scp original_file  copy_file&lt;br /&gt;
&lt;br /&gt;
except that either the original or the copy can be on another system:&lt;br /&gt;
 &lt;br /&gt;
 $ scp jonsdatafile.bin jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
&lt;br /&gt;
will copy the data file into the directory &amp;lt;tt&amp;gt;/home/jon/bigdatadir/&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;remote.system.com&amp;lt;/tt&amp;gt; after logging in as &amp;lt;tt&amp;gt;jon&amp;lt;/tt&amp;gt;; you will be prompted for a password (unless you've set up ssh keys).&lt;br /&gt;
&lt;br /&gt;
Copying from remote systems works the same way:&lt;br /&gt;
&lt;br /&gt;
 $ scp jon@remote.system.com:/home/jon/bigdatadir/newdata.bin .&lt;br /&gt;
&lt;br /&gt;
And wildcards work as you'd expect (except you have to quote the wildcards on the remote system, as it can't expand properly here.)&lt;br /&gt;
&lt;br /&gt;
 $ scp *.bin jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
 $ scp jon@remote.system.com:&amp;quot;/home/jon/inputdata/*&amp;quot; .&lt;br /&gt;
&lt;br /&gt;
There are few options worth knowing about:  &lt;br /&gt;
* &amp;lt;tt&amp;gt;scp -C&amp;lt;/tt&amp;gt; compresses the file before transmitting it; ''if'' the file compresses well, this can significantly increase the effective data transfer rate (though usually not as much as compressing the data, then sending it, then uncompressing).  If the file doesn't compress well, than this adds CPU overhead without accomplishing much, and can slow down your data transfer.&lt;br /&gt;
* &amp;lt;tt&amp;gt;scp -oNoneEnabled=yes -oNoneSwitch=yes&amp;lt;/tt&amp;gt; -- This is an hpn-ssh only option.  If CPU overhead is a significant bottleneck in the data transfer, then we can avoid this by turning off the secure encryption of the data.   For most of us, this is ok, but for others it is not.  In either cases, '''authentication''' remains secure, it is only the data transfer that is in plaintext.&lt;br /&gt;
&lt;br /&gt;
==== rsync ====&lt;br /&gt;
&lt;br /&gt;
[http://samba.anu.edu.au/rsync/ rsync] is a very powerful tool for mirroring directories of data.   &lt;br /&gt;
 $ rsync -av -e ssh scinetdatadir jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
rsync has a dizzying number of options; the above syncs &amp;lt;tt&amp;gt;scinetdatadir&amp;lt;/tt&amp;gt; ''to'' the remote system; that is, any files that are newer on the localsystem are updated on the remote system.  The converse isn't true; if there were newer files on the remote system, you'd have to bring those over with&lt;br /&gt;
 $ rsync -av -e ssh jon@remote.system.com:/home/jon/bigdatadir/ scinetdatadir &lt;br /&gt;
The &amp;lt;tt&amp;gt;-av&amp;lt;/tt&amp;gt; options are for verbose and `archive' mode, which preserves timestamps and permissions, which is normally what you want.  &amp;lt;tt&amp;gt;-e ssh&amp;lt;/tt&amp;gt; tells it to use ssh for the transfer.&lt;br /&gt;
&lt;br /&gt;
One of the powerful things about rsync is that it looks to see what files already exist before copying, so you can use it repeatedly as a data directory fills and it won't make unnecessary copies; similarly, if a (say) log file grows over time, it will only copy the difference between the files, further speeding things up.   This also means that it behaves well if a transfer is interrupted; a second invocation of rsync will continue where the other left off.&lt;br /&gt;
&lt;br /&gt;
As with &amp;lt;tt&amp;gt;scp -C&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;rsync -z&amp;lt;/tt&amp;gt; compresses on the fly, which can significantly enhance effective data transfer rates if the files compress well, or hurt it if not.&lt;br /&gt;
&lt;br /&gt;
As with scp, if both sides are running hpn-ssh one can disable encryption of the data stream should that prove to be a bottleneck:&lt;br /&gt;
 $ rsync -av -e &amp;quot;ssh -oNoneEnabled=yes -oNoneSwitch=yes&amp;quot; jon@remote.system.com:/home/jon/bigdatadir/ scinetdatadir&lt;br /&gt;
&lt;br /&gt;
SciNet's login nodes, 142.150.188.5[1-4], are publicly accessible and can be used for data transfer as long as your material is not one big chunk (much more than 2-3GB each file). We have a 5 minutes CPU time limit on the login nodes and the transfer process may be killed by the kernel before completion. The workaround is to transfer your data using a rsync loop, by checking the rsync return code, assuming some files can be transferred before reaching the CPU limit. For example in a bash shell:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for i in {1..100}; do   ### try 100 times&lt;br /&gt;
    rsync ...&lt;br /&gt;
    [ &amp;quot;$?&amp;quot; == &amp;quot;0&amp;quot; ] &amp;amp;&amp;amp; break&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ssh tunnel ====&lt;br /&gt;
&lt;br /&gt;
Alternatively you may use a reverse ssh tunnel (ssh -R).&lt;br /&gt;
&lt;br /&gt;
If your transfer is above 10GB you will need to use one of SciNet's datamovers. If your workstation is behind a firewall (as the datamovers are), you'll need a node external to your firewall, on the edge of your organization's network, that will serve as a gateway, and can be accessible via ssh by both your workstation and the datamovers. Initiate a &amp;quot;ssh -R&amp;quot; connection from SciNet's datamover to that node. This node needs to have its ssh GatewayPorts enabled so that your workstation can connect to the specified port on that node, which will forward the traffic back to SciNet's datamover.&lt;br /&gt;
&lt;br /&gt;
=== Transfer speeds ===&lt;br /&gt;
&lt;br /&gt;
==== What transfer speeds could I expect? ====&lt;br /&gt;
&lt;br /&gt;
Below are some typical transfer numbers from datamover1 to another University of Toronto machine with a 1Gb/s link to the campus network:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!{{Hl2}}|  Mode&lt;br /&gt;
!{{Hl2}}|  With hpn-ssh&lt;br /&gt;
!{{Hl2}}|  Without&lt;br /&gt;
|-&lt;br /&gt;
|  rsync&lt;br /&gt;
|  60-80 MB/s&lt;br /&gt;
|  30-40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
|  scp&lt;br /&gt;
|  50 MB/s&lt;br /&gt;
|  25 MB/s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== What can slow down my data transfer? ====&lt;br /&gt;
&lt;br /&gt;
To move data quickly, ''all'' of the stages in the process have to be fast; the file system you are reading data from, the CPU reading the data, the network connection between the sender and the reciever, and the recipient CPU and disk.   The slowest element in that chain will slow down the entire transfer.&lt;br /&gt;
&lt;br /&gt;
On SciNet's side, our underlying filesystem is the high-performance [http://www-03.ibm.com/systems/software/gpfs/index.html GPFS] system, and the node we recommend you use (datamover1) has a high-speed connection to the network and fast CPUs.&lt;br /&gt;
&lt;br /&gt;
==== Why are my transfers so much slower? ====&lt;br /&gt;
&lt;br /&gt;
If you get numbers significantly lower than above, then there is a bottleneck in the transfer.   The first thing to do is to run &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; on datamover1; if other people are transfering large files at the same time you are trying to, network congestion could result and you'll just have to wait until they are done.&lt;br /&gt;
&lt;br /&gt;
If nothing else is going on on datamover1, there are a number of possibilites:&lt;br /&gt;
* network connection between SciNet and your machine - do you know the network connection of your remote machine?   Are your systems connections tuned for performance [http://www.psc.edu/networking/projects/tcptune]?&lt;br /&gt;
* is the remote server busy?&lt;br /&gt;
* are the remote servers disks busy, or known to be slow?&lt;br /&gt;
&lt;br /&gt;
For any further questions, contact us at [mailto:support@scinet.utoronto.ca Support @ SciNet]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Transfer&amp;diff=9422</id>
		<title>Data Transfer</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Transfer&amp;diff=9422"/>
		<updated>2018-09-20T15:21:49Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Globus data transfer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== General guidelines ===&lt;br /&gt;
&lt;br /&gt;
All traffic to and from the data centre has to go via [http://en.wikipedia.org/wiki/Secure_Shell SSH], or secure shell.&lt;br /&gt;
This is a protocol which sets up a secure connection between two sites.  In all cases, incoming connections to SciNet go through relatively low-speed connections to the login.scinet gateways, but there are many ways to copy files on top of the ssh protocol.&lt;br /&gt;
&lt;br /&gt;
What node to use for data transfer to and from SciNet depends mostly on the amount of data to transfer:&lt;br /&gt;
&lt;br /&gt;
==== Moving &amp;lt;10GB through the login nodes ====&lt;br /&gt;
&lt;br /&gt;
The login nodes are accessible from outside SciNet, which means that you can transfer data between your own office/home machine and SciNet using scp or rsync (see below). Although the login nodes have a cpu_time timeout of 5 minutes (emphasis on cpu_time, not wall_time), most likely if you try to transfer more than 10GB probably you wouldn't succeed.  While the login nodes can be used for transfers of less than 10GB, using a datamover node would still be faster.&lt;br /&gt;
&lt;br /&gt;
Note that transfers through a login node will timeout after a certain time (currently set to 5 minutes cpu_time), so if you have a slow connection you may need to go through datamover1.&lt;br /&gt;
&lt;br /&gt;
==== Moving &amp;gt;10GB through the datamover1 node ====&lt;br /&gt;
&lt;br /&gt;
Serious moves of data (&amp;gt;10GB) to or from SciNet should be done from &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt; nodes. From any of the interactive SciNet nodes, one should be able to &amp;lt;tt&amp;gt;ssh datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;ssh datmover2&amp;lt;/tt&amp;gt; to log in. Those are the machines that have the fastest network connections to the outside world (by a factor of 10; a 10Gb/s link as vs 1Gb/s).  &lt;br /&gt;
&lt;br /&gt;
Transfers must be ''originated'' from &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt;; that is, one can not copy files from the outside world directly to or from the datamovers; one has to log in to a datamover and copy the data to or from the outside network. Your local machine must be reachable from the outside as well, either by its name or its IP address. If you are behind a firewall or a (wireless) router, this may not be possible. You may need to ask your network administrator to allow the datamovers to ssh to your machine. If you need to open a hole on your firewall we provide their IPs:&lt;br /&gt;
&lt;br /&gt;
 datamover1 142.150.188.121&lt;br /&gt;
 datamover2 142.150.188.122&lt;br /&gt;
&lt;br /&gt;
==== Hpn-ssh ====&lt;br /&gt;
&lt;br /&gt;
The usual ssh protocols were not designed for speed.   On the &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt; nodes, we have installed hpn-ssh, or [http://www.psc.edu/networking/projects/hpn-ssh/ High-Performance-enabled ssh].   You use this higher-performance ssh/scp/sftp variant by loading the `hpnssh' module.   Hpn-ssh is backwards compatible with the `usual' ssh, but is capable of significantly higher speeds.   If you routinely have large data transfers to do, we recommend having your system administrator look into installing [http://www.psc.edu/networking/projects/hpn-ssh/ hpn-ssh] on your system.  &lt;br /&gt;
&lt;br /&gt;
Everything we discuss below, unless otherwise stated, will work regardless of whether you have hpn-ssh installed on your remote system.&lt;br /&gt;
&lt;br /&gt;
==== For Microsoft Windows users ====&lt;br /&gt;
&lt;br /&gt;
Linux-windows transfers can be a bit more involved than linux-to-linux, but using [http://www.cygwin.com Cygwin], this should not be a problem. Make sure you install Cygwin with the openssh package.&lt;br /&gt;
&lt;br /&gt;
If you want to remain 100% a Windows environment, another very good tool is [http://winscp.net/eng/index.php WinSCP]. It will let you easily transfer and synchronize data between your Windows workstation and the login nodes using your ssh credentials (provided that it's not much more than 10GB on each sync pass).&lt;br /&gt;
&lt;br /&gt;
If you are going to use the [[Data_Management#Moving_.3E10GB_through_the_datamover1_node | datamover1 method]], and assuming your machine is not a wireless laptop (if it &lt;br /&gt;
is, best to find a nearby computer that's not wireless and use a usb &lt;br /&gt;
memory stick), you'll need the IP address of your machine, which you find by &lt;br /&gt;
typing &amp;quot;ipconfig /all&amp;quot; on your local windows machine. Also, you will need to have the ssh daemon (sshd) running locally in Cygwin.&lt;br /&gt;
&lt;br /&gt;
Also note that your windows user name does not have to be the same as on SciNet, this just &lt;br /&gt;
depends on how your local windows system was set up. &lt;br /&gt;
&lt;br /&gt;
All locations given to scp or rsync in cygwin have to be in unix format (using &amp;quot;/&amp;quot; not &amp;quot;\&amp;quot;), and will be relative to cygwin's path, not windows (e.g.&lt;br /&gt;
use /cygdrive/c/...... to get to the windows C: drive).&lt;br /&gt;
&lt;br /&gt;
=== Ways to transfer data ===&lt;br /&gt;
&lt;br /&gt;
==== Globus data transfer ====&lt;br /&gt;
&lt;br /&gt;
Globus is a file-transfer service with an easy-to-use web interface to allow people to transfer file with ease.  To get started, please sign up for a Globus account at [https://www.globus.org/ Globus website].  Once you sign up for an account, go to [https://www.globus.org/xfer/StartTransfer this page] to start the file transfer.  Please enter computecanada#niagara as one endpoint for file transfer. If you are trying to transfer data from a laptop or desktop, you will need to install Globus Connect Personal software available [https://support.globus.org/entries/24044351 here] to setup an endpoint for the laptop or desktop and perform the transfer.&lt;br /&gt;
&lt;br /&gt;
Please see the following [https://docs.computecanada.ca/wiki/Globus page] on how to setup Globus to perform data transfer.&lt;br /&gt;
&lt;br /&gt;
==== scp ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt;, or secure copy, is the easiest way to copy files, although we generally find rsync below to be faster.&lt;br /&gt;
&lt;br /&gt;
scp works like cp to copy files:&lt;br /&gt;
&lt;br /&gt;
 $ scp original_file  copy_file&lt;br /&gt;
&lt;br /&gt;
except that either the original or the copy can be on another system:&lt;br /&gt;
 &lt;br /&gt;
 $ scp jonsdatafile.bin jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
&lt;br /&gt;
will copy the data file into the directory &amp;lt;tt&amp;gt;/home/jon/bigdatadir/&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;remote.system.com&amp;lt;/tt&amp;gt; after logging in as &amp;lt;tt&amp;gt;jon&amp;lt;/tt&amp;gt;; you will be prompted for a password (unless you've set up ssh keys).&lt;br /&gt;
&lt;br /&gt;
Copying from remote systems works the same way:&lt;br /&gt;
&lt;br /&gt;
 $ scp jon@remote.system.com:/home/jon/bigdatadir/newdata.bin .&lt;br /&gt;
&lt;br /&gt;
And wildcards work as you'd expect (except you have to quote the wildcards on the remote system, as it can't expand properly here.)&lt;br /&gt;
&lt;br /&gt;
 $ scp *.bin jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
 $ scp jon@remote.system.com:&amp;quot;/home/jon/inputdata/*&amp;quot; .&lt;br /&gt;
&lt;br /&gt;
There are few options worth knowing about:  &lt;br /&gt;
* &amp;lt;tt&amp;gt;scp -C&amp;lt;/tt&amp;gt; compresses the file before transmitting it; ''if'' the file compresses well, this can significantly increase the effective data transfer rate (though usually not as much as compressing the data, then sending it, then uncompressing).  If the file doesn't compress well, than this adds CPU overhead without accomplishing much, and can slow down your data transfer.&lt;br /&gt;
* &amp;lt;tt&amp;gt;scp -oNoneEnabled=yes -oNoneSwitch=yes&amp;lt;/tt&amp;gt; -- This is an hpn-ssh only option.  If CPU overhead is a significant bottleneck in the data transfer, then we can avoid this by turning off the secure encryption of the data.   For most of us, this is ok, but for others it is not.  In either cases, '''authentication''' remains secure, it is only the data transfer that is in plaintext.&lt;br /&gt;
&lt;br /&gt;
==== rsync ====&lt;br /&gt;
&lt;br /&gt;
[http://samba.anu.edu.au/rsync/ rsync] is a very powerful tool for mirroring directories of data.   &lt;br /&gt;
 $ rsync -av -e ssh scinetdatadir jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
rsync has a dizzying number of options; the above syncs &amp;lt;tt&amp;gt;scinetdatadir&amp;lt;/tt&amp;gt; ''to'' the remote system; that is, any files that are newer on the localsystem are updated on the remote system.  The converse isn't true; if there were newer files on the remote system, you'd have to bring those over with&lt;br /&gt;
 $ rsync -av -e ssh jon@remote.system.com:/home/jon/bigdatadir/ scinetdatadir &lt;br /&gt;
The &amp;lt;tt&amp;gt;-av&amp;lt;/tt&amp;gt; options are for verbose and `archive' mode, which preserves timestamps and permissions, which is normally what you want.  &amp;lt;tt&amp;gt;-e ssh&amp;lt;/tt&amp;gt; tells it to use ssh for the transfer.&lt;br /&gt;
&lt;br /&gt;
One of the powerful things about rsync is that it looks to see what files already exist before copying, so you can use it repeatedly as a data directory fills and it won't make unnecessary copies; similarly, if a (say) log file grows over time, it will only copy the difference between the files, further speeding things up.   This also means that it behaves well if a transfer is interrupted; a second invocation of rsync will continue where the other left off.&lt;br /&gt;
&lt;br /&gt;
As with &amp;lt;tt&amp;gt;scp -C&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;rsync -z&amp;lt;/tt&amp;gt; compresses on the fly, which can significantly enhance effective data transfer rates if the files compress well, or hurt it if not.&lt;br /&gt;
&lt;br /&gt;
As with scp, if both sides are running hpn-ssh one can disable encryption of the data stream should that prove to be a bottleneck:&lt;br /&gt;
 $ rsync -av -e &amp;quot;ssh -oNoneEnabled=yes -oNoneSwitch=yes&amp;quot; jon@remote.system.com:/home/jon/bigdatadir/ scinetdatadir&lt;br /&gt;
&lt;br /&gt;
SciNet's login nodes, 142.150.188.5[1-4], are publicly accessible and can be used for data transfer as long as your material is not one big chunk (much more than 2-3GB each file). We have a 5 minutes CPU time limit on the login nodes and the transfer process may be killed by the kernel before completion. The workaround is to transfer your data using a rsync loop, by checking the rsync return code, assuming some files can be transferred before reaching the CPU limit. For example in a bash shell:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for i in {1..100}; do   ### try 100 times&lt;br /&gt;
    rsync ...&lt;br /&gt;
    [ &amp;quot;$?&amp;quot; == &amp;quot;0&amp;quot; ] &amp;amp;&amp;amp; break&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ssh tunnel ====&lt;br /&gt;
&lt;br /&gt;
Alternatively you may use a reverse ssh tunnel (ssh -R).&lt;br /&gt;
&lt;br /&gt;
If your transfer is above 10GB you will need to use one of SciNet's datamovers. If your workstation is behind a firewall (as the datamovers are), you'll need a node external to your firewall, on the edge of your organization's network, that will serve as a gateway, and can be accessible via ssh by both your workstation and the datamovers. Initiate a &amp;quot;ssh -R&amp;quot; connection from SciNet's datamover to that node. This node needs to have its ssh GatewayPorts enabled so that your workstation can connect to the specified port on that node, which will forward the traffic back to SciNet's datamover.&lt;br /&gt;
&lt;br /&gt;
=== Transfer speeds ===&lt;br /&gt;
&lt;br /&gt;
==== What transfer speeds could I expect? ====&lt;br /&gt;
&lt;br /&gt;
Below are some typical transfer numbers from datamover1 to another University of Toronto machine with a 1Gb/s link to the campus network:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!{{Hl2}}|  Mode&lt;br /&gt;
!{{Hl2}}|  With hpn-ssh&lt;br /&gt;
!{{Hl2}}|  Without&lt;br /&gt;
|-&lt;br /&gt;
|  rsync&lt;br /&gt;
|  60-80 MB/s&lt;br /&gt;
|  30-40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
|  scp&lt;br /&gt;
|  50 MB/s&lt;br /&gt;
|  25 MB/s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== What can slow down my data transfer? ====&lt;br /&gt;
&lt;br /&gt;
To move data quickly, ''all'' of the stages in the process have to be fast; the file system you are reading data from, the CPU reading the data, the network connection between the sender and the reciever, and the recipient CPU and disk.   The slowest element in that chain will slow down the entire transfer.&lt;br /&gt;
&lt;br /&gt;
On SciNet's side, our underlying filesystem is the high-performance [http://www-03.ibm.com/systems/software/gpfs/index.html GPFS] system, and the node we recommend you use (datamover1) has a high-speed connection to the network and fast CPUs.&lt;br /&gt;
&lt;br /&gt;
==== Why are my transfers so much slower? ====&lt;br /&gt;
&lt;br /&gt;
If you get numbers significantly lower than above, then there is a bottleneck in the transfer.   The first thing to do is to run &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; on datamover1; if other people are transfering large files at the same time you are trying to, network congestion could result and you'll just have to wait until they are done.&lt;br /&gt;
&lt;br /&gt;
If nothing else is going on on datamover1, there are a number of possibilites:&lt;br /&gt;
* network connection between SciNet and your machine - do you know the network connection of your remote machine?   Are your systems connections tuned for performance [http://www.psc.edu/networking/projects/tcptune]?&lt;br /&gt;
* is the remote server busy?&lt;br /&gt;
* are the remote servers disks busy, or known to be slow?&lt;br /&gt;
&lt;br /&gt;
For any further questions, contact us at [mailto:support@scinet.utoronto.ca Support @ SciNet]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Management&amp;diff=9372</id>
		<title>Data Management</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Management&amp;diff=9372"/>
		<updated>2018-06-25T20:27:04Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Storage Space'''==&lt;br /&gt;
SciNet's storage system is based on IBM's [http://en.wikipedia.org/wiki/IBM_General_Parallel_File_System GPFS] (General Parallel File System).   There are two main systems for user data: &amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt;, a small, backed-up space where user home directories are located, and &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt;, a large system for input or output data for jobs; data on &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt; is not only not backed up (a third storage system, /project, exist only for groups with LRAC/NRAC allocations). Data placed on scratch will be deleted if it has not been accessed in 3 months.  SciNet does not provide long-term storage for large data sets.  &lt;br /&gt;
&lt;br /&gt;
===Overview of the different file systems===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! {{Hl2}} | file system &lt;br /&gt;
! {{Hl2}} | purpose &lt;br /&gt;
! {{Hl2}} | user quota &lt;br /&gt;
! {{Hl2}} | block size &lt;br /&gt;
! {{Hl2}} | backed up&lt;br /&gt;
! {{Hl2}} | purged&lt;br /&gt;
! {{Hl2}} | access &lt;br /&gt;
|- &lt;br /&gt;
| /home&lt;br /&gt;
| development&lt;br /&gt;
| 50 GB&lt;br /&gt;
| 256 KB&lt;br /&gt;
| yes&lt;br /&gt;
| never&lt;br /&gt;
| read-only on compute nodes (r/w on login, devel and datamover1) &lt;br /&gt;
|- &lt;br /&gt;
| /scratch&lt;br /&gt;
| computation&lt;br /&gt;
| first of (20 TB ; 1 million files)&lt;br /&gt;
| 4 MB&lt;br /&gt;
| no&lt;br /&gt;
| files &amp;gt; 3 months&lt;br /&gt;
| read/write on all nodes&lt;br /&gt;
|- &lt;br /&gt;
| /project&lt;br /&gt;
| computation&lt;br /&gt;
| by allocation&lt;br /&gt;
| 256 KB&lt;br /&gt;
| yes&lt;br /&gt;
| never&lt;br /&gt;
| read/write on all nodes &lt;br /&gt;
|}&lt;br /&gt;
project is included in scratch&lt;br /&gt;
&lt;br /&gt;
===Home Disk Space===&lt;br /&gt;
&lt;br /&gt;
Every SciNet user gets a 50GB directory on &amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt; in a directory &amp;lt;tt&amp;gt;/home/G/GROUP/USER&amp;lt;/tt&amp;gt;, which is regularly backed-up.   Home is visible from &amp;lt;tt&amp;gt;login.scinet&amp;lt;/tt&amp;gt; nodes, and from the development nodes on [[GPC_Quickstart | GPC]] and the [[TCS_Quickstart | TCS]].  However, on the compute nodes of the GPC clusters -- as when jobs are running -- &amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt; is mounted '''''read-only'''''; thus GPC jobs can read files in /home but cannot write to files there.   &amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt; is a good place to put code, input files for runs, and anything else that needs to be kept to reproduce runs.  On the other hand, &amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt; is not a good place to put many small files, since&lt;br /&gt;
the block size for the file system is 256KB, so you would quickly run out of disk quota and you will make the backup system very slow.&lt;br /&gt;
&lt;br /&gt;
If your application absolutely insists on writing material to your home account and you can't find a way to instruct it to write somewhere else, an alternative is to create a link pointing from your account under /home to a location under /scratch.&lt;br /&gt;
&lt;br /&gt;
===Scratch Disk Space===&lt;br /&gt;
&lt;br /&gt;
Every SciNet user also gets a directory in &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt; called &amp;lt;tt&amp;gt;/scratch/G/GROUP/USER&amp;lt;/tt&amp;gt;.   Scratch is visible from the &amp;lt;tt&amp;gt;login.scinet&amp;lt;/tt&amp;gt; nodes,  the development nodes on [[GPC_Quickstart | GPC]] and the [[TCS_Quickstart | TCS]], and on the compute nodes of the clusters, mounted as read-write.   Thus jobs would normally write their output somewhere in &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt;.  There are '''NO''' backups of anything on &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
There is a large amount of space available on &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt; but it is purged routinely so that all users running jobs and generating large outputs will have room to store their data temporarily.  Computational results which you want to keep longer than this must be copied (using &amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt;) off of SciNet entirely and to your local system.   SciNet does not routinely provide long-term storage for large data sets. &lt;br /&gt;
&lt;br /&gt;
Also note that the shared parallel file system was not designed to do many small file transactions. For that reason, the number of files that any user can have on scratch is limited to 1 million. This limit should be thought of as a safeguard, not an invitation to create one million files. Please see [[File System and I/O dos and don'ts]]. &lt;br /&gt;
&lt;br /&gt;
===Scratch Disk Purging Policy===&lt;br /&gt;
&lt;br /&gt;
In order to ensure that there is always significant space available for running jobs '''we automatically delete files in /scratch that have not been accessed or modified for more than 3 months by the actual deletion day on the 15th of each month'''. Note that we recently changed the cut out reference to the ''MostRecentOf(atime,mtime)''. This policy is subject to revision depending on its effectiveness. More details about the purging process and how users can check if their files will be deleted follows. If you have files scheduled for deletion you should move them to a more permanent locations such as your departmental server or your /project space (for PIs who have either been allocated disk space by the LRAC or have bought diskspace).&lt;br /&gt;
&lt;br /&gt;
On the '''first''' of each month, a list of files scheduled for purging is produced, and an email notification is sent to each user on that list. Furthermore, at/or about the '''12th''' of each month a 2nd scan produces a more current assessment and another email notification is sent. This way users can double check that they have indeed taken care of all the files they needed to relocate before the purging deadline. Those files will be automatically deleted on the '''15th''' of the same month unless they have been accessed or relocated in the interim. If you have files scheduled for deletion then they will be listed in a file in /scratch/t/todelete/current, which has your userid and groupid in the filename. For example, if user xxyz wants to check if they have files scheduled for deletion they can issue the following command on a system which mounts /scratch (e.g. a scinet login node): '''ls -1 /scratch/t/todelete/current |grep xxyz'''. In the example below, the name of this file indicates that user xxyz is part of group abc, has 9,560 files scheduled for deletion and they take up 1.0TB of space:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 [xxyz@scinet04 ~]$ ls -1 /scratch/t/todelete/current |grep xxyz&lt;br /&gt;
 -rw-r----- 1 xxyz     root       1733059 Jan 12 11:46 10001___xxyz_______abc_________1.00T_____9560files&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file itself contains a list of all files scheduled for deletion (in the last column) and can be viewed with standard commands like more/less/cat - e.g. '''more /scratch/t/todelete/current/10001___xxyz_______abc_________1.00T_____9560files'''&lt;br /&gt;
&lt;br /&gt;
Similarly, you can also verify all other users on your group by using the ls command with grep on your group. For example: '''ls -1 /scratch/t/todelete/current |grep abc'''. That will list all other users in the same group that xxyz is part of, and have files to be purged on the 15th. Members of the same group have access to each other's contents.&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' Preparing these assessments takes several hours. If you change the access/modification time of a file in the interim, that will not be detected until the next cycle. A way for you to get immediate feedback is to use the ''''ls -lu'''' command on the file to verify the atime and ''''ls -la'''' for the mtime. If the file atime/mtime has been updated in the meantime, coming the purging date on the 15th it will no longer be deleted.&lt;br /&gt;
&lt;br /&gt;
===Project Disk Space===&lt;br /&gt;
&lt;br /&gt;
Investigators who have been granted allocations through the [http://wiki.scinethpc.ca/wiki/index.php/Application_Process LRAC/NRAC Application Process] may have been allocated disk space in addition to compute time.   For the period of time that the allocation is granted, they will have disk space on the &amp;lt;tt&amp;gt;/project&amp;lt;/tt&amp;gt; disk system.  Space on project is a subset of scratch, but is not purged and is backed up. All members of the investigators groups will have access to this disk system, which will be mounted read/write everywhere.&lt;br /&gt;
&lt;br /&gt;
===How much Disk Space Do I have left?===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;'''/scinet/gpc/bin6/diskUsage'''&amp;lt;/tt&amp;gt; command, available on the login nodes, datamovers and the GPC devel nodes, provides information in a number of ways on the home, scratch, and project file systems. For instance, how much disk space is being used by yourself and your group (with the -a option), or how much your usage has changed over a certain period (&amp;quot;delta information&amp;quot;) or you may generate plots of your usage over time. Please see the usage help below for more details.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Usage: diskUsage [-h|-?| [-a] [-u &amp;lt;user&amp;gt;] [-de|-plot]&lt;br /&gt;
       -h|-?: help&lt;br /&gt;
       -a: list usages of all members on the group&lt;br /&gt;
       -u &amp;lt;user&amp;gt;: as another user on your group&lt;br /&gt;
       -de: include delta information&lt;br /&gt;
       -plot: create plots of disk usages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Did you know that you can check which of your directories have more than 1000 files with the &amp;lt;tt&amp;gt;'''/scinet/gpc/bin6/topUserDirOver1000list'''&amp;lt;/tt&amp;gt; command and which have more than 1GB of material with the &amp;lt;tt&amp;gt;'''/scinet/gpc/bin6/topUserDirOver1GBlist'''&amp;lt;/tt&amp;gt; command?&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* information on usage and quota is only updated hourly!&lt;br /&gt;
* contents of project count against space and #files limits on scratch&lt;br /&gt;
&lt;br /&gt;
===Performance===&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/IBM_General_Parallel_File_System GPFS] is a high-performance filesystem which provides rapid reads and writes to large datasets in parallel from many nodes.  As a consequence of this design, however, '''the file system performs quite ''poorly'' at accessing data sets which consist of many, small files.'''  For instance, you will find that reading data in from one 16MB file is enormously faster than from 400 40KB files. Such small files are also quite wasteful of space, as the blocksize for the scratch filesystem is 16MB. This is something you should keep in mind when planning your input/output strategy for runs on SciNet.&lt;br /&gt;
&lt;br /&gt;
For instance, if you run multi-process jobs, having each process write to a file of its own is not an scalable I/O solution. A directory gets locked by the first process accessing it, so all other processes have to wait for it. Not only has the code just become considerably less parallel, chances are the file system will have a time-out while waiting for your other processes, leading your program to crash mysteriously.&lt;br /&gt;
Consider using MPI-IO (part of the MPI-2 standard), which allows files to be opened simultaneously by different processes, or using a dedicated process for I/O to which all other processes send their data, and which subsequently writes this data to a single file.&lt;br /&gt;
&lt;br /&gt;
===Local Disk===&lt;br /&gt;
&lt;br /&gt;
The compute nodes on the GPC '''do not contain hard drives''' so there is no local disk available to use during your computation.  You can however use part of a compute nodes RAM like a local disk ('ramdisk') but this will reduce how much memory is available for your&lt;br /&gt;
program.  This can be accessed using &amp;lt;tt&amp;gt;/dev/shm/&amp;lt;/tt&amp;gt; and is currently set to 8GB.  Anything written&lt;br /&gt;
to this location that you want to keep must be copied back to the &amp;lt;tt&amp;gt;/scratch&amp;lt;/tt&amp;gt; filesystem as &amp;lt;tt&amp;gt;/dev/shm&amp;lt;/tt&amp;gt; is wiped after each job and since it is in memory will not survive through a reboot of the node. More on ramdisk usage can be found [[User_Ramdisk | here]].&lt;br /&gt;
&lt;br /&gt;
Note that the absense of hard drives also means that the nodes cannot swap memory, so be sure that your computation fits within memory.&lt;br /&gt;
&lt;br /&gt;
===Buying storage space on GPFS or HPSS===&lt;br /&gt;
&lt;br /&gt;
Groups can buy space on GPFS or HPSS rather than rely on the [http://wiki.scinethpc.ca/wiki/index.php/Application_Process annual allocation process].  A good budgetary number would be:&lt;br /&gt;
&lt;br /&gt;
GPFS $400/TB&lt;br /&gt;
&lt;br /&gt;
HPSS $150/TB&lt;br /&gt;
 &lt;br /&gt;
This is a one-time cost. We have no formal, written data retention policy at this point but the intent is to keep any HPSS data (including migrating to new tape technologies) as long as SciNet is in operation. These numbers are for budgetary purposes only and subject to change (e.g. as markets and technologies evolve).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Data Transfer'''==&lt;br /&gt;
{{:Data_Transfer}}&lt;br /&gt;
&lt;br /&gt;
=='''File/Ownership Management (ACL)'''==&lt;br /&gt;
* By default, at SciNet, users within the same group have read permission to each other's files (not write)&lt;br /&gt;
* You may use access control list ('''ACL''') to allow your supervisor (or another user within your group) to manage files for you (i.e., create, move, rename, delete), while still retaining your access and permission as the original owner of the files/directories.&lt;br /&gt;
* '''NOTE''': We highly recommend that you never give write permission to other users on the top level of your home directory (/home/G/GROUP/[owner]), since that would seriously compromise your privacy, in addition to disable ssh key authentication, among other things. If necessary, make specific sub-directories under your home directory so that other users can manipulate/access files from those.&lt;br /&gt;
* If you need to set up permissions across groups [mailto:support@scinet.utoronto.ca contact us] (and the other group's supervisor!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
===Using  setfacl/getfacl===&lt;br /&gt;
* To allow [supervisor] to manage files in /project/g/group/[owner] using '''setfacl''' and '''getfacl''' commands, follow the 3-steps below as the [owner] account from a shell:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1) $ /scinet/gpc/bin/setfacl -d -m user:[supervisor]:rwx /project/g/group/[owner]&lt;br /&gt;
   (every *new* file/directory inside [owner] will inherit [supervisor] ownership by default from now on)&lt;br /&gt;
&lt;br /&gt;
2) $ /scinet/gpc/bin/setfacl -d -m user:[owner]:rwx /project/g/group/[owner]&lt;br /&gt;
   (but will also inherit [owner] ownership, ie, ownership of both by default, for files/directories created by [supervisor])&lt;br /&gt;
&lt;br /&gt;
3) $ /scinet/gpc/bin/setfacl -Rm user:[supervisor]:rwx /project/g/group/[owner]&lt;br /&gt;
   (recursively modify all *existing* files/directories inside [owner] to also be rwx by [supervisor])&lt;br /&gt;
&lt;br /&gt;
   $ /scinet/gpc/bin/getfacl /project/g/group/[owner]&lt;br /&gt;
   (to determine the current ACL attributes)&lt;br /&gt;
&lt;br /&gt;
   $ /scinet/gpc/bin/setfacl -b /project/g/group/[owner]&lt;br /&gt;
   (to remove any previously set ACL)&lt;br /&gt;
&lt;br /&gt;
PS: on the datamovers getfacl, setfacl and chacl will be on your path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more information on using [http://linux.die.net/man/1/setfacl &amp;lt;tt&amp;gt;setfacl&amp;lt;/tt&amp;gt;] or [http://linux.die.net/man/1/getfacl &amp;lt;tt&amp;gt;getfacl&amp;lt;/tt&amp;gt;] see their man pages.&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using mmputacl/mmgetacl===&lt;br /&gt;
* You may use gpfs' native '''mmputacl''' and '''mmgetacl''' commands. The advantages are that you can set &amp;quot;control&amp;quot; permission and that [http://publib.boulder.ibm.com/infocenter/clresctr/vxrx/index.jsp?topic=%2Fcom.ibm.cluster.gpfs.doc%2Fgpfs31%2Fbl1adm1160.html POSIX or NFS v4 style ACL] are supported. You will need first to create a /tmp/supervisor.acl file with the following contents:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user::rwxc&lt;br /&gt;
group::----&lt;br /&gt;
other::----&lt;br /&gt;
mask::rwxc&lt;br /&gt;
user:[owner]:rwxc&lt;br /&gt;
user:[supervisor]:rwxc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then issue the following 2 commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1) $ mmputacl -i /tmp/supervisor.acl /project/g/group/[owner]&lt;br /&gt;
2) $ mmputacl -d -i /tmp/supervisor.acl /project/g/group/[owner]&lt;br /&gt;
   (every *new* file/directory inside [owner] will inherit [supervisor] ownership by default as well as &lt;br /&gt;
   [owner] ownership, ie, ownership of both by default, for files/directories created by [supervisor])&lt;br /&gt;
&lt;br /&gt;
   $ mmgetacl /project/g/group/[owner]&lt;br /&gt;
   (to determine the current ACL attributes)&lt;br /&gt;
&lt;br /&gt;
   $ mmdelacl -d /project/g/group/[owner]&lt;br /&gt;
   (to remove any previously set ACL)&lt;br /&gt;
&lt;br /&gt;
   $ mmeditacl /project/g/group/[owner]&lt;br /&gt;
   (to create or change a GPFS access control list)&lt;br /&gt;
   (for this command to work set the EDITOR environment variable: export EDITOR=/usr/bin/vi)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTES:&lt;br /&gt;
* There is no option to recursively add or remove ACL attributes using a gpfs built-in command to existing files. You'll need to use the -i option as above for each file or directory individually. [[Data_Management#bash_script_that_you_may_adapt_to_recursively_add_or_remove_ACL_attributes_using_gpfs_built-in_commands | Here is a sample bash script you may use for that purpose]]&lt;br /&gt;
&lt;br /&gt;
* mmputacl/setfacl will not overwrite the original linux group permissions for a directory when copied to another directory already with ACLs, hence the &amp;quot;#effective:r-x&amp;quot; note you may see from time to time with mmgetacf/getfacl. If you want to give rwx permissions to everyone in your group you should simply rely on the plain unix 'chmod g+rwx' command. You may do that before or after copying the original material to another folder with the ACLs.&lt;br /&gt;
&lt;br /&gt;
For more information on using [http://publib.boulder.ibm.com/infocenter/clresctr/vxrx/index.jsp?topic=%2Fcom.ibm.cluster.gpfs.doc%2Fgpfs31%2Fbl1adm11120.html &amp;lt;tt&amp;gt;mmputacl&amp;lt;/tt&amp;gt;] or [http://publib.boulder.ibm.com/infocenter/clresctr/vxrx/index.jsp?topic=%2Fcom.ibm.cluster.gpfs.doc%2Fgpfs31%2Fbl1adm11120.html &amp;lt;tt&amp;gt;mmgetaclacl&amp;lt;/tt&amp;gt;] see their man pages.&lt;br /&gt;
&lt;br /&gt;
===Appendix (ACL)===&lt;br /&gt;
====bash script that you may adapt to recursively add or remove ACL attributes using gpfs built-in commands====&lt;br /&gt;
Courtesy of Agata Disks (http://csngwinfo.in2p3.fr/mediawiki/index.php/GPFS_ACL)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# USAGE&lt;br /&gt;
#     - on one directory:     ./set_acl.sh dir_name&lt;br /&gt;
#     - on more directories:  ./set_acl.sh 'dir_nam*'&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# Path of the file that contains the ACL&lt;br /&gt;
ACL_FILE_PATH=/agatadisks/data/acl_file.acl&lt;br /&gt;
&lt;br /&gt;
# Directories onto the ACLs have to be set&lt;br /&gt;
dirs=$1&lt;br /&gt;
&lt;br /&gt;
# Recursive function that sets ACL to files and directories&lt;br /&gt;
set_acl () {&lt;br /&gt;
  curr_dir=$1&lt;br /&gt;
  for args in $curr_dir/*&lt;br /&gt;
  do&lt;br /&gt;
    if [ -f $args ]; then&lt;br /&gt;
      echo &amp;quot;ACL set on file $args&amp;quot;&lt;br /&gt;
      mmputacl -i $ACL_FILE_PATH $args&lt;br /&gt;
      if [ $? -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;ERROR: ACL not set on $args&amp;quot;&lt;br /&gt;
        exit -1&lt;br /&gt;
      fi&lt;br /&gt;
    fi&lt;br /&gt;
    if [ -d $args ]; then&lt;br /&gt;
      # Set Default ACL in directory&lt;br /&gt;
      mmputacl -i $ACL_FILE_PATH $args -d&lt;br /&gt;
      if [ $? -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;ERROR: Default ACL not set on $args&amp;quot;&lt;br /&gt;
        exit -1&lt;br /&gt;
      fi&lt;br /&gt;
      echo &amp;quot;Default ACL set on directory $args&amp;quot;&lt;br /&gt;
      # Set ACL in directory&lt;br /&gt;
      mmputacl -i $ACL_FILE_PATH $args&lt;br /&gt;
      if [ $? -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;ERROR: ACL not set on $args&amp;quot;&lt;br /&gt;
        exit -1&lt;br /&gt;
      fi&lt;br /&gt;
      echo &amp;quot;ACL set on directory $args&amp;quot;&lt;br /&gt;
      set_acl $args&lt;br /&gt;
    fi&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
for dir in $dirs&lt;br /&gt;
do&lt;br /&gt;
  if [ ! -d $dir ]; then&lt;br /&gt;
    echo &amp;quot;ERROR: $dir is not a directory&amp;quot;&lt;br /&gt;
    exit -1&lt;br /&gt;
  fi&lt;br /&gt;
  set_acl $dir&lt;br /&gt;
done&lt;br /&gt;
exit 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[HPSS|'''High Performance Storage System (HPSS)''']]==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==More questions on data management?==&lt;br /&gt;
&lt;br /&gt;
Check out the [[FAQ#Data_on_SciNet_disks|FAQ]].&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Transfer&amp;diff=9319</id>
		<title>Data Transfer</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Data_Transfer&amp;diff=9319"/>
		<updated>2018-05-05T06:25:16Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Globus data transfer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== General guidelines ===&lt;br /&gt;
&lt;br /&gt;
All traffic to and from the data centre has to go via [http://en.wikipedia.org/wiki/Secure_Shell SSH], or secure shell.&lt;br /&gt;
This is a protocol which sets up a secure connection between two sites.  In all cases, incoming connections to SciNet go through relatively low-speed connections to the login.scinet gateways, but there are many ways to copy files on top of the ssh protocol.&lt;br /&gt;
&lt;br /&gt;
What node to use for data transfer to and from SciNet depends mostly on the amount of data to transfer:&lt;br /&gt;
&lt;br /&gt;
==== Moving &amp;lt;10GB through the login nodes ====&lt;br /&gt;
&lt;br /&gt;
The login nodes are accessible from outside SciNet, which means that you can transfer data between your own office/home machine and SciNet using scp or rsync (see below). Although the login nodes have a cpu_time timeout of 5 minutes (emphasis on cpu_time, not wall_time), most likely if you try to transfer more than 10GB probably you wouldn't succeed.  While the login nodes can be used for transfers of less than 10GB, using a datamover node would still be faster.&lt;br /&gt;
&lt;br /&gt;
Note that transfers through a login node will timeout after a certain time (currently set to 5 minutes cpu_time), so if you have a slow connection you may need to go through datamover1.&lt;br /&gt;
&lt;br /&gt;
==== Moving &amp;gt;10GB through the datamover1 node ====&lt;br /&gt;
&lt;br /&gt;
Serious moves of data (&amp;gt;10GB) to or from SciNet should be done from &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt; nodes. From any of the interactive SciNet nodes, one should be able to &amp;lt;tt&amp;gt;ssh datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;ssh datmover2&amp;lt;/tt&amp;gt; to log in. Those are the machines that have the fastest network connections to the outside world (by a factor of 10; a 10Gb/s link as vs 1Gb/s).  &lt;br /&gt;
&lt;br /&gt;
Transfers must be ''originated'' from &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt;; that is, one can not copy files from the outside world directly to or from the datamovers; one has to log in to a datamover and copy the data to or from the outside network. Your local machine must be reachable from the outside as well, either by its name or its IP address. If you are behind a firewall or a (wireless) router, this may not be possible. You may need to ask your network administrator to allow the datamovers to ssh to your machine. If you need to open a hole on your firewall we provide their IPs:&lt;br /&gt;
&lt;br /&gt;
 datamover1 142.150.188.121&lt;br /&gt;
 datamover2 142.150.188.122&lt;br /&gt;
&lt;br /&gt;
==== Hpn-ssh ====&lt;br /&gt;
&lt;br /&gt;
The usual ssh protocols were not designed for speed.   On the &amp;lt;tt&amp;gt;datamover1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;datamover2&amp;lt;/tt&amp;gt; nodes, we have installed hpn-ssh, or [http://www.psc.edu/networking/projects/hpn-ssh/ High-Performance-enabled ssh].   You use this higher-performance ssh/scp/sftp variant by loading the `hpnssh' module.   Hpn-ssh is backwards compatible with the `usual' ssh, but is capable of significantly higher speeds.   If you routinely have large data transfers to do, we recommend having your system administrator look into installing [http://www.psc.edu/networking/projects/hpn-ssh/ hpn-ssh] on your system.  &lt;br /&gt;
&lt;br /&gt;
Everything we discuss below, unless otherwise stated, will work regardless of whether you have hpn-ssh installed on your remote system.&lt;br /&gt;
&lt;br /&gt;
==== For Microsoft Windows users ====&lt;br /&gt;
&lt;br /&gt;
Linux-windows transfers can be a bit more involved than linux-to-linux, but using [http://www.cygwin.com Cygwin], this should not be a problem. Make sure you install Cygwin with the openssh package.&lt;br /&gt;
&lt;br /&gt;
If you want to remain 100% a Windows environment, another very good tool is [http://winscp.net/eng/index.php WinSCP]. It will let you easily transfer and synchronize data between your Windows workstation and the login nodes using your ssh credentials (provided that it's not much more than 10GB on each sync pass).&lt;br /&gt;
&lt;br /&gt;
If you are going to use the [[Data_Management#Moving_.3E10GB_through_the_datamover1_node | datamover1 method]], and assuming your machine is not a wireless laptop (if it &lt;br /&gt;
is, best to find a nearby computer that's not wireless and use a usb &lt;br /&gt;
memory stick), you'll need the IP address of your machine, which you find by &lt;br /&gt;
typing &amp;quot;ipconfig /all&amp;quot; on your local windows machine. Also, you will need to have the ssh daemon (sshd) running locally in Cygwin.&lt;br /&gt;
&lt;br /&gt;
Also note that your windows user name does not have to be the same as on SciNet, this just &lt;br /&gt;
depends on how your local windows system was set up. &lt;br /&gt;
&lt;br /&gt;
All locations given to scp or rsync in cygwin have to be in unix format (using &amp;quot;/&amp;quot; not &amp;quot;\&amp;quot;), and will be relative to cygwin's path, not windows (e.g.&lt;br /&gt;
use /cygdrive/c/...... to get to the windows C: drive).&lt;br /&gt;
&lt;br /&gt;
=== Ways to transfer data ===&lt;br /&gt;
&lt;br /&gt;
==== Globus data transfer ====&lt;br /&gt;
&lt;br /&gt;
Globus is a file-transfer service with an easy-to-use web interface to allow people to transfer file with ease.  To get started, please sign up for a Globus account at [https://www.globus.org/ Globus website].  Once you sign up for an account, go to [https://www.globus.org/xfer/StartTransfer this page] to start the file transfer.  Please enter computecanada#niagara or computecanada#gpc as one endpoint for file transfer.  The computecanada#gpc endpoint requires authentication using your scinet username and password.  If you are trying to transfer data from a laptop or desktop, you will need to install Globus Connect Personal software available [https://support.globus.org/entries/24044351 here] to setup an endpoint for the laptop or desktop and perform the transfer.&lt;br /&gt;
&lt;br /&gt;
Please see the following [https://docs.computecanada.ca/wiki/Globus page] on how to setup Globus to perform data transfer.&lt;br /&gt;
&lt;br /&gt;
==== scp ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;scp&amp;lt;/tt&amp;gt;, or secure copy, is the easiest way to copy files, although we generally find rsync below to be faster.&lt;br /&gt;
&lt;br /&gt;
scp works like cp to copy files:&lt;br /&gt;
&lt;br /&gt;
 $ scp original_file  copy_file&lt;br /&gt;
&lt;br /&gt;
except that either the original or the copy can be on another system:&lt;br /&gt;
 &lt;br /&gt;
 $ scp jonsdatafile.bin jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
&lt;br /&gt;
will copy the data file into the directory &amp;lt;tt&amp;gt;/home/jon/bigdatadir/&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;remote.system.com&amp;lt;/tt&amp;gt; after logging in as &amp;lt;tt&amp;gt;jon&amp;lt;/tt&amp;gt;; you will be prompted for a password (unless you've set up ssh keys).&lt;br /&gt;
&lt;br /&gt;
Copying from remote systems works the same way:&lt;br /&gt;
&lt;br /&gt;
 $ scp jon@remote.system.com:/home/jon/bigdatadir/newdata.bin .&lt;br /&gt;
&lt;br /&gt;
And wildcards work as you'd expect (except you have to quote the wildcards on the remote system, as it can't expand properly here.)&lt;br /&gt;
&lt;br /&gt;
 $ scp *.bin jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
 $ scp jon@remote.system.com:&amp;quot;/home/jon/inputdata/*&amp;quot; .&lt;br /&gt;
&lt;br /&gt;
There are few options worth knowing about:  &lt;br /&gt;
* &amp;lt;tt&amp;gt;scp -C&amp;lt;/tt&amp;gt; compresses the file before transmitting it; ''if'' the file compresses well, this can significantly increase the effective data transfer rate (though usually not as much as compressing the data, then sending it, then uncompressing).  If the file doesn't compress well, than this adds CPU overhead without accomplishing much, and can slow down your data transfer.&lt;br /&gt;
* &amp;lt;tt&amp;gt;scp -oNoneEnabled=yes -oNoneSwitch=yes&amp;lt;/tt&amp;gt; -- This is an hpn-ssh only option.  If CPU overhead is a significant bottleneck in the data transfer, then we can avoid this by turning off the secure encryption of the data.   For most of us, this is ok, but for others it is not.  In either cases, '''authentication''' remains secure, it is only the data transfer that is in plaintext.&lt;br /&gt;
&lt;br /&gt;
==== rsync ====&lt;br /&gt;
&lt;br /&gt;
[http://samba.anu.edu.au/rsync/ rsync] is a very powerful tool for mirroring directories of data.   &lt;br /&gt;
 $ rsync -av -e ssh scinetdatadir jon@remote.system.com:/home/jon/bigdatadir/&lt;br /&gt;
rsync has a dizzying number of options; the above syncs &amp;lt;tt&amp;gt;scinetdatadir&amp;lt;/tt&amp;gt; ''to'' the remote system; that is, any files that are newer on the localsystem are updated on the remote system.  The converse isn't true; if there were newer files on the remote system, you'd have to bring those over with&lt;br /&gt;
 $ rsync -av -e ssh jon@remote.system.com:/home/jon/bigdatadir/ scinetdatadir &lt;br /&gt;
The &amp;lt;tt&amp;gt;-av&amp;lt;/tt&amp;gt; options are for verbose and `archive' mode, which preserves timestamps and permissions, which is normally what you want.  &amp;lt;tt&amp;gt;-e ssh&amp;lt;/tt&amp;gt; tells it to use ssh for the transfer.&lt;br /&gt;
&lt;br /&gt;
One of the powerful things about rsync is that it looks to see what files already exist before copying, so you can use it repeatedly as a data directory fills and it won't make unnecessary copies; similarly, if a (say) log file grows over time, it will only copy the difference between the files, further speeding things up.   This also means that it behaves well if a transfer is interrupted; a second invocation of rsync will continue where the other left off.&lt;br /&gt;
&lt;br /&gt;
As with &amp;lt;tt&amp;gt;scp -C&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;rsync -z&amp;lt;/tt&amp;gt; compresses on the fly, which can significantly enhance effective data transfer rates if the files compress well, or hurt it if not.&lt;br /&gt;
&lt;br /&gt;
As with scp, if both sides are running hpn-ssh one can disable encryption of the data stream should that prove to be a bottleneck:&lt;br /&gt;
 $ rsync -av -e &amp;quot;ssh -oNoneEnabled=yes -oNoneSwitch=yes&amp;quot; jon@remote.system.com:/home/jon/bigdatadir/ scinetdatadir&lt;br /&gt;
&lt;br /&gt;
SciNet's login nodes, 142.150.188.5[1-4], are publicly accessible and can be used for data transfer as long as your material is not one big chunk (much more than 2-3GB each file). We have a 5 minutes CPU time limit on the login nodes and the transfer process may be killed by the kernel before completion. The workaround is to transfer your data using a rsync loop, by checking the rsync return code, assuming some files can be transferred before reaching the CPU limit. For example in a bash shell:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for i in {1..100}; do   ### try 100 times&lt;br /&gt;
    rsync ...&lt;br /&gt;
    [ &amp;quot;$?&amp;quot; == &amp;quot;0&amp;quot; ] &amp;amp;&amp;amp; break&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ssh tunnel ====&lt;br /&gt;
&lt;br /&gt;
Alternatively you may use a reverse ssh tunnel (ssh -R).&lt;br /&gt;
&lt;br /&gt;
If your transfer is above 10GB you will need to use one of SciNet's datamovers. If your workstation is behind a firewall (as the datamovers are), you'll need a node external to your firewall, on the edge of your organization's network, that will serve as a gateway, and can be accessible via ssh by both your workstation and the datamovers. Initiate a &amp;quot;ssh -R&amp;quot; connection from SciNet's datamover to that node. This node needs to have its ssh GatewayPorts enabled so that your workstation can connect to the specified port on that node, which will forward the traffic back to SciNet's datamover.&lt;br /&gt;
&lt;br /&gt;
=== Transfer speeds ===&lt;br /&gt;
&lt;br /&gt;
==== What transfer speeds could I expect? ====&lt;br /&gt;
&lt;br /&gt;
Below are some typical transfer numbers from datamover1 to another University of Toronto machine with a 1Gb/s link to the campus network:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!{{Hl2}}|  Mode&lt;br /&gt;
!{{Hl2}}|  With hpn-ssh&lt;br /&gt;
!{{Hl2}}|  Without&lt;br /&gt;
|-&lt;br /&gt;
|  rsync&lt;br /&gt;
|  60-80 MB/s&lt;br /&gt;
|  30-40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
|  scp&lt;br /&gt;
|  50 MB/s&lt;br /&gt;
|  25 MB/s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== What can slow down my data transfer? ====&lt;br /&gt;
&lt;br /&gt;
To move data quickly, ''all'' of the stages in the process have to be fast; the file system you are reading data from, the CPU reading the data, the network connection between the sender and the reciever, and the recipient CPU and disk.   The slowest element in that chain will slow down the entire transfer.&lt;br /&gt;
&lt;br /&gt;
On SciNet's side, our underlying filesystem is the high-performance [http://www-03.ibm.com/systems/software/gpfs/index.html GPFS] system, and the node we recommend you use (datamover1) has a high-speed connection to the network and fast CPUs.&lt;br /&gt;
&lt;br /&gt;
==== Why are my transfers so much slower? ====&lt;br /&gt;
&lt;br /&gt;
If you get numbers significantly lower than above, then there is a bottleneck in the transfer.   The first thing to do is to run &amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; on datamover1; if other people are transfering large files at the same time you are trying to, network congestion could result and you'll just have to wait until they are done.&lt;br /&gt;
&lt;br /&gt;
If nothing else is going on on datamover1, there are a number of possibilites:&lt;br /&gt;
* network connection between SciNet and your machine - do you know the network connection of your remote machine?   Are your systems connections tuned for performance [http://www.psc.edu/networking/projects/tcptune]?&lt;br /&gt;
* is the remote server busy?&lt;br /&gt;
* are the remote servers disks busy, or known to be slow?&lt;br /&gt;
&lt;br /&gt;
For any further questions, contact us at [mailto:support@scinet.utoronto.ca Support @ SciNet]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=User:Pinto&amp;diff=9318</id>
		<title>User:Pinto</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=User:Pinto&amp;diff=9318"/>
		<updated>2018-05-05T06:17:30Z</updated>

		<summary type="html">&lt;p&gt;Pinto: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jaime Pinto - Storage Analyst &amp;lt;br&amp;gt;                    &lt;br /&gt;
SciNet HPC Consortium - Compute/Calcul Canada&amp;lt;br&amp;gt;&lt;br /&gt;
www.scinet.utoronto.ca - www.computecanada.ca&amp;lt;br&amp;gt;&lt;br /&gt;
University of Toronto&amp;lt;br&amp;gt;&lt;br /&gt;
661 University Ave. (MaRS), Suite 1140&amp;lt;br&amp;gt;&lt;br /&gt;
Toronto, ON, M5G1M1&amp;lt;br&amp;gt;&lt;br /&gt;
P: 416-978-2755&amp;lt;br&amp;gt;&lt;br /&gt;
C: 416-505-1477&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Oldwiki.scinet.utoronto.ca:System_Alerts&amp;diff=9317</id>
		<title>Oldwiki.scinet.utoronto.ca:System Alerts</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Oldwiki.scinet.utoronto.ca:System_Alerts&amp;diff=9317"/>
		<updated>2018-05-05T06:15:01Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* System Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== System Status==&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
  Notes for updating the system status:&lt;br /&gt;
&lt;br /&gt;
  -  When removing system status entries, please archive them to:&lt;br /&gt;
&lt;br /&gt;
     http://wiki.scinethpc.ca/wiki/index.php/Previous_messages:&lt;br /&gt;
&lt;br /&gt;
     (yes, the trailing colon is part of the url)&lt;br /&gt;
&lt;br /&gt;
  -  The 'status circles' can be one of the following files: &lt;br /&gt;
&lt;br /&gt;
     down.png   for down&lt;br /&gt;
     up25.png   for 25% up&lt;br /&gt;
     up50.png   for 50% up&lt;br /&gt;
     up75.png   for 75% up&lt;br /&gt;
     up.png     for 100% up&lt;br /&gt;
&lt;br /&gt;
 --&amp;gt;&lt;br /&gt;
{| &lt;br /&gt;
|[[File:up.png|up|link=https://docs.scinet.utoronto.ca/index.php/Main_Page]][https://docs.scinet.utoronto.ca Niagara]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:up.png|up|link=BGQ]][[BGQ]]&lt;br /&gt;
|[[File:up.png|up|link=P7 Linux Cluster]][[P7 Linux Cluster|P7]]&lt;br /&gt;
|[[File:up.png|up|link=P8]][[P8]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:up.png|up|link=SOSCIP_GPU]][[SOSCIP_GPU|SGC]]&lt;br /&gt;
|[[File:up.png|up|link=Knights Landing]][[Knights Landing|KNL]]&lt;br /&gt;
|[[File:down.png|up|link=HPSS]][https://docs.scinet.utoronto.ca/index.php/HPSS HPSS]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:up.png|up|]]File System&lt;br /&gt;
|[[File:up.png|up|]]External Network&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Mon 23 Apr 2018 &amp;lt;/b&amp;gt; GPC-compute is decommissioned, GPC-storage available until &amp;lt;font color=red&amp;gt;&amp;lt;b&amp;gt;9 May 2018&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Thu 18 Apr 2018 &amp;lt;/b&amp;gt;  Niagara system will undergo an upgrade to its Infiniband network between 9am and 12pm, should be transparent to users, however there is a chance of network interruption.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Fri 13 Apr 2018 &amp;lt;/b&amp;gt; HPSS system will be down for a few hours on &amp;lt;b&amp;gt;Mon, Apr/16, 9AM&amp;lt;/b&amp;gt;, for hardware upgrades, in preparation for the eventual move to the Niagara side.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Tue 10 Apr 2018 &amp;lt;/b&amp;gt; Niagara is open to users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Wed 4 Apr 2018 &amp;lt;/b&amp;gt; We are very close to the production launch of Niagara, the new system installed at SciNet.&lt;br /&gt;
While the RAC allocation year officially starts today, April 4/18, the Niagara system is still undergoing some final tuning and software updates, so the plan is to officially open it to users on next week.&lt;br /&gt;
&lt;br /&gt;
All active GPC users will have their accounts, $HOME, and $PROJECT, transferred to the new&lt;br /&gt;
Niagara system.  Those of you who are new to SciNet, but got RAC allocations on Niagara,&lt;br /&gt;
will have your accounts created and ready for you to login.&lt;br /&gt;
&lt;br /&gt;
We are planning an extended [https://support.scinet.utoronto.ca/education/go.php/370/index.php Intro to SciNet/Niagara session], available in person at our office, and webcast on Vidyo and possibly other means, on Wednesday April 11 at noon EST.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- [https://support.scinet.utoronto.ca/wiki/index.php/Previous_messages:] --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Oldwiki.scinet.utoronto.ca:System_Alerts&amp;diff=9316</id>
		<title>Oldwiki.scinet.utoronto.ca:System Alerts</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Oldwiki.scinet.utoronto.ca:System_Alerts&amp;diff=9316"/>
		<updated>2018-05-05T06:14:32Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* System Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== System Status==&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
  Notes for updating the system status:&lt;br /&gt;
&lt;br /&gt;
  -  When removing system status entries, please archive them to:&lt;br /&gt;
&lt;br /&gt;
     http://wiki.scinethpc.ca/wiki/index.php/Previous_messages:&lt;br /&gt;
&lt;br /&gt;
     (yes, the trailing colon is part of the url)&lt;br /&gt;
&lt;br /&gt;
  -  The 'status circles' can be one of the following files: &lt;br /&gt;
&lt;br /&gt;
     down.png   for down&lt;br /&gt;
     up25.png   for 25% up&lt;br /&gt;
     up50.png   for 50% up&lt;br /&gt;
     up75.png   for 75% up&lt;br /&gt;
     up.png     for 100% up&lt;br /&gt;
&lt;br /&gt;
 --&amp;gt;&lt;br /&gt;
{| &lt;br /&gt;
|[[File:up.png|up|link=https://docs.scinet.utoronto.ca/index.php/Main_Page]][https://docs.scinet.utoronto.ca Niagara]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:up.png|up|link=BGQ]][[BGQ]]&lt;br /&gt;
|[[File:up.png|up|link=P7 Linux Cluster]][[P7 Linux Cluster|P7]]&lt;br /&gt;
|[[File:up.png|up|link=P8]][[P8]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:up.png|up|link=SOSCIP_GPU]][[SOSCIP_GPU|SGC]]&lt;br /&gt;
|[[File:up.png|up|link=Knights Landing]][[Knights Landing|KNL]]&lt;br /&gt;
|[[File:down.png|up|link=HPSS]][https://docs.scinet.utoronto.ca/index.php/HPSS]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:up.png|up|]]File System&lt;br /&gt;
|[[File:up.png|up|]]External Network&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Mon 23 Apr 2018 &amp;lt;/b&amp;gt; GPC-compute is decommissioned, GPC-storage available until &amp;lt;font color=red&amp;gt;&amp;lt;b&amp;gt;9 May 2018&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Thu 18 Apr 2018 &amp;lt;/b&amp;gt;  Niagara system will undergo an upgrade to its Infiniband network between 9am and 12pm, should be transparent to users, however there is a chance of network interruption.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Fri 13 Apr 2018 &amp;lt;/b&amp;gt; HPSS system will be down for a few hours on &amp;lt;b&amp;gt;Mon, Apr/16, 9AM&amp;lt;/b&amp;gt;, for hardware upgrades, in preparation for the eventual move to the Niagara side.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Tue 10 Apr 2018 &amp;lt;/b&amp;gt; Niagara is open to users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt; Wed 4 Apr 2018 &amp;lt;/b&amp;gt; We are very close to the production launch of Niagara, the new system installed at SciNet.&lt;br /&gt;
While the RAC allocation year officially starts today, April 4/18, the Niagara system is still undergoing some final tuning and software updates, so the plan is to officially open it to users on next week.&lt;br /&gt;
&lt;br /&gt;
All active GPC users will have their accounts, $HOME, and $PROJECT, transferred to the new&lt;br /&gt;
Niagara system.  Those of you who are new to SciNet, but got RAC allocations on Niagara,&lt;br /&gt;
will have your accounts created and ready for you to login.&lt;br /&gt;
&lt;br /&gt;
We are planning an extended [https://support.scinet.utoronto.ca/education/go.php/370/index.php Intro to SciNet/Niagara session], available in person at our office, and webcast on Vidyo and possibly other means, on Wednesday April 11 at noon EST.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- [https://support.scinet.utoronto.ca/wiki/index.php/Previous_messages:] --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS-by-pomes&amp;diff=9314</id>
		<title>HPSS-by-pomes</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS-by-pomes&amp;diff=9314"/>
		<updated>2018-05-04T00:30:35Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* 4. Check HPSS data against the original */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= '''Packing up large data sets and putting them on HPSS''' =&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
HPSS has the following limitations:&lt;br /&gt;
&lt;br /&gt;
Hundreds of thousands of small files can be offloaded rapidly, but take weeks or months to recall&lt;br /&gt;
* No individual file can exceed 1 TB&lt;br /&gt;
* You must verify the integrity of your data throughout the data preparation and offload process&lt;br /&gt;
* With these limitations in mind, we have developed the following protocol for efficiently offloading data from scratch to HPSS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Identify the subdirectories that contain &amp;gt; 1,000 files. ==&lt;br /&gt;
a. Create a directory called DU/ and place the following script in that directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# du.sh&lt;br /&gt;
for i in $(ls ../); do&lt;br /&gt;
    n=$(find ../$i |wc -l)&lt;br /&gt;
    s=$(du -hs ../$i  | awk '{print $1}')&lt;br /&gt;
    echo &amp;quot;$i $n $s&amp;quot;&lt;br /&gt;
done &amp;gt; my.du.dirs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b. chmod +x du.sh&lt;br /&gt;
&lt;br /&gt;
c. nohup ./du.sh &amp;amp;&lt;br /&gt;
(This step may require hours or days to complete)&lt;br /&gt;
&lt;br /&gt;
d. Now my.du.dirs will contain a listing of the number of files and the total size of each directory.&lt;br /&gt;
&lt;br /&gt;
e. Identify the directories with many files and copy the DU/ directory there and then run du.sh again. Continue this process until you have a good understanding of which directories actually contain large numbers of files.&lt;br /&gt;
&lt;br /&gt;
== 2. Create tar files for these directories. ==&lt;br /&gt;
a. This should be scripted to ensure that your tarballs are completely written.&lt;br /&gt;
&lt;br /&gt;
b. Never script the removal of the original files.&lt;br /&gt;
&lt;br /&gt;
c. Here is an example script:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
for i in &amp;quot;dir1 dir2 dir3&amp;quot;; do&lt;br /&gt;
    tar –cf ${i}.tar ${i}&lt;br /&gt;
    echo &amp;quot;tar $i returned $?&amp;quot;&lt;br /&gt;
done &amp;gt; my.tar.results&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
d. Note that the evaluation of $? must be done on the very next command after tar. Even inserting an additional echo statement will break the test.&lt;br /&gt;
&lt;br /&gt;
e. Once you are sure that the tar command was successful (return code equals zero), you should delete the originals. You should not script the deletion process because a typo in a rm –rf command can be very costly. If you must script a removal, it is best to do it like this:&lt;br /&gt;
&lt;br /&gt;
mkdir TRASH; for i in $list; do mv $i TRASH; done&lt;br /&gt;
&lt;br /&gt;
then inspect TRASH and remove it manually. Note that the above command could possibly be costly if you make a mistake since files may get overwritten. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Now upload to HPSS using HSI. ==&lt;br /&gt;
You should have less than 10,000 files per TB of uploaded data. If that is not the case, then go back and pack up your data some more before proceeding.&lt;br /&gt;
&lt;br /&gt;
a. It is recommended that you have a new directory structure in HPSS for your fully packed up data. This is because you may have put other things on HPSS in the past and the creation of a clean directory structure is a good way to denote that this data is the final copy. Here, we use FULL_DATA/&lt;br /&gt;
&lt;br /&gt;
b. An example of an HPSS offload script follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
## scratch files:  $SCRATCH/mydata&lt;br /&gt;
## HPSS files:     $ARCHIVE/FULL_DATA/mydata&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir -p FULL_DATA&lt;br /&gt;
cd FULL_DATA&lt;br /&gt;
cput -Rpuh $SCRATCH/mydata&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
    echo 'HSI returned non-zero code.'&lt;br /&gt;
    /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
    exit $status&lt;br /&gt;
else&lt;br /&gt;
    echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c. After the above script has completed, check the output to ensure that your transfer was successful. If you had errors, or if it timed out, simply run the script again. If you continue to get the same errors, contact support@scinet.utoronto.ca&lt;br /&gt;
&lt;br /&gt;
== 4. Check HPSS data against the original ==&lt;br /&gt;
Now you must retrieve your data back to scratch so that you can check it against the original copy on scratch, which we have not yet deleted.&lt;br /&gt;
&lt;br /&gt;
a. Run diskUsage to ensure that you have space in your allocation to recall the data to scratch. If the recall will bring you close to your limit, advise your other group members how much space you will be recalling in case another user is also planning a large data recall.&lt;br /&gt;
&lt;br /&gt;
b. An example of an HPSS recall script follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
## original scratch files:  $SCRATCH/mydata&lt;br /&gt;
## HPSS files:     $ARCHIVE/FULL_DATA/mydata&lt;br /&gt;
## new copy scratch files:  $SCRATCH/RETREIVED_MODULES/FULL_DATA/mydata&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/RETREIVED_MODULES/FULL_DATA&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
lcd $SCRATCH/RETREIVED_MODULES/FULL_DATA/&lt;br /&gt;
cget -Rpuh $ARCHIVE/FULL_DATA/mydata&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
    echo 'HSI returned non-zero code.'&lt;br /&gt;
    /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
    exit $status&lt;br /&gt;
else&lt;br /&gt;
    echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 5. Run a md5sum over the entire directory ==&lt;br /&gt;
Now that you have the original and the cput/cget copy back from HPSS, run a md5sum over the entire directory. An example of a check is as follows. Run this script under nohup from one of the datamover nodes:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
COMPUTE_DIFFERENCES=1&lt;br /&gt;
dir=$(pwd)&lt;br /&gt;
WAS=$SCRATCH/mydata&lt;br /&gt;
IS=$SCRATCH/RETREIVED_MODULES/FULL_DATA/mydata&lt;br /&gt;
if ((COMPUTE_DIFFERENCES)); then&lt;br /&gt;
    cd $WAS&lt;br /&gt;
    find . &amp;gt; ${dir}/tmp.was&lt;br /&gt;
    echo &amp;quot;find on was returned $?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    cd $IS&lt;br /&gt;
    find . &amp;gt; ${dir}/tmp.is&lt;br /&gt;
    echo &amp;quot;find on is returned $?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    cd $dir&lt;br /&gt;
&lt;br /&gt;
    changes=$(sort tmp.was &amp;gt;a ; sort tmp.is &amp;gt;b; diff a b)&lt;br /&gt;
    if ((changes!=0)); then&lt;br /&gt;
        echo &amp;quot;FILES DIFFER! Diff returned $changes&amp;quot;&lt;br /&gt;
        exit&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
for i in $(cat tmp.was); do&lt;br /&gt;
    if [ -f ${WAS}/${i} ]; then&lt;br /&gt;
        was=$(md5sum ${WAS}/$i |awk '{print $1}')&lt;br /&gt;
        is=$(md5sum ${IS}/$i |awk '{print $1}')&lt;br /&gt;
        same=$(echo $was $is | awk '{if($1==$2) print 1; else print 0}')&lt;br /&gt;
        if ((same==0)); then&lt;br /&gt;
            echo &amp;quot;FILES DIFFER -- $i $was $is&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            echo &amp;quot;OK for $i&amp;quot;&lt;br /&gt;
        fi&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a. when that is done, grep DIFFER on the output (in nohup.out since you ran this script under nohup). Any returned value means there is a problem. Contact scinet support.&lt;br /&gt;
&lt;br /&gt;
b. If everything was a success, you can delete all of the copies that you recalled from HPSS to scratch. You can also delete your original copy in scratch if you would like as you have a complete copy on scinet HPSS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS-by-pomes&amp;diff=9313</id>
		<title>HPSS-by-pomes</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS-by-pomes&amp;diff=9313"/>
		<updated>2018-05-04T00:29:48Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* 3. Now upload to HPSS using HSI. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= '''Packing up large data sets and putting them on HPSS''' =&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
HPSS has the following limitations:&lt;br /&gt;
&lt;br /&gt;
Hundreds of thousands of small files can be offloaded rapidly, but take weeks or months to recall&lt;br /&gt;
* No individual file can exceed 1 TB&lt;br /&gt;
* You must verify the integrity of your data throughout the data preparation and offload process&lt;br /&gt;
* With these limitations in mind, we have developed the following protocol for efficiently offloading data from scratch to HPSS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 1. Identify the subdirectories that contain &amp;gt; 1,000 files. ==&lt;br /&gt;
a. Create a directory called DU/ and place the following script in that directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# du.sh&lt;br /&gt;
for i in $(ls ../); do&lt;br /&gt;
    n=$(find ../$i |wc -l)&lt;br /&gt;
    s=$(du -hs ../$i  | awk '{print $1}')&lt;br /&gt;
    echo &amp;quot;$i $n $s&amp;quot;&lt;br /&gt;
done &amp;gt; my.du.dirs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b. chmod +x du.sh&lt;br /&gt;
&lt;br /&gt;
c. nohup ./du.sh &amp;amp;&lt;br /&gt;
(This step may require hours or days to complete)&lt;br /&gt;
&lt;br /&gt;
d. Now my.du.dirs will contain a listing of the number of files and the total size of each directory.&lt;br /&gt;
&lt;br /&gt;
e. Identify the directories with many files and copy the DU/ directory there and then run du.sh again. Continue this process until you have a good understanding of which directories actually contain large numbers of files.&lt;br /&gt;
&lt;br /&gt;
== 2. Create tar files for these directories. ==&lt;br /&gt;
a. This should be scripted to ensure that your tarballs are completely written.&lt;br /&gt;
&lt;br /&gt;
b. Never script the removal of the original files.&lt;br /&gt;
&lt;br /&gt;
c. Here is an example script:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
for i in &amp;quot;dir1 dir2 dir3&amp;quot;; do&lt;br /&gt;
    tar –cf ${i}.tar ${i}&lt;br /&gt;
    echo &amp;quot;tar $i returned $?&amp;quot;&lt;br /&gt;
done &amp;gt; my.tar.results&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
d. Note that the evaluation of $? must be done on the very next command after tar. Even inserting an additional echo statement will break the test.&lt;br /&gt;
&lt;br /&gt;
e. Once you are sure that the tar command was successful (return code equals zero), you should delete the originals. You should not script the deletion process because a typo in a rm –rf command can be very costly. If you must script a removal, it is best to do it like this:&lt;br /&gt;
&lt;br /&gt;
mkdir TRASH; for i in $list; do mv $i TRASH; done&lt;br /&gt;
&lt;br /&gt;
then inspect TRASH and remove it manually. Note that the above command could possibly be costly if you make a mistake since files may get overwritten. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 3. Now upload to HPSS using HSI. ==&lt;br /&gt;
You should have less than 10,000 files per TB of uploaded data. If that is not the case, then go back and pack up your data some more before proceeding.&lt;br /&gt;
&lt;br /&gt;
a. It is recommended that you have a new directory structure in HPSS for your fully packed up data. This is because you may have put other things on HPSS in the past and the creation of a clean directory structure is a good way to denote that this data is the final copy. Here, we use FULL_DATA/&lt;br /&gt;
&lt;br /&gt;
b. An example of an HPSS offload script follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
## scratch files:  $SCRATCH/mydata&lt;br /&gt;
## HPSS files:     $ARCHIVE/FULL_DATA/mydata&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir -p FULL_DATA&lt;br /&gt;
cd FULL_DATA&lt;br /&gt;
cput -Rpuh $SCRATCH/mydata&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
    echo 'HSI returned non-zero code.'&lt;br /&gt;
    /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
    exit $status&lt;br /&gt;
else&lt;br /&gt;
    echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c. After the above script has completed, check the output to ensure that your transfer was successful. If you had errors, or if it timed out, simply run the script again. If you continue to get the same errors, contact support@scinet.utoronto.ca&lt;br /&gt;
&lt;br /&gt;
== 4. Check HPSS data against the original ==&lt;br /&gt;
Now you must retrieve your data back to scratch so that you can check it against the original copy on scratch, which we have not yet deleted.&lt;br /&gt;
&lt;br /&gt;
a. Run diskUsage to ensure that you have space in your allocation to recall the data to scratch. If the recall will bring you close to your limit, advise your other group members how much space you will be recalling in case another user is also planning a large data recall.&lt;br /&gt;
&lt;br /&gt;
b. An example of an HPSS recall script follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=70:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N offload&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
## original scratch files:  $SCRATCH/mydata&lt;br /&gt;
## HPSS files:     $ARCHIVE/FULL_DATA/mydata&lt;br /&gt;
## new copy scratch files:  $SCRATCH/RETREIVED_MODULES/FULL_DATA/mydata&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/RETREIVED_MODULES/FULL_DATA&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
lcd $SCRATCH/RETREIVED_MODULES/FULL_DATA/&lt;br /&gt;
cget -Rpuh $ARCHIVE/FULL_DATA/mydata&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
    echo 'HSI returned non-zero code.'&lt;br /&gt;
    /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
    exit $status&lt;br /&gt;
else&lt;br /&gt;
    echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 5. Run a md5sum over the entire directory ==&lt;br /&gt;
Now that you have the original and the cput/cget copy back from HPSS, run a md5sum over the entire directory. An example of a check is as follows. Run this script under nohup from one of the datamover nodes:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
COMPUTE_DIFFERENCES=1&lt;br /&gt;
dir=$(pwd)&lt;br /&gt;
WAS=$SCRATCH/mydata&lt;br /&gt;
IS=$SCRATCH/RETREIVED_MODULES/FULL_DATA/mydata&lt;br /&gt;
if ((COMPUTE_DIFFERENCES)); then&lt;br /&gt;
    cd $WAS&lt;br /&gt;
    find . &amp;gt; ${dir}/tmp.was&lt;br /&gt;
    echo &amp;quot;find on was returned $?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    cd $IS&lt;br /&gt;
    find . &amp;gt; ${dir}/tmp.is&lt;br /&gt;
    echo &amp;quot;find on is returned $?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    cd $dir&lt;br /&gt;
&lt;br /&gt;
    changes=$(sort tmp.was &amp;gt;a ; sort tmp.is &amp;gt;b; diff a b)&lt;br /&gt;
    if ((changes!=0)); then&lt;br /&gt;
        echo &amp;quot;FILES DIFFER! Diff returned $changes&amp;quot;&lt;br /&gt;
        exit&lt;br /&gt;
    fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
for i in $(cat tmp.was); do&lt;br /&gt;
    if [ -f ${WAS}/${i} ]; then&lt;br /&gt;
        was=$(md5sum ${WAS}/$i |awk '{print $1}')&lt;br /&gt;
        is=$(md5sum ${IS}/$i |awk '{print $1}')&lt;br /&gt;
        same=$(echo $was $is | awk '{if($1==$2) print 1; else print 0}')&lt;br /&gt;
        if ((same==0)); then&lt;br /&gt;
            echo &amp;quot;FILES DIFFER -- $i $was $is&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            echo &amp;quot;OK for $i&amp;quot;&lt;br /&gt;
        fi&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a. when that is done, grep DIFFER on the output (in nohup.out since you ran this script under nohup). Any returned value means there is a problem. Contact scinet support.&lt;br /&gt;
&lt;br /&gt;
b. If everything was a success, you can delete all of the copies that you recalled from HPSS to scratch. You can also delete your original copy in scratch if you would like as you have a complete copy on scinet HPSS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9312</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9312"/>
		<updated>2018-05-04T00:28:18Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Packing up large data sets and putting them on HPSS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ==&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9311</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9311"/>
		<updated>2018-05-04T00:27:19Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Current HSI version - Checksum built-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9310</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9310"/>
		<updated>2018-05-04T00:24:15Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Deleting with an interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9309</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9309"/>
		<updated>2018-05-04T00:23:51Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Deleting with an interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9308</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9308"/>
		<updated>2018-05-04T00:22:15Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample data list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9307</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9307"/>
		<updated>2018-05-04T00:17:50Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample tarball list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9306</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9306"/>
		<updated>2018-05-04T00:12:24Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* HTAR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI.&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9305</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9305"/>
		<updated>2018-05-04T00:08:17Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through an Interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9304</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9304"/>
		<updated>2018-05-04T00:08:00Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through an Interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9303</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9303"/>
		<updated>2018-05-04T00:07:15Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through an Interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9302</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9302"/>
		<updated>2018-05-04T00:06:12Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through an Interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9301</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9301"/>
		<updated>2018-05-04T00:03:30Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through the Queue System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the each queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9300</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9300"/>
		<updated>2018-05-04T00:02:07Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through the Queue System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
  OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9299</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9299"/>
		<updated>2018-05-04T00:00:36Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through the Queue System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9298</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9298"/>
		<updated>2018-05-04T00:00:10Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through the Queue System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9297</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9297"/>
		<updated>2018-05-03T23:59:09Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through the Queue System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[https://docs.computecanada.ca/wiki/Niagara_Quickstart#Submitting_jobs|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9296</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9296"/>
		<updated>2018-05-03T23:58:38Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Access Through the Queue System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Submitting_jobs|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9295</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9295"/>
		<updated>2018-05-03T23:40:28Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* New to the System? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS#Access_Through_an_Interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Why_not_tarballs_too_large&amp;diff=9294</id>
		<title>Why not tarballs too large</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Why_not_tarballs_too_large&amp;diff=9294"/>
		<updated>2018-05-03T23:37:16Z</updated>

		<summary type="html">&lt;p&gt;Pinto: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The recommendation is to not generate tarballs larger than 500GB&lt;br /&gt;
&lt;br /&gt;
The simplest way to understand why is by watching this [https://www.youtube.com/watch?v=_1x99bOX7Yo  domino chain reaction video:] The only valid record requires all pieces to fall in sequence and uninterrupted&lt;br /&gt;
.&lt;br /&gt;
* The HPSS system has many moving parts (computer nodes, databases, network, switches, cables, disks, tape drives, robot arms in the library, etc). There are a number of minor hiccups that can happen in the pipeline as data is transferred from GPFS to HPSS, and back from tape to GPFS later on. &lt;br /&gt;
* if one of these hiccups happens to a large tarball the whole transfer process is compromised, and you will have to start the transfer again from square one (that is, reassemble the whole domino sequence). The same type of hiccup may happen to ONE small tarball as well (just a few loops in the domino spiral), however the probability of it affecting ONE very large tarball is much higher. In this case, the waste of time if you have to restart the process and resume it trouble free is much higher. &lt;br /&gt;
* htar for instance, does not have a built-in retrial feature, it's not resilient to external problems, and it will not pickup the slack from where a transfer failed.&lt;br /&gt;
* besides our LTO7 tapes can only fit 6TB. It's easier to fit several 500GB files onto those tapes without wastage at the end than a 3TB file for instance. Although it's possible, we prefer to not split the same file over multiple tapes. By design, we do not stripe files over multiple tapes either.&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=Why_not_tarballs_too_large&amp;diff=9293</id>
		<title>Why not tarballs too large</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=Why_not_tarballs_too_large&amp;diff=9293"/>
		<updated>2018-05-03T23:35:47Z</updated>

		<summary type="html">&lt;p&gt;Pinto: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The recommendation is to not generate tarballs larger than 500GB&lt;br /&gt;
&lt;br /&gt;
The simplest way to understand why is by watching this [https://www.youtube.com/watch?v=_1x99bOX7Yo  domino chain reaction video:] The only valid record requires all pieces to fall in sequence and uninterrupted&lt;br /&gt;
.&lt;br /&gt;
* The HPSS system has many moving parts (computer nodes, databases, network, switches, cables, disks, tape drives, robot arms in the library, etc). There are a number of minor hiccups that can happen in the pipeline as data is transferred from GPFS to HPSS, and back from tape to GPFS later on. &lt;br /&gt;
* if one of these hiccups happens to a large tarball the whole transfer process is compromised, and you will have to start the transfer again from square one (that is, reassemble the whole domino stack). The same type of hiccup may happen to ONE small tarball as well (just a few loops in the domino spiral), however the probability of it affecting ONE very large tarball is much higher. In this case, the waste of time if you have to restart the process and resume it trouble free is much higher. &lt;br /&gt;
* htar for instance, does not have a built-in retrial feature, it's not resilient to external problems, and it will not pickup the slack from where a transfer failed.&lt;br /&gt;
* besides our LTO7 tapes can only fit 6TB. It's easier to fit several 500GB files onto those tapes without wastage at the end than a 3TB file for instance. Although it's possible, we prefer to not split the same file over multiple tapes. By design, we do not stripe files over multiple tapes either.&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9292</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9292"/>
		<updated>2018-05-03T22:09:45Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample tarball extract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_extract_tarball_from_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9291</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9291"/>
		<updated>2018-05-03T22:05:06Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Deleting with an interactive HSI session */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50359&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9290</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9290"/>
		<updated>2018-05-03T22:02:38Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample data list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the login nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/niagara/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9289</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9289"/>
		<updated>2018-05-03T22:01:50Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/niagara/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9288</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9288"/>
		<updated>2018-05-03T22:01:24Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample tarball list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9287</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9287"/>
		<updated>2018-05-03T22:01:05Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample tarball create */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9286</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9286"/>
		<updated>2018-05-03T22:00:47Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Scripted File Transfers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9285</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9285"/>
		<updated>2018-05-03T22:00:11Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Prior to HSI version 4.0.1.1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9284</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9284"/>
		<updated>2018-05-03T21:59:24Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Current HSI version - Checksum built-in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J MD5_checksum_verified_transfer&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9283</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9283"/>
		<updated>2018-05-03T21:58:35Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* HTAR CRC checksums */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9282</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9282"/>
		<updated>2018-05-03T21:57:49Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Multi-threaded gzip'ed compression with pigz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9281</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9281"/>
		<updated>2018-05-03T21:56:59Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Efficient alternative to htar */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9280</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9280"/>
		<updated>2018-05-03T21:55:37Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Efficient alternative to htar */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9279</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9279"/>
		<updated>2018-05-03T21:54:48Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Typical example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9278</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9278"/>
		<updated>2018-05-03T21:53:45Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Moving/renaming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9277</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9277"/>
		<updated>2018-05-03T21:52:24Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Moving/renaming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J deletion_script&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9276</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9276"/>
		<updated>2018-05-03T21:51:43Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample transferring directories */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_directories&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9275</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9275"/>
		<updated>2018-05-03T21:49:55Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample data recall */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagar/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J recall_files_optimized&lt;br /&gt;
#SBATCH --mail-type=AL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9274</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9274"/>
		<updated>2018-05-03T21:48:12Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample data list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_ls&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#SBATCH -t 1:00:00&lt;br /&gt;
#SBATCH -p archiveshort&lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J hpss_index&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$  /scinet/niagara/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_files&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_files_optimized&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9273</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9273"/>
		<updated>2018-05-03T21:45:20Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Sample data offload */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#PBS -l walltime=1:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N hpss_ls&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#PBS -l walltime=1:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N hpss_index&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gpc-f104n084-$ /scinet/gpc/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_files&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_files_optimized&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9272</id>
		<title>HPSS</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.scinet.utoronto.ca/index.php?title=HPSS&amp;diff=9272"/>
		<updated>2018-05-03T21:44:54Z</updated>

		<summary type="html">&lt;p&gt;Pinto: /* Job Dependencies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|align=right&lt;br /&gt;
|align=center|'''Topology Overview'''&lt;br /&gt;
|align=center|'''Submission Queue'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-overview.png|right|x200px]]&lt;br /&gt;
|[[Image:HPSS-queue2.png|right|x200px]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|align=center|'''Servers Rack'''&lt;br /&gt;
|align=center|'''TS3500 Library'''&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:HPSS-servers.png|right|x250px]]&lt;br /&gt;
|[[Image:HPSS-TS3500.png|right|x250px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= '''High Performance Storage System''' =&lt;br /&gt;
&lt;br /&gt;
The High Performance Storage System ([http://www.hpss-collaboration.org/index.shtml HPSS] [http://en.wikipedia.org/wiki/High_Performance_Storage_System wikipedia]) is a tape-backed hierarchical storage system that provides a significant portion of the allocated storage space at SciNet. It is a repository for archiving data that is not being actively used. Data can be returned to the active GPFS filesystem when it is needed. &lt;br /&gt;
&lt;br /&gt;
Since this system is intended for large data storage, it is accessible only to groups who have been awarded storage space at SciNet beyond 5TB in the yearly RAC resource allocation round. However, upon request, any user may be awarded access to HPSS, up to 2TB per group, so that you may get familiar with the system (just email support@scinet.utoronto.ca)&lt;br /&gt;
&lt;br /&gt;
Access and transfer of data into and out of HPSS is done under the control of the user, whose interaction is expected to be scripted and submitted as a batch job, using one or more of the following utilities:&lt;br /&gt;
* [http://www.mgleicher.us/GEL/hsi HSI] is a client with an ftp-like functionality which can be used to archive and retrieve large files. It is also useful for browsing the contents of HPSS.&lt;br /&gt;
* [http://www.mgleicher.us/GEL/htar HTAR] is a utility that creates tar formatted archives directly into HPSS. It also creates a separate index file (.idx) that can be accessed and browsed quickly.&lt;br /&gt;
* [https://support.scinet.utoronto.ca/wiki/index.php/ISH ISH] is a TUI utility that can perform an inventory of the files and directories in your tarballs.&lt;br /&gt;
&lt;br /&gt;
We're currently running HPSS v 7.3.3 patch 6, and HSI/HTAR version 4.0.1.2&lt;br /&gt;
&lt;br /&gt;
== '''Why should I use and trust HPSS?''' ==&lt;br /&gt;
* HPSS is a 25 year-old collaboration between IBM and the DoE labs in the US, and is used by about 45 facilities in the [http://www.top500.org “Top 500”] HPC list (plus some black-sites).&lt;br /&gt;
* Over 2.5 ExaBytes of combined storage world-wide.&lt;br /&gt;
* The top 3 sites in the World report (fall 2017) having 360PB, 220PB and 125PB in production (ECMWF, UKMO and BNL)&lt;br /&gt;
* Environment Canada also adopted HPSS in 2017 to store  Nav Canada data as well as to serve as their own archive. Currently has 2 X 100PB capacity installed. &lt;br /&gt;
* The SciNet HPSS system has been providing nearline capacity for important research data in Canada since early 2011, already at 10PB levels in 2018&lt;br /&gt;
* Very reliable, data redundancy and data insurance built-in (dual copies of everything are kept on tapes at SciNet)&lt;br /&gt;
* Data on cache and tapes can be geo-distributed for further resilience and HA.&lt;br /&gt;
* Highly scalable; current performance at SciNet - after a modest upgrade in 2017 - Ingest: ~150 TB/day, Recall: ~45 TB/day (aggregated).&lt;br /&gt;
* HSI/HTAR clients also very reliable and used on several HPSS sites. ISH was written at SciNet.&lt;br /&gt;
* [[Media:HPSS_rationale_SNUG.pdf|HPSS fits well with the Storage Capacity Expansion Plan at SciNet]] (pdf presentation)&lt;br /&gt;
&lt;br /&gt;
== '''Guidelines''' ==&lt;br /&gt;
* Expanded storage capacity is provided on tape -- a media that is not suited for storing small files. Files smaller than ~200MB should be grouped into tarballs with tar or htar.&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])&lt;br /&gt;
* We strongly urge that you use the sample scripts we are providing as the basis for your job submissions.&lt;br /&gt;
* Make sure to check the application's exit code and returned logs for errors after any data transfer or tarball creation process&lt;br /&gt;
&lt;br /&gt;
== '''New to the System?'''  ==&lt;br /&gt;
The first step is to email scinet support and request an HPSS account (or else you will get &amp;quot;Error - authentication/initialization failed&amp;quot; and 71 exit codes). &lt;br /&gt;
&lt;br /&gt;
THIS set of instructions on the wiki is the best and most compressed &amp;quot;manual&amp;quot; we have. It may seem a bit overwhelming at first, because of all the job script templates we make available below (they are here so you don't have to think &lt;br /&gt;
too much, just copy and paste), but if you approach the index at the top as a &amp;quot;case switch&amp;quot; mechanism for what you intend to do, everything falls in place.&lt;br /&gt;
&lt;br /&gt;
Try this sequence:&lt;br /&gt;
&lt;br /&gt;
1) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
(most linux shell commands have an equivalent in HPSS)&lt;br /&gt;
&lt;br /&gt;
2) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_tarball_create archive a small test directory using HTAR]&lt;br /&gt;
&lt;br /&gt;
2a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
3) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_offload archive a file using hsi]&lt;br /&gt;
&lt;br /&gt;
3a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
4) [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories archive a small test directory using HSI]&lt;br /&gt;
&lt;br /&gt;
4a) use step 1) to see what happened&lt;br /&gt;
&lt;br /&gt;
5) now try the other cases and so on. In a couple of hours you'll be in pretty good shape.&lt;br /&gt;
&lt;br /&gt;
== '''Bridge between BGQ and HPSS''' ==&lt;br /&gt;
&lt;br /&gt;
At this time BGQ users will have to migrate data to Niagara scratch prior to transferring it to HPSS. We are looking for ways to improve this workflow.&lt;br /&gt;
&lt;br /&gt;
== '''Access Through the Queue System'''  ==&lt;br /&gt;
All access to the archive system is done through the [[Slurm|NIA queue system]].&lt;br /&gt;
&lt;br /&gt;
* Job submissions should be done to the 'archivelong' queue or the 'archiveshort'&lt;br /&gt;
* Short jobs are limited to 1H walltime by default. Long jobs (&amp;gt; 1H) are limited to 72H walltime.&lt;br /&gt;
*  Users are limited to only 2 long jobs and 2 short jobs at the same time, and 10 jobs total on the queue.&lt;br /&gt;
* There can only be 5 long jobs running at any given time overall. Remaining submissions will be placed on hold for the time being. So far we have not seen a need for overall limit on short jobs.&lt;br /&gt;
&lt;br /&gt;
The status of pending jobs can be monitored with squeue specifying the archive queue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
squeue -p archiveshort&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
squeue -p archivelong&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Access Through an Interactive HSI session'''  ==&lt;br /&gt;
* You may want to acquire an interactive shell, start an HSI session and navigate the archive naming-space. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pinto@nia-login07:~$ salloc -p archiveshort -t 1:00:00&lt;br /&gt;
salloc: Granted job allocation 50918&lt;br /&gt;
salloc: Waiting for resource configuration&lt;br /&gt;
salloc: Nodes hpss-archive02-ib are ready for job&lt;br /&gt;
hpss-archive02-ib:~$&lt;br /&gt;
&lt;br /&gt;
hpss-archive02-ib:~$ hsi    (DON'T FORGET TO START HSI)&lt;br /&gt;
[pinto@hpss-archive02-ib ~]$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                * &lt;br /&gt;
*            INFO: THIS IS THE NEW 7.5.1 HPSS SYSTEM!            *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
****************************************************************** &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; ls&lt;br /&gt;
&lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; cd &amp;lt;some directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Deleting_with_an_interactive_HSI_session take a look around HPSS using an interactive HSI session]&lt;br /&gt;
&lt;br /&gt;
=== Scripted File Transfers ===&lt;br /&gt;
File transfers in and out of the HPSS should be scripted into jobs and submitted to the ''archivelong'' queue or the ''archiveshort'' . See generic example below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Creating a htar of finished-job1/ directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
 &lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
&lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Note:''' Always trap the execution of your jobs for abnormal terminations, and be sure to return the exit code&lt;br /&gt;
&lt;br /&gt;
=== Job Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Typically data will be recalled to /scratch when it is needed for analysis. Job dependencies can be constructed so that analysis jobs wait in the queue for data recalls before starting. The qsub flag is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--dependency=&amp;lt;type:JOBID&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where JOBID is the job number of the archive recalling job that must finish successfully before the analysis job can start.&lt;br /&gt;
&lt;br /&gt;
Here is a short cut for generating the dependency (lookup [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_data_recall data-recall.sh samples]):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hpss-archive02-ib:~$ sbatch $(sbatch data-recall.sh | awk {print &amp;quot;--dependency=afterany:&amp;quot;$1}') job-to-work-on-recalled-data.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HTAR''' ==&lt;br /&gt;
''' Please aggregate small files (&amp;lt;~200MB) into tarballs or htar files. '''&lt;br /&gt;
&lt;br /&gt;
''' [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;Keep your tarballs to size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | &amp;lt;font color=red&amp;gt;WHY?&amp;lt;/font&amp;gt;]])'''&lt;br /&gt;
&lt;br /&gt;
HTAR is a utility that is used for aggregating a set of files and directories, by using a sophisticated multithreaded buffering scheme to write files directly from GPFS into HPSS, creating an archive file that conforms to the POSIX TAR specification, thereby achieving a high rate of performance. HTAR does not do gzip compression, however it already has a built-in checksum algorithm.&lt;br /&gt;
&lt;br /&gt;
'''Caution'''&lt;br /&gt;
* Files larger than 68 GB cannot be stored in an HTAR archive. If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. unintentionally overwriting the htar destination file in HPSS&lt;br /&gt;
* Files with pathnames too long will be skipped (greater than 100 characters), so as to conform with TAR protocol [[(POSIX 1003.1 USTAR)]] -- Note that the HTAR will erroneously indicate success, however will produce exit code 70. For now, you can check for this type of error by &amp;quot;grep Warning my.output&amp;quot; after the job has completed.&lt;br /&gt;
* Unlike with cput/cget in HSI, &amp;quot;prompt before overwrite&amp;quot;, this is not the default with (h)tar. Be careful not to unintentionally overwrite a previous htar destination file in HPSS. There could be a similar situation when extracting material back into GPFS and overwriting the originals. Be sure to double-check the logic in your scripts.&lt;br /&gt;
* Check the HTAR exit code and log file before removing any files from the GPFS active filesystems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === HTAR Usage ===&lt;br /&gt;
* To write the ''file1'' and ''file2'' files to a new archive called ''files.tar'' in the default HPSS home directory, and preserve mask attributes (-p), enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf files.tar file1 file2&lt;br /&gt;
OR&lt;br /&gt;
    htar -cpf $ARCHIVE/files.tar file1 file2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To write a ''subdirA'' to a new archive called ''subdirA.tar'' in the default HPSS home directory, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -cpf subdirA.tar subdirA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To extract all files from the archive file called ''proj1.tar'' in HPSS into the ''project1/src'' directory in GPFS, and use the time of extraction as the modification time, enter:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cd  project1/src&lt;br /&gt;
    htar -xpmf proj1.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To display the names of the files in the ''out.tar'' archive file within the HPSS home directory, enter (the out.tar.idx file will be queried):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -vtf out.tar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To ensure that both the htar and the .idx files have read permissions to other members in your group use the umask option&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    htar -Humask=0137 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details please check the '''[http://www.mgleicher.us/GEL/htar/ HTAR - Introduction]''' or the '''[http://www.mgleicher.us/GEL/htar/htar_man_page.html HTAR Man Page]''' online&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Sample tarball create ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_create_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be /archive/$(id -gn)/$(whoami)/&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
# htar WILL overwrite an existing file with the same name so check beforehand.&lt;br /&gt;
 &lt;br /&gt;
hsi ls $DEST &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ $status == 0 ]; then   &lt;br /&gt;
    echo 'File $DEST already exists. Nothing has been done'&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
cd $SCRATCH/workarea/ &lt;br /&gt;
htar -Humask=0137 -cpf $DEST finished-job1/ &lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' If you attempt to start a transfer with any files larger than 68GB the whole HTAR session will fail, and you'll get a notification listing all those files, so that you can transfer them with HSI. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
----------------------------------------&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file1 (86567185745 bytes)&lt;br /&gt;
INFO: File too large for htar to handle: finished-job1/file2 (71857244579 bytes)&lt;br /&gt;
ERROR: 2 oversize member files found - please correct and retry&lt;br /&gt;
ERROR: [FATAL] error(s) generating filename list &lt;br /&gt;
HTAR: HTAR FAILED&lt;br /&gt;
###WARNING  htar returned non-zero exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball list ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash -l&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J htar_list_tarball_in_hpss&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
DEST=$ARCHIVE/finished-job1.tar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
htar -tvf $DEST&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample tarball extract ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_extract_tarball_from_hpss&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/recalled-from-hpss&lt;br /&gt;
htar -xpmf $ARCHIVE/finished-job1.tar&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HSI''' ==&lt;br /&gt;
&lt;br /&gt;
HSI may be the primary client with which some users will interact with HPSS. It provides an ftp-like interface for archiving and retrieving tarballs or [https://support.scinet.utoronto.ca/wiki/index.php/HPSS#Sample_transferring_directories directory trees]. In addition it provides a number of shell-like commands that are useful for examining and manipulating the contents in HPSS. The most commonly used commands will be:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
  | cput &lt;br /&gt;
  | Conditionally saves or replaces a HPSSpath file to GPFSpath if the GPFS version is new or has been updated&lt;br /&gt;
 cput [options] GPFSpath [: HPSSpath]&lt;br /&gt;
|-&lt;br /&gt;
  | cget &lt;br /&gt;
  | Conditionally retrieves a copy of a file from HPSS to GPFS only if a GPFS version does not already exist. &lt;br /&gt;
 cget [options] [GPFSpath :] HPSSpath&lt;br /&gt;
|-&lt;br /&gt;
  | cd,mkdir,ls,rm,mv&lt;br /&gt;
  | Operate as one would expect on the contents of HPSS.&lt;br /&gt;
|-&lt;br /&gt;
  | lcd,lls&lt;br /&gt;
  | ''Local'' commands to GPFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*There are 3 distinctions about HSI that you should keep in mind, and that can generate a bit of confusion when you're first learning how to use it:&lt;br /&gt;
** HSI doesn't currently support renaming directories paths during transfers on-the-fly, therefore the syntax for cput/cget may not work as one would expect in some scenarios, requiring some workarounds.&lt;br /&gt;
** HSI has an operator &amp;quot;:&amp;quot; which separates the GPFSpath and HPSSpath, and must be surrounded by whitespace (one or more space characters)&lt;br /&gt;
** The order for referring to files in HSI syntax is different from FTP. In HSI the general format is always the same, GPFS first, HPSS second, cput or cget:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     GPFSfile : HPSSfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, when using HSI to store the tarball file from GPFS into HPSS, then recall it to GPFS, the following commands could be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
    cget tarball-recalled : tarball-in-HPSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
unlike with FTP, where the following syntax would be used:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    put tarball-in-GPFS tarball-in-HPSS &lt;br /&gt;
    get tarball-in-HPSS tarball-recalled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Simple commands can be executed on a single line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;quot;mkdir LargeFilesDir; cd LargeFilesDir; cput tarball-in-GPFS : tarball-in-HPSS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* More complex sequences can be performed using an except such as this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      mkdir LargeFilesDir&lt;br /&gt;
      cd LargeFilesDir&lt;br /&gt;
      cput tarball-in-GPFS : tarball-in-HPSS&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir2/&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The commands below are equivalent, but we recommend that you always use full path, and organize the contents of HPSS, where the default HSI directory placement is $ARCHIVE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput tarball&lt;br /&gt;
    hsi cput tarball : tarball&lt;br /&gt;
    hsi cput $SCRATCH/tarball : $ARCHIVE/tarball&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* There are no known issues renaming files on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi cput $SCRATCH/tarball1 : $ARCHIVE/tarball2&lt;br /&gt;
    hsi cget $SCRATCH/tarball3 : $ARCHIVE/tarball2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* However the syntax forms such as the ones below will fail, since they rename the directory paths.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir2    (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cput -Ruph $SCRATCH/LargeFilesDir/* : $ARCHIVE/LargeFilesDir2  (FAILS)&lt;br /&gt;
OR&lt;br /&gt;
   hsi cget -Ruph $SCRATCH/LargeFilesDir : $ARCHIVE/LargeFilesDir     (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is the following 2-steps process, where you do a &amp;quot;lcd &amp;quot; in GPFS first, and recursively transfer the whole directory (-R), keeping the same name. You may use '-u' option to resume a previously disrupted session, and the '-p' to  preserve timestamp, and '-h' to keep the links.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH&lt;br /&gt;
      cget -Ruph LargeFilesDir&lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another workaround is do a &amp;quot;lcd&amp;quot; into the GPFSpath first and a &amp;quot;cd&amp;quot; in the HPSSpath, but transfer the files individually with the '*' wild character. This option lets you change the directory name:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    hsi &amp;lt;&amp;lt;EOF&lt;br /&gt;
      lcd $SCRATCH/LargeFilesDir&lt;br /&gt;
      mkdir $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cd $ARCHIVE/LargeFilesDir2&lt;br /&gt;
      cput -Ruph *  &lt;br /&gt;
    end&lt;br /&gt;
    EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Documentation === &lt;br /&gt;
Complete documentation on HSI is available from the Gleicher Enterprises links below. You may peruse those links and come with alternative syntax forms. You may even be already familiar with HPSS/HSI from other HPC facilities, that may or not have procedures similar to ours. HSI doesn't always work as expected when you go outside of our recommended syntax, so '''we strongly urge that you use the sample scripts we are providing as the basis''' for your job submissions&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_reference_manual_2/introduction.html HSI Introduction]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi_man_page.html man hsi]&lt;br /&gt;
* [http://support.scinet.utoronto.ca/wiki/index.php/HSI_help hsi help]&lt;br /&gt;
* [http://www.mgleicher.us/hsi/hsi-exit-codes.html exit codes] &lt;br /&gt;
'''Note:''' HSI returns the highest-numbered exit code, in case of multiple operations in the same hsi session. You may use '/scinet/gpc/bin/exit2msg $status' to translate those codes into intelligible messages&lt;br /&gt;
&lt;br /&gt;
=== Typical Usage Scripts===&lt;br /&gt;
The most common interactions will be ''putting'' data into HPSS, examining the contents (ls,ish), and ''getting'' data back onto GPFS for inspection or analysis.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data offload''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-offload.sh&lt;br /&gt;
#SBATCH -t 72:00:00&lt;br /&gt;
#SBATCH -p archivelong &lt;br /&gt;
#SBATCH -N 1&lt;br /&gt;
#SBATCH -J offload&lt;br /&gt;
#SBATCH --mail-type=ALL&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# individual tarballs already exist&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job1.tar.gz : finished-job1.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi  -v &amp;lt;&amp;lt;EOF2&lt;br /&gt;
mkdir put-away&lt;br /&gt;
cd put-away&lt;br /&gt;
cput $SCRATCH/workarea/finished-job2.tar.gz : finished-job2.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF2&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note:''' as in the above example, we recommend that you capture the (highest-numbered) exit code for each hsi session independently. And remember, you may improve your exit code verbosity by adding the excerpt below to your scripts:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ ! $status == 0 ];then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/niagara/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data list''' ====&lt;br /&gt;
A very trivial way to list the contents of HPSS would be to just submit the HSI 'ls' command.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#PBS -l walltime=1:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N hpss_ls&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF&lt;br /&gt;
cd put-away&lt;br /&gt;
ls -R&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Warning: if you have a lot of files, the ls command will take a long time to complete. For instance, about 400,000 files can be listed in about an hour. Adjust the walltime accordingly, and be on the safe side.''&lt;br /&gt;
&lt;br /&gt;
However, we provide a much more useful and convenient way to explore the contents of HPSS with the inventory shell [[ISH]]. This example creates an index of all the files in a user's portion of the namespace. The list is placed in the directory /home/$(whoami)/.ish_register that can be inspected from the gpc-devel nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-list.sh&lt;br /&gt;
#PBS -l walltime=1:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N hpss_index&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
INDEX_DIR=$HOME/.ish_register&lt;br /&gt;
if ! [ -e &amp;quot;$INDEX_DIR&amp;quot; ]; then&lt;br /&gt;
  mkdir -p $INDEX_DIR&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
export ISHREGISTER=&amp;quot;$INDEX_DIR&amp;quot;&lt;br /&gt;
/scinet/gpc/bin/ish hindex&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
''Note: the above warning on collecting the listing for many files applies here too.''&lt;br /&gt;
&lt;br /&gt;
This index can be browsed or searched with ISH on the development nodes.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gpc-f104n084-$ /scinet/gpc/bin/ish ~/.ish_register/hpss.igz &lt;br /&gt;
[ish]hpss.igz&amp;gt; help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ISH is a powerful tool that is also useful for creating and browsing indices of tar and htar archives, so please look at the [[ISH|documentation]] or built in help.&lt;br /&gt;
&lt;br /&gt;
==== Sample '''data recall''' ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_files&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Jan-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Jan-2010-jobs.tar.gz&lt;br /&gt;
cget $SCRATCH/recalled-from-hpss/Feb-2010-jobs.tar.gz : $ARCHIVE/put-away-on-2010/Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We should emphasize that a single ''cget'' of multiple files (rather than several separate gets) allows HSI to do optimization, as in the following example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_files_optimized&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
mkdir -p $SCRATCH/recalled-from-hpss&lt;br /&gt;
&lt;br /&gt;
# individual tarballs previously organized in HPSS inside the put-away-on-2010/ folder&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled-from-hpss/&lt;br /&gt;
cd $ARCHIVE/put-away-on-2010/&lt;br /&gt;
cget Jan-2010-jobs.tar.gz Feb-2010-jobs.tar.gz&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sample '''transferring directories''' ====&lt;br /&gt;
Remember, it's not possible to rename directories on-the-fly:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hsi cget -Ruph $SCRATCH/LargeFiles-recalled : $ARCHIVE/LargeFiles    (FAILS)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One workaround is transfer the whole directory (and sub-directories) recursively:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/recalled&lt;br /&gt;
cd $ARCHIVE/&lt;br /&gt;
cget -Ruph LargeFiles&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another workaround is to transfer files and subdirectories individually with the &amp;quot;*&amp;quot; wild character:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# This script is named: data-recall.sh&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N recall_directories&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
mkdir -p $SCRATCH/LargeFiles-recalled&lt;br /&gt;
&lt;br /&gt;
hsi  -v &amp;lt;&amp;lt; EOF&lt;br /&gt;
lcd $SCRATCH/LargeFiles-recalled&lt;br /&gt;
cd $ARCHIVE/LargeFiles&lt;br /&gt;
cget -Ruph *&lt;br /&gt;
end&lt;br /&gt;
EOF&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* For more details please check the '''[http://www.mgleicher.us/GEL/hsi/ HSI Introduction]''', the '''[http://www.mgleicher.us/GEL/hsi/hsi_man_page.html HSI Man Page]''' or the or the [https://support.scinet.utoronto.ca/wiki/index.php/HSI_help '''hsi help''']&lt;br /&gt;
&lt;br /&gt;
== '''[[ISH|ISH]]''' ==&lt;br /&gt;
=== [[ISH|Documentation and Usage]] ===&lt;br /&gt;
 &lt;br /&gt;
== '''File and directory management''' ==&lt;br /&gt;
=== Moving/renaming ===&lt;br /&gt;
* you may use 'mv' or 'cp' in the same way as the linux version.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;HPSS file and directory management&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    mkdir $ARCHIVE/2011&lt;br /&gt;
    mv $ARCHIVE/oldjobs $ARCHIVE/2011&lt;br /&gt;
    cp -r $ARCHIVE/almostfinished/*done $ARCHIVE/2011&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deletions ===&lt;br /&gt;
==== Recommendations ====&lt;br /&gt;
* Be careful with the use of 'cd' commands to non-existing directories before the 'rm' command. Results may be unpredictable&lt;br /&gt;
* Avoid the use of the stand alone wild character '''*'''. If necessary, whenever possible have it bound to common patterns, such as '*.tmp', so to limit unintentional mis-happens&lt;br /&gt;
* Avoid using relative paths, even the env variable $ARCHIVE. Better to explicitly expand the full paths in your scripts&lt;br /&gt;
* Avoid using recursive/looped deletion instructions on $SCRATCH contents from the archive job scripts. Even on $ARCHIVE contents, it may be better to do it as an independent job submission, after you have verified that the original ingestion into HPSS finished without any issues.&lt;br /&gt;
&lt;br /&gt;
==== Typical example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N deletion_script&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
echo &amp;quot;Deletion of an outdated directory tree into HPSS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that the initial directory in HPSS ($ARCHIVE) has the path explicitly expanded&lt;br /&gt;
&lt;br /&gt;
/usr/local/bin/hsi -v &amp;lt;&amp;lt;EOF1&lt;br /&gt;
    rm /archive/s/scinet/pinto/*.tmp&lt;br /&gt;
    rm -R /archive/s/scinet/pinto/obsolete&lt;br /&gt;
end&lt;br /&gt;
EOF1&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deleting with an interactive HSI session ====&lt;br /&gt;
* You may feel more comfortable acquiring an interactive shell, starting an HSI session and proceeding with your deletions that way. Keep in mind, you're restricted to 1H.&lt;br /&gt;
&lt;br /&gt;
* After using the ''qsub -q archive -I'' command you'll get a standard shell prompt on an archive execution node (hpss-archive02), as you would on any compute node. However you will need to run '''HSI''' or '''HTAR''' to access resources on HPSS. &lt;br /&gt;
&lt;br /&gt;
* HSI will give you a prompt very similar to a standard shell, where your can navigate around using commands such 'ls', 'cd', 'pwd', etc ... NOTE: not every bash command has an equivalent on HSI -  for instance, you can not 'vi' or 'cat'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpc-f103n084-$ qsub -q archive -I&lt;br /&gt;
qsub: waiting for job 11611291.gpc-sched to start&lt;br /&gt;
qsub: job 11611291.gpc-sched ready&lt;br /&gt;
&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Begin PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
Job ID:		11611291.gpc-sched&lt;br /&gt;
Username:	pinto&lt;br /&gt;
Group:		scinet&lt;br /&gt;
Nodes:		gpc-archive01&lt;br /&gt;
End PBS Prologue Mon May 28 13:15:28 EDT 2012 1338225328&lt;br /&gt;
----------------------------------------&lt;br /&gt;
hpss-archive02-$ hsi&lt;br /&gt;
******************************************************************&lt;br /&gt;
*     Welcome to HPSS@SciNet - High Perfomance Storage System    *&lt;br /&gt;
*                                                                *&lt;br /&gt;
*        Contact Information: support@scinet.utoronto.ca         *&lt;br /&gt;
*  NOTE: do not transfer SMALL FILES with HSI. Use HTAR instead  *&lt;br /&gt;
*              CHECK THE INTEGRITY OF YOUR TARBALLS              *&lt;br /&gt;
******************************************************************&lt;br /&gt;
Username: pinto  UID: 10010  Acct: 10010(10010) Copies: 2 Firewall: off [hsi.4.0.1 Thu Mar 22 11:44:03 EDT 2012] &lt;br /&gt;
[HSI]/archive/s/scinet/pinto-&amp;gt; rm -R junk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''HPSS for the 'Watchmaker' ''' ==&lt;br /&gt;
=== Efficient alternative to htar ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | hsi put - : $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to immediately generate an index&lt;br /&gt;
ish hindex $ARCHIVE/mydir.tar&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'ISH returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#cd $SCRATCH&lt;br /&gt;
#hsi cget - : $ARCHIVE/mydir.tar | tar -xv &lt;br /&gt;
#status=$?&lt;br /&gt;
# if [ ! $status == 0 ]; then&lt;br /&gt;
#   echo 'TAR+HSI+piping returned non-zero code.'&lt;br /&gt;
#   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
#   exit $status&lt;br /&gt;
#else&lt;br /&gt;
#   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
#fi&lt;br /&gt;
&lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
'''Notes:''' &lt;br /&gt;
* Combining commands in this fashion, besides being HPSS-friendly, should not be that noticeably slower than the recursive put with HSI that stores each file one by one. However, reading the files back from tape in this format will be many times faster. It would also overcome the current 68GB limit on the size of stored files that we have with htar.&lt;br /&gt;
* To top things off, we recommend indexing with ish (in the same script) immediately after the tarball creation , while it resides in the HPSS cache. It would be as if htar was used.&lt;br /&gt;
* To ensure that an error at any stage of the pipeline shows up in the returned status use: ''set -o pipefail'' (The default is to return the status of the last command in the pipeline and this is not what you want.)&lt;br /&gt;
* Optimal performance for aggregated transfers and allocation on tapes is obtained with [[Why not tarballs too large |&amp;lt;font color=red&amp;gt;tarballs of size 500GB or less&amp;lt;/font&amp;gt;]], whether ingested by htar or hsi ([[Why not tarballs too large | WHY?]]). Be sure to check the contents of the directory tree with 'du' for the total amount of data before  sending them to the tar+HSI piping.&lt;br /&gt;
&lt;br /&gt;
=== Multi-threaded gzip'ed compression with pigz ===&lt;br /&gt;
We compiled multi-threaded implementation of gzip called pigz (http://zlib.net/pigz/). It's now part of the &amp;quot;extras&amp;quot; module. It can also be used on any compute or devel nodes. This makes the execution of the previous version of the script much quicker than if you were to use 'tar -cfz'. In addition, by piggy-backing ISH to the end of the script, it will know what to do with the just created mydir.tar.gz compressed tarball.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N tar_create_compressed_tarball_in_hpss_with_hsi_by_piping&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
&lt;br /&gt;
# When using a pipeline like this&lt;br /&gt;
set -o pipefail &lt;br /&gt;
&lt;br /&gt;
load module extras&lt;br /&gt;
&lt;br /&gt;
# to put (cput will fail)&lt;br /&gt;
tar -c $SCRATCH/mydir | pigz | hsi put - : $ARCHIVE/mydir.tar.gz&lt;br /&gt;
status=$?&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'TAR+PIGZ+HSI+piping returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Content Verification ===&lt;br /&gt;
&lt;br /&gt;
==== HTAR CRC checksums ====&lt;br /&gt;
Specifies that HTAR should generate CRC checksums when creating the archive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N htar_create_tarball_in_hpss_with_checksum_verification&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -m e&lt;br /&gt;
 &lt;br /&gt;
trap &amp;quot;echo 'Job script not completed';exit 129&amp;quot; TERM INT&lt;br /&gt;
# Note that your initial directory in HPSS will be $ARCHIVE&lt;br /&gt;
 &lt;br /&gt;
cd $SCRATCH/workarea&lt;br /&gt;
&lt;br /&gt;
# to put&lt;br /&gt;
htar -Humask=0137 -cpf $ARCHIVE/finished-job1.tar -Hcrc -Hverify=1 finished-job1/&lt;br /&gt;
&lt;br /&gt;
# to get&lt;br /&gt;
#mkdir $SCRATCH/verification&lt;br /&gt;
#cd $SCRATCH/verification&lt;br /&gt;
#htar -Hcrc -xvpmf $ARCHIVE/finished-job1.tar &lt;br /&gt;
&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
trap - TERM INT&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HTAR returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Current HSI version - Checksum built-in ====&lt;br /&gt;
&lt;br /&gt;
MD5 is the standard Hashing Algorithm for the HSI build at SciNet. For hsi ingestions with the '-c on' option you should be able to query the md5 hash with the hsi command 'hashli'. That value is stored as an UDA (User Defined Attribute) for each file (a feature of HPSS starting with 7.4)&lt;br /&gt;
&lt;br /&gt;
[http://www.mgleicher.us/GEL/hsi/hsi_reference_manual_2/checksum-feature.html More usage details here]&lt;br /&gt;
&lt;br /&gt;
The checksum algorithm is very CPU-intensive. Although the checksum code is compiled with a high level of compiler optimization, transfer rates can be significantly reduced when checksum creation or verification is in effect. The amount of degradation in transfer rates depends on several factors, such as  processor speed, network transfer speed, and speed of the local filesystem (GPFS).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N MD5_checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly (-c on)&lt;br /&gt;
hsi -q put -c on $thefile : $storedfile&lt;br /&gt;
pid=$!&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi lshash $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# get the file back with checksum&lt;br /&gt;
hsi get -c on $storedfile&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Prior to HSI version 4.0.1.1 ====&lt;br /&gt;
&lt;br /&gt;
This will checksum the contents of the HPSSpath against the original GPFSpath after the transfer has finished.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#PBS -l walltime=72:00:00&lt;br /&gt;
#PBS -q archive&lt;br /&gt;
#PBS -N checksum_verified_transfer&lt;br /&gt;
#PBS -j oe&lt;br /&gt;
#PBS -me&lt;br /&gt;
&lt;br /&gt;
thefile=&amp;lt;GPFSpath&amp;gt;&lt;br /&gt;
storedfile=&amp;lt;HPSSpath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Generate checksum on fly using a named pipe so that file is only read from GPFS once&lt;br /&gt;
mkfifo /tmp/NPIPE&lt;br /&gt;
cat $thefile  | tee /tmp/NPIPE | hsi -q put - : $storedfile &amp;amp;&lt;br /&gt;
pid=$!&lt;br /&gt;
md5sum /tmp/NPIPE |tee /tmp/$fname.md5&lt;br /&gt;
rm -f  /tmp/NPIPE&lt;br /&gt;
&lt;br /&gt;
# Check the exit code of the HSI process  &lt;br /&gt;
wait $pid&lt;br /&gt;
status=$?&lt;br /&gt;
&lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# change filename to stdin in checksum file&lt;br /&gt;
sed -i.1 &amp;quot;s+/tmp/NPIPE+-+&amp;quot; /tmp/$fname.md5&lt;br /&gt;
&lt;br /&gt;
# verify checksum&lt;br /&gt;
hsi -q get - : $storedfile  | md5sum -c  /tmp/$fname.md5&lt;br /&gt;
status=$?&lt;br /&gt;
 &lt;br /&gt;
if [ ! $status == 0 ]; then&lt;br /&gt;
   echo 'HSI returned non-zero code.'&lt;br /&gt;
   /scinet/gpc/bin/exit2msg $status&lt;br /&gt;
   exit $status&lt;br /&gt;
else&lt;br /&gt;
   echo 'TRANSFER SUCCESSFUL'&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using Globus''' ==&lt;br /&gt;
* &amp;lt;font color=red&amp;gt; Please note that Globus access to HPSS is disabled until further notice, due to lack of version compatibility.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You may now transfer data between SciNet's HPSS and an external source&lt;br /&gt;
* Follow the link below &lt;br /&gt;
  https://globus.computecanada.ca&lt;br /&gt;
: Enter your Compute Canada username and password.&lt;br /&gt;
* In the 'File Transfer' tab, enter ''''Compute Canada HPSS'''' as one of the Endpoints. To authenticate this endpoint, enter your SciNet username and password.&lt;br /&gt;
* You may read more about Compute Canada's Globus Portal here:&lt;br /&gt;
  https://docs.computecanada.ca/wiki/Globus&lt;br /&gt;
&lt;br /&gt;
== '''Access to HPSS using SME''' ==&lt;br /&gt;
* Storage Made Easy - SME - is an Enterprise Cloud Portal adopted by SciNet to allow our users to access HPSS&lt;br /&gt;
* Best suitable for light transfers to/from your personal computer and to navigate your contents on HPSS&lt;br /&gt;
* Follow the link below using a web browser and login with your SicNet UserID and password. Under File Manager you will find the &amp;quot;'''SciNet HPSS'''&amp;quot; folder.&lt;br /&gt;
  https://sme.scinet.utoronto.ca&lt;br /&gt;
* SME can be configured as a DropBox. To download the Free Cloud File Manager native to your OS (Windows, Mac, Linux, mobile), follow the link below:&lt;br /&gt;
  https://www.storagemadeeasy.com/clients_and_tools/&lt;br /&gt;
Once you have downloaded and installed the Cloud Manager App, fill up the following information:&lt;br /&gt;
  Server location&lt;br /&gt;
  https://sme.scinet.utoronto.ca/api&lt;br /&gt;
* You may learn more about SME capabilities and features here:&lt;br /&gt;
  https://www.storagemadeeasy.com/ownFileserver/&lt;br /&gt;
  https://www.storagemadeeasy.com/pricing/#features  (Enterprise)&lt;br /&gt;
  https://storagemadeeasy.com/faq/&lt;br /&gt;
&lt;br /&gt;
== '''User provided Content/Suggestions''' ==&lt;br /&gt;
=== '''[[HPSS-by-pomes|Packing up large data sets and putting them on HPSS]]''' ===&lt;br /&gt;
(Pomés group recommendations)&lt;br /&gt;
&lt;br /&gt;
[[Data Management|BACK TO Data Management]]&lt;/div&gt;</summary>
		<author><name>Pinto</name></author>
	</entry>
</feed>