<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cyberz.org &#187; Solaris</title>
	<atom:link href="http://www.cyberz.org/blog/tag/solaris/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberz.org/blog</link>
	<description>Andrea Leofreddi's homepage</description>
	<lastBuildDate>Tue, 10 Aug 2010 17:19:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Bacula mail changer script (aka poor man&#8217;s autoloader)</title>
		<link>http://www.cyberz.org/blog/2009/06/08/bacula-mail-changer-script-aka-poor-mans-autoloader/</link>
		<comments>http://www.cyberz.org/blog/2009/06/08/bacula-mail-changer-script-aka-poor-mans-autoloader/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 22:16:32 +0000</pubDate>
		<dc:creator>andrea</dc:creator>
				<category><![CDATA[All/News]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Bacula]]></category>

		<guid isPermaLink="false">http://www.cyberz.org/blog/?p=24</guid>
		<description><![CDATA[I enjoy Bacula for automated]]></description>
			<content:encoded><![CDATA[<p>I enjoy Bacula for automated home backups on DLT and DDS tape drives. Being used at home there&#8217;s no &#8211; obviously &#8211; big-dollar-company-manager to ask for an autoloader; and when the time of a tape change comes bacula lacks a simple way to request a manual tape change and just hangs up. So I managed to build a fake autoloader shell script, which, using emails, would emulate a real autoloader. This script, which I baptised <em>mail-changer</em>, features:</p>
<ul>
<li>email support</li>
<li>periodic email resend when tape change is needed</li>
<li>tape detection and check (if you&#8217;re supposed to insert tape 4 and you enter 5, the script will kindly refuse the tape, unload it and send a warning email message asking for the right one)</li>
</ul>
<p><span id="more-24"></span>To implement the third point (tape detection and check), it was necessary to extract the tape id from the bacula tape. That can be done looking at the bacula&#8217;s tape header structure:</p>
<p>The first structure stored is called &#8220;Block Header&#8221; and is 24 bytes long:</p>
<pre>   uint32_t CheckSum;                /* Block check sum */
   uint32_t BlockSize;               /* Block byte size including the header */
   uint32_t BlockNumber;             /* Block number */
   char ID[4] = "BB02";              /* Identification and block level */
   uint32_t VolSessionId;            /* Session Id for Job */
   uint32_t VolSessionTime;          /* Session Time for Job */</pre>
<p>Then a &#8220;Record Header&#8221; follows (12 bytes):</p>
<pre>  int32_t FileIndex;   /* File index supplied by File daemon */
  int32_t Stream;      /* Stream number supplied by File daemon */
  uint32_t DataSize;   /* size of following data record in bytes */</pre>
<p>Then a structure which is interesting for us, called &#8220;Volume Label&#8221; follows:</p>
<pre>  char Id[32];              /* Bacula 1.0 Immortal\n */
  uint32_t VerNum;          /* Label version number */
  /* VerNum 11 and greater Bacula 1.27 and later */
  btime_t   label_btime;    /* Time/date tape labeled */
  btime_t   write_btime;    /* Time/date tape first written */
  /* The following are 0 in VerNum 11 and greater */
  float64_t write_date;     /* Date this label written */
  float64_t write_time;     /* Time this label written */
  char VolName[128];        /* Volume name */
  char PrevVolName[128];    /* Previous Volume Name */
  char PoolName[128];       /* Pool name */
  char PoolType[128];       /* Pool type */
  char MediaType[128];      /* Type of this media */
  char HostName[128];       /* Host name of writing computer */
  char LabelProg[32];       /* Label program name */
  char ProgVersion[32];     /* Program version */
  char ProgDate[32];        /* Program build date/time */</pre>
<p>What is really important for us is the VolName field, which is at relative offset +56 from the beginning of the <em>Volume Label</em>. Adding 12 bytes of <em>Record Header</em> and 24 of <em>Block Header</em> makes 92 bytes.</p>
<p>Please note that mail-changer has been developed on Solaris 10 using CSW&#8217;s Bacula, you may need to work a bit to adapt it to your unix.</p>
<p>You can <a title="mail-changer script" href="/projects/mail-changer/mail-changer" target="_blank">download mail-changer here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberz.org/blog/2009/06/08/bacula-mail-changer-script-aka-poor-mans-autoloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solaris 10 si3124 backport (workaround for bug #6566207)</title>
		<link>http://www.cyberz.org/blog/2008/03/08/solaris-si3124-backport-workaround-for-bug-6566207/</link>
		<comments>http://www.cyberz.org/blog/2008/03/08/solaris-si3124-backport-workaround-for-bug-6566207/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 23:28:31 +0000</pubDate>
		<dc:creator>andrea</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[sata]]></category>

		<guid isPermaLink="false">http://www.cyberz.org/blog/?p=10</guid>
		<description><![CDATA[Do you think you can]]></description>
			<content:encoded><![CDATA[<p>Do you think you can get a fast cheap SATA mass storage at home with Solaris 10 and ZFS just plugging a cheap si3124 controller?</p>
<p style="text-align: center;"><a href="http://www.cyberz.org/blog/wp-content/uploads/2008/07/z4sil3124-4ports-sata-32bit.jpg"><img class="size-medium wp-image-20 aligncenter" title="si3124" src="http://www.cyberz.org/blog/wp-content/uploads/2008/07/z4sil3124-4ports-sata-32bit-299x261.jpg" alt="" width="246" height="213" /></a></p>
<p>Not so easily: on Solaris 10 you will be afflicted by some boring bug known as <a href="http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6566207" target="_blank">bug #6566207</a> which gets your controller stuck for around a minute after some heavy I/O.</p>
<p><span id="more-10"></span></p>
<p>This means you cannot move data (eg. a dvd iso file) within reasonable amount of time because your controller will get stuck on 100% busy state and your transfer will freeze for 60 seconds. In my case this behaviour was showing often, enough to drop an gig ethernet ftp transfer rate to ~2Mb/s, as you can see:</p>
<p><code>4641337344 bytes transferred in 2413 seconds (1.83M/s)</code></p>
<p>Looking on internet you can find some people complaining about this bug (some of them switched to other OSes for this issue) but no workaround has been posted for Solaris 10: too bad.</p>
<p>Sun knows the bug exists but they seem to ignore this issue (who cares about crappy hardware?). OpenSolaris people knows the bug exists and they already patched it (there&#8217;s an error in interrupt handling routine: interrupts get cleared twice), but their si3124 module simply won&#8217;t load on Solaris 10.</p>
<p>So the trick is to compile the OpenSolaris&#8217; si3124 driver for Solaris 10, and that&#8217;s what I did. I got from <a title="OpenSolaris" href="http://www.opensolaris.com">OpenSolaris</a> an si3124 source (old enough to be close to the one shipped on S10), backported the <a href="http://src.opensolaris.org/source/diff/onnv/onnv-gate/usr/src/uts/common/io/sata/adapters/si3124/si3124.c?r2=%2Fonnv%2Fonnv-gate%2Fusr%2Fsrc%2Futs%2Fcommon%2Fio%2Fsata%2Fadapters%2Fsi3124%2Fsi3124.c%404810&amp;r1=%2Fonnv%2Fonnv-gate%2Fusr%2Fsrc%2Futs%2Fcommon%2Fio%2Fsata%2Fadapters%2Fsi3124%2Fsi3124.c%403116">patch</a> and rebuilt it.</p>
<p>Now my system is working fine, I never experienced these lockups again. Below is attached a tarball containing the si3124 sources and driver compiled for x86 (32bit). If you want to build a SPARC or 64bit version of the driver you need Sun Studio 10 plus some Makefile CFLAGS tweaking.</p>
<p>To install the binary driver follow these steps:</p>
<ol>
<li>Copy /kernel/drv/si3124 in a safe place (the original driver)</li>
<li>Download the tarball below</li>
<li>Untar the the tarball and copy si3124 to /kernel/drv</li>
<li>Reboot</li>
</ol>
<p>If everything works fine, your system should boot with the new driver. You can check the version you&#8217;re running using modinfo, as shown here:</p>
<p><code>root@siona:~# modinfo | grep si3124<br />
141 f8ee2000 4c94 206 1 si3124 (si3124 driver v1.3bp)<br />
root@siona:~#</code></p>
<p>The patched driver has been tested on:</p>
<ol>
<li>Solaris 10 update 3 (native driver is 1.2)</li>
<li>Solaris 10 update 5 (native driver is 1.2)</li>
</ol>
<p>The backported driver shows version v1.3bp. You can <a title="si3124 backport (binary and sources)" href="http://www.cyberz.org/blog/wp-content/uploads/2008/03/si3124bp.tar">download the si3124 backport (binary and sources) tarball here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberz.org/blog/2008/03/08/solaris-si3124-backport-workaround-for-bug-6566207/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>seq equivalent</title>
		<link>http://www.cyberz.org/blog/2008/02/27/seq-equivalent-on-solarismacosx/</link>
		<comments>http://www.cyberz.org/blog/2008/02/27/seq-equivalent-on-solarismacosx/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 19:19:28 +0000</pubDate>
		<dc:creator>andrea</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://www.cyberz.org/blog/?p=9</guid>
		<description><![CDATA[On platforms without seq (MacOSX,]]></description>
			<content:encoded><![CDATA[<p>On platforms without seq (MacOSX, Solaris), you can emulate it using dc as follows (note the upper bound and the lower bound):</p>
<p><code>echo '[1+pd<em>upper bound</em>&gt;aq]sa<em>lower bound</em> 1-lax' | dc</code></p>
<p>For example:</p>
<p><code>alia:~ andrea$ echo '[1+pd5&gt;aq]sa0 1-lax' | dc<br />
0<br />
1<br />
2<br />
3<br />
4<br />
5<br />
alia:~ andrea$</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberz.org/blog/2008/02/27/seq-equivalent-on-solarismacosx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
