<?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>Cypris&#039; lookout &#187; sysadmin</title>
	<atom:link href="http://blog.nkadesign.com/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nkadesign.com</link>
	<description>Renaud Bompuis on the interwebs!</description>
	<lastBuildDate>Sat, 14 Jan 2012 06:30:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Admin: Linux file server performance boost (ext4 version)</title>
		<link>http://blog.nkadesign.com/2010/admin-linux-file-server-performance-boost-ext4-version/</link>
		<comments>http://blog.nkadesign.com/2010/admin-linux-file-server-performance-boost-ext4-version/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 04:34:34 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=665</guid>
		<description><![CDATA[In the previous article, I showed how to improve the performance of an existing file server by tweaking ext3 and mount settings. We can also take advantage of the availability of the now stable ext4 file system to further improve our file server performance. Some distribution, in particular RedHat/CentOS 5, do not allow us to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/linux.png" alt="Linux" title="Linux" align="left" width="54" height="64" hspace="5" vspace="5" border="0" />In the previous article, I showed how to improve the performance of an existing file server by tweaking ext3 and mount settings.<br />
We can also take advantage of the availability of the now stable ext4 file system to further improve our file server performance.</p>

<p>Some distribution, in particular RedHat/CentOS 5, do not allow us to select ext4 as a formatting option during setup of the machine, so you will initially have to use ext3 as file system (on top of LVM preferably for easy extensibility).</p>

<h3>A small digression on partitioning</h3>

<p>Remember to create separate partitions for your file data: do not mix OS files with data files, they should live on different partitions.
In an enterprise environment, a minimal partition configuration for a file server could look like:</p>

<p>Hardware:</p>

<ul>
<li>2x 160GB HDD for the OS</li>
<li>4x 2TB HDD for the data</li>
</ul>

<p>The 160GB drives could be used as such:</p>

<ul>
<li>200MB RAID1 partition over the 2 drives for <code>/boot</code></li>
<li>2GB RAID1 partition over the 2 drives for swap</li>
<li>all remaining space as a RAID1 partition over the 2 drives for <code>/</code><br />
Note though that it is generally recommended to create additional partitions to further contain <code>/tmp</code> and <code>/var</code>.</li>
</ul>

<p>The 2TB drives could be used like this:</p>

<ul>
<li>all space as RAID6 over all drives (gives us 4TB of usable space) for <code>/data</code></li>
<li>alternatively, all space as RAID5 over all drives (gives us 6TB of usable space)
The point of using RAID6 is that it gives better redundancy than RAID5, so you can safely add more drives later without increasing the risk of failure of the whole array (which is not true of RAID5).</li>
</ul>

<h3>Moving to ext4</h3>

<p>If you are upgrading an existing system, backup first!</p>

<p>Let&#8217;s say that your <code>/data</code> partition is an LVM volume under <code>/dev/VolGroup01/LogVol00</code>.
First, make sure we have the ext4 tools installed on our machine, then unmount the partition to upgrade:</p>

<pre><code># yum -y install e4fsprogs
# umount /dev/VolGroup01/LogVol00
</code></pre>

<p>For a <strong>new system</strong>, <a href="http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html">create a large partition on the disk</a>, then format the volume (this will <strong>destroy all data</strong> on that volume!).</p>

<pre><code># mkfs -t ext4 -E stride=32 -m 0 -O extents,uninit_bg,dir_index,filetype,has_journal,sparse_super /dev/VolGroup01/LogVol00
# tune4fs -o journal_data_writeback /dev/VolGroup01/LogVol00
</code></pre>

<p><em>Note: on a RAID array, use the appropriate <code>-E stride,stripe-width</code> options, for instance, on a RAID5 array using 4 disks and 4k blocks, it could be: <code>-E stride=16,stripe-width=48</code></em></p>

<p>For an <strong>existing system</strong>, upgrading from ext3 to ext4 without damaging existing data is barely more complicated:</p>

<pre><code># fsck.ext3 -pf  /dev/VolGroup01/LogVol00
# tune2fs -O extents,uninit_bg,dir_index,filetype,has_journal,sparse_super /dev/VolGroup01/LogVol00
# fsck.ext4 -yfD /dev/VolGroup01/LogVol00
</code></pre>

<p>We can optionally give our volume a new label to easily reference it later:</p>

<pre><code># e4label /dev/VolGroup01/LogVol00 data
</code></pre>

<p>Then we need to persist the mount options in <code>/etc/fstab</code>:</p>

<pre><code>/dev/VolGroup01/LogVol00    /data    ext4    noatime,data=writeback,barrier=0,nobh,errors=remount-ro    0 0
</code></pre>

<p>And now we can remount our volume:</p>

<pre><code># mount /data
</code></pre>

<p>If you upgraded an existing filesystem from etx3, you may want to run the following to ensure the existing files are using <a href="http://en.wikipedia.org/wiki/Extent_%28file_systems%29">extents</a> for file attributes:</p>

<pre><code># find /data -xdev -type f -print0 | xargs -0 chattr +e
# find /data -xdev -type d -print0 | xargs -0 chattr +e
</code></pre>

<h3>Important notes</h3>

<p>The mounting options we use are somewhat a bit risky if your system is not adequately protected by a UPS.<br />
If your system crashes due to a power failure, you are more likely to lose data using these options than using the safer defaults.<br />
At any rate, you must have a proper backup strategy in place to safeguard data, regardless of what could damage them (hardware failure or user error).</p>

<ul>
<li>The <code>barrier=0</code> option disables <em>Write barriers</em> that enforce proper on-disk ordering of journal commits.</li>
<li>The <code>data=writeback</code> and <code>nobh</code> go hand in hand and allow the system to write data even after it has been committed to the journal.</li>
<li>The <code>noatime</code> ensures that the access time is not updated when we&#8217;re reading data as this is a big performance killer (this one is safe to use in any case).</li>
</ul>

<h3>References</h3>

<ul>
<li><a href="http://blog.smartlogicsolutions.com/2009/06/04/mount-options-to-improve-ext4-file-system-performance/">Mount options to improve ext4 file system performance</a></li>
<li><a href="https://ext4.wiki.kernel.org/index.php/Ext4_Howto">Ext4 Howto</a></li>
<li><a href="http://www.debian-administration.org/article/Migrating_a_live_system_from_ext3_to_ext4_filesystem">Migrating a live system from ext3 to ext4 filesystem</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2010/admin-linux-file-server-performance-boost-ext4-version/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Admin: Linux file server performance boost (ext3 version)</title>
		<link>http://blog.nkadesign.com/2010/admin-linux-file-server-performance-boost/</link>
		<comments>http://blog.nkadesign.com/2010/admin-linux-file-server-performance-boost/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 10:36:47 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=634</guid>
		<description><![CDATA[Using a Linux for an office file server is a no-brainer: it&#8217;s cheap, you don&#8217;t have to worry about unmanageable license costs and it just works. Default settings of most Linux distributions are however not optimal: they are meant to be as standard compliant and as general as possible so that everything works well enough [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/linux.png" alt="Linux" title="Linux" align="left" width="54" height="64" hspace="5" vspace="5" border="0" />
Using a Linux for an office file server is a no-brainer: it&#8217;s cheap, you don&#8217;t have to worry about unmanageable license costs and it just works.</p>

<p>Default settings of most Linux distributions are however not optimal: they are meant to be as standard compliant and as general as possible so that everything works well enough regardless of what you do.</p>

<p>For a file server hosting large numbers of files, these default settings can become a liability: everything slows down as the number of files creeps up and it makes your once-snappy fileserver as fas as a sleepy sloth.</p>

<p>There are a few things that we can do to ensure we get the most of our server.</p>

<h3>Checking our configuration</h3>

<p>First, a couple of commands that will help us investigate the current state of our configuration.</p>

<ul>
<li><p><code>df</code> will give us a quick overview of the filesystem:</p>

<pre><code># df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/md2      ext3    19840804   4616780  14199888  25% /
tmpfs        tmpfs      257580         0    257580   0% /dev/shm
/dev/md0      ext3      194366     17718    166613  10% /boot
/dev/md4      ext3     9920532   5409936   3998532  58% /var
/dev/md3      ext3      194366      7514    176817   5% /tmp
/dev/md5      ext3    46980272  31061676  13493592  70% /data
</code></pre></li>
<li><p><code>tune2fs</code> will help us configure the options for each ext3 partition.
If we want to check what is the current configuration of a given partition, says we want to know the current options for our <code>/data</code> mount:</p>

<pre><code># tune2fs -l /dev/md5
</code></pre>

<p>If I was using LVM as a Volume manager, I would type something like:</p>

<pre><code># tune2fs -l /dev/VolGroup00/LogVol02
</code></pre>

<p>This would give lots of information about the partition:</p>

<pre><code>tune2fs 1.40.2 (12-Jul-2007)
Filesystem volume name:   &lt;none&gt;
Last mounted on:          &lt;not available&gt;
Filesystem UUID:          d6850da8-af6f-4c76-98a5-caac2e10ba30
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype 
                          needs_recovery sparse_super large_file
Filesystem flags:         signed directory hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
....
</code></pre>

<p>The interesting options are listed under <code>Filesystem features</code> and <code>Default mount options</code>. For instance, here we know that the partition is using a journal and that it is using the <code>dir_index</code> capability, already a performance booster.</p></li>
<li><p><code>cat /proc/mounts</code> is useful to know the mounting options for our filesystem (just listed some interesting ones here):</p>

<pre><code>rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev/md0 /boot ext3 rw,data=ordered 0 0
/dev/md4 /var ext3 rw,data=ordered 0 0
/dev/md3 /tmp ext3 rw,data=ordered 0 0
/dev/md5 /data ext3 rw,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
/dev/md4 /var/named/chroot/var/run/dbus ext3 rw,data=ordered 0 0
</code></pre>

<p>The <code>data=ordered</code> mount parameter tells us of the journaling configuration for the partition.</p></li>
</ul>

<h3>Journaling</h3>

<p>So what is <a href="http://en.wikipedia.org/wiki/Journaling_file_system">journaling</a>?<br />
It&#8217;s one of the great improvements of ext3: a journal is a special log on the disk that keeps track of changes about to be made. It ensures that, in case of failure, the filesystem can quickly recover without loss of information.</p>

<p>There are 3 settings for the journalling feature:</p>

<ul>
<li><code>data=journal</code> the most secure but also slowest option since all data and metadata is written to disk: the whole operation needs to be completed before any other operation can be completed. It&#8217;s sort of going to the bank for a deposit, filling the paperwork and making sure the teller puts the money in the vault before you leave.</li>
<li><code>data=ordered</code> is usually the default compromise: you fill-in the paperwork and remind the teller to put the money in the vault asap.</li>
<li><code>data=writeback</code> is the fastest but you can&#8217;t be absolutely sure that things will be done in time to prevent any loss if a problem occurs soon after you&#8217;ve asked for the data to be written.</li>
</ul>

<p>In normal circumstances all 3 end-up the same way: data is eventually written to disk and everything is fine.<br />
Now if there is a crash just as the data was written only option <code>journal</code> would guarantee that everything is safe. Option <code>ordered</code> is fairly safe too because the money should be in the vault soon after you left; most systems use this option by default.</p>

<p>If you want to boost your performance and use <code>writeback</code> you should make sure that:</p>

<ul>
<li>you have a good power-supply backup to minimise the risk of power failure</li>
<li>you have a good data backup strategy</li>
<li>you&#8217;re ok with the risk of losing the data that was written right before the crash.</li>
</ul>

<p>To change the journaling option you simply use <code>tune2fs</code> with the appropriate option:</p>

<pre><code># tune2fs -o journal_data_writeback /dev/md5
</code></pre>

<h3>Mount options</h3>

<p>Now that we&#8217;ve changed the available options for our partition, we need to tell the system to use them.<br />
Edit <code>/etc/fstab</code> and add <code>data=writeback</code> to the option columns:</p>

<pre><code>/dev/md5     /data    ext3    defaults,data=writeback   1 2
</code></pre>

<p>Next time our partition is mounted, it will use the new option. For that we can either reboot or remount the partition:</p>

<pre><code># mount - o remount /data
</code></pre>

<h3>noatime option</h3>

<p>There is another option that can have a very dramatic effect on performance, probably even more than the journaling options above.</p>

<p>By default, whenever you read a file the kernel will update its last access time, meaning that we end up with a write operation for every read!<br />
Since this is required for POSIX compliance, almost all Linux distributions leave this setting alone by default.<br />
For a file server, this can have such drastic consequence on performance.</p>

<p>To disable this time-consuming and not useful feature (for a file server), simply add the <code>noatime</code> option to the <code>fstab</code> mount options:</p>

<pre><code>/dev/md5     /data    ext3    defaults,noatime,data=writeback   1 2
</code></pre>

<p>Note that updating access times is sometimes required by some software, such as mail software (such as mutt). If you properly keep your company data in a dedicated partition, you can enable the mount options only for that partition and keep other options for the root filesystem.</p>

<h3>dealing with errors in fstab</h3>

<p>After doing the above on one of the servers, I realized that I made a typo when editing <code>/etc/fstab</code>.<br />
This resulted in the root filesystem being mounted read-only, making fstab impossible to edit&#8230;</p>

<p>To make matters worse, this machine was a few thousand miles away and could not be accessed physically&#8230;.</p>

<p>Remounting the root filesystem resulted in errors:</p>

<pre><code># mount -o remount,rw /
mount: / not mounted already, or bad option
</code></pre>

<p>After much trial and rebooting, this worked (you need to specify all mounting options, to avoid the wrong defaults from being read from etc/mtab`):</p>

<pre><code># mount  -o rw,remount,defaults /dev/md2 /
</code></pre>

<p>After that, I could edit <code>/etc/fstab</code> and correct the typo&#8230;</p>

<h3>Conclusions</h3>

<p>How much these options will improve performance really depends on how your data is used: the improvements should be perceptible if your directories are filled with large amounts of small files.<br />
Deletion should also be faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2010/admin-linux-file-server-performance-boost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A story about exceptional service</title>
		<link>http://blog.nkadesign.com/2009/a-story-about-exceptional-service/</link>
		<comments>http://blog.nkadesign.com/2009/a-story-about-exceptional-service/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 02:54:42 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=613</guid>
		<description><![CDATA[Recently I found myself constrained by the puny 200GB of my Mac Book Pro and I bought a 500GB Seagate drive to replace it (a fast 7200 rpm one). The Macbook Pro has no easy access for the drive so you have to resort to dismantling the case to access it. This put me off [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/apple.png" alt="security01.png" title="security01.png" align="left" width="53" height="64" hspace="5" vspace="5" border="0" />Recently I found myself constrained by the puny 200GB of my Mac Book Pro and I bought a <a href="http://www.seagate.com/ww/v/index.jsp?vgnextoid=3a07bfafecadd110VgnVCM100000f5ee0a0aRCRD&amp;locale=en-US&amp;reqPage=Model&amp;modelReqTab=Features">500GB Seagate drive</a> to replace it (a fast 7200 rpm one).<br />
The Macbook Pro has no easy access for the drive so you have to resort to dismantling the case to access it.
This put me off replacing the drive because I would probably be voiding the warranty and was running the risk of damaging this expensive piece of equipment.</p>

<p>I&#8217;ve been filling the drive with pictures from my recent camera purchase and I couldn&#8217;t put it off any longer, so I bought the new drive and went online to find some good tutorial on how to crack open the Macbook Pro case.</p>

<p>After a few searches, I noticed that many people were referring to the <a href="http://www.ifixit.com/">iFixit.com</a> website. 
It was very easy to find the tutorial I was looking for, I didn&#8217;t have to register, and each step was made very clear and simple.<br />
It took no time to open the case and replace the drive.<br />
I was very happy with that find.</p>

<p>Now, that&#8217;s not the end of the story.</p>

<p><img title="Macbook Pro" src="/wp-content/uploads/2009/08/c2dopen2.jpg" width=276 Height=160 style="float:right;margin-left:10px;margin-bottom:5px;" />A couple of days before I replaced the drive the left fan of the laptop suddenly became noisy. This would happen a few times a day, at random, and would last 10-20 minutes.<br />
My only solution to get this repaired was to get to the local Apple service shop. Even though I knew exactly which part number was to be replaced, they still wanted me to:</p>

<ul>
<li>go across town to visit them so they could see for themselves what the problem was: annoying because the problem was intermittent so I may have to go for nothing.</li>
<li>wait for the part to arrive a few days later.</li>
<li>go back to leave the laptop</li>
<li>go again to collect the repaired laptop the next day or so.
So all in all: about 6h spend travelling back and forth + no laptop for a couple of day + <a href="http://www.pcpro.co.uk/news/262978/exposed-the-pc-repair-shops-that-rifle-through-your-photos-and-passwords">the risk that some indiscreet technician start looking through my personal stuff</a>.</li>
</ul>

<p>Instead, I went back to the  <a href="http://www.ifixit.com/">iFixit</a> website:</p>

<ul>
<li>identified my machine</li>
<li>found out the list of spare parts available from their store</li>
<li>added the fan to my cart</li>
<li>paid for it.</li>
<li>found a guide that showed how to replace the part.</li>
</ul>

<p>That took me all of 10 minutes; I placed my order on Thursday and the next Monday I received the part &#8230; halfway across the globe!</p>

<p>I also got a survey request from <a href="http://www.ifixit.com/">iFixit</a> and left some comments, from which I got back two nice detailed email follow-ups, one from the CEO saying they were implementing my remarks as part of their site improvement efforts.</p>

<p>Well, I thought I would share this story. It&#8217;s not that often that you get excited by an online vendor that not only does its job well but goes beyond expectations.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2009/a-story-about-exceptional-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sysadmin: SQL server performance madness</title>
		<link>http://blog.nkadesign.com/2009/sysadmin-sql-server-performance-madness/</link>
		<comments>http://blog.nkadesign.com/2009/sysadmin-sql-server-performance-madness/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 11:25:56 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=550</guid>
		<description><![CDATA[I&#8217;ve just lost 2 days going completely bananas over a performance issue that I could not explain. I&#8217;ve got this Dell R300 rack server that runs Windows Server 2008 that I dedicate to running IIS and SQL Server 2008, mostly for development purposes. In my previous blog entry, I was trying some benchmark to compare [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/windows.png" alt="Technology" title="Technology" align="left" width="64" height="60" hspace="5" vspace="5" border="0" />
I&#8217;ve just lost 2 days going completely bananas over a performance issue that I could not explain.</p>

<p>I&#8217;ve got this <a href="http://www.dell.com/content/products/productdetails.aspx/pedge_r300?c=us&amp;cs=555&amp;l=en&amp;s=biz">Dell R300</a> rack server that runs Windows Server 2008 that I dedicate to running IIS and SQL Server 2008, mostly for development purposes.</p>

<p><img src="/wp-content/uploads/2009/04/pedge_r300_overview1.jpg" alt="Dell PowerEdge R300 Rack servers" /></p>

<p>In my <a href="/2009/access-vs-sql-server-some-stats-part-1/">previous blog entry</a>, I was trying some benchmark to compare the performance of Access and SQL Server using INT and GUID and getting some strange results.
<!--
To get a more accurate baseline to explain the results I was getting from the server, I've tried this little snippet of SQL (the test database is simply a table with a IDENTIY column `ID`, and two text columns `SKU`, and `Description`).  
<textarea name="code" class="sql:nogutter" cols="60" rows="10">
DECLARE @tstart DATETIME2 = SYSDATETIME();
-- BEGIN TRAN
	DECLARE @a INT = 1;
	WHILE (@a <= 1000)
	BEGIN
		INSERT INTO Product (SKU,Description) 
		VALUES ('PROD' + CONVERT(CHAR,@a), 'Product number ' + CONVERT(CHAR,@a));
		SELECT @a = @a + 1;
	END;
-- COMMIT TRAN;
SELECT DATEDIFF(MILLISECOND, @tstart, SYSDATETIME()) AS timespan;
</textarea>

OK, so now for the really weird thing that was driving me crazy.

I have SQL Server 2008 Standard installed on 3 different machines: the server, my desktop and my Macbook Pro.
--></p>

<p>Here are the results I was getting from inserting large amounts of data in SQL Server:</p>

<table border=1>
<thead>
<tr>
  <th>Machine</th>
  <th>Operating System</th>
  <th align="center">Test without Transaction</th>
  <th align="center">Test with Transaction</th>
</tr>
</thead>
<tbody>
<tr>
  <td>MacbookPro</td>
  <td>Windows Server 2008 x64</td>
  <td align="center">324 ms</td>
  <td align="center">22 ms</td>
</tr>
<tr>
  <td>Desktop</td>
  <td>Windows XP</td>
  <td align="center">172 ms</td>
  <td align="center">47 ms</td>
</tr>
<tr>
<td>Server</td>
  <td>Windows Server 2008 x64</td>
  <td align="center"><font color="red">8635 ms!!</font></td>
  <td align="center">27 ms</td>
</tr>
</tbody>
</table>

<p>On the server, not using transactions makes the query run more than 8 seconds, <strong>at least an order of magnitude slower than it should!</strong></p>

<p>I initially thought there was something wrong with my server setup but since I couldn&#8217;t find anything, I just spend the day re-installing the OS and SQL server, applying all patches and updates so the server is basically brand new, nothing else on the box, no other services, basically all the power is left for SQL Server&#8230;</p>

<h3>Despair</h3>

<p>When I saw the results for the first time after spending my Easter Sunday rebuilding the machine I felt dread and despair.<br />
The gods were being unfair, it had to be a hardware issue and it had to be related to either memory or hard disk, although I couldn&#8217;t understand really why but these were the only things that I could see have such an impact on performance.</p>

<p>I started to look in the hardware settings:</p>

<p><img src="/wp-content/uploads/2009/04/screen1.png" alt="Device Manager" /></p>

<p>And then I noticed this in the Policies tab of the <em>Disk Device Properties</em> :</p>

<p><img src="/wp-content/uploads/2009/04/screen2.png" alt="DISK Device Properties" /></p>

<p>Just for the <a href="http://encyclopediadramatica.com/Lulz">lulz</a> of it, I ticked the box, close the properties</p>

<p><img src="/wp-content/uploads/2009/04/screen3.png" alt="Enable advanced performance" /></p>

<p>And then tried my query again:</p>

<table border=1>
<thead>
<tr>
  <th>Machine</th>
  <th>Operating System</th>
  <th align="center">Test without Transaction</th>
  <th align="center">Test with Transaction</th>
</tr>
</thead>
<tbody>
<td>Server</td>
  <td>Windows Server 2008 x64</td>
  <td align="center"><font color="red">254 ms!!</font></td>
  <td align="center">27 ms</td>
</tr>
</tbody>
</table>

<p>A <strong>nearly 35 fold increase in performance!</strong></p>

<h3>Moral of the story</h3>

<p>If you are getting strange and inconsistent performance results from SQL Server, make sure you check that <em>Enable advanced performance</em> option.<br />
Even if you&#8217;re not getting strange results, you may not be aware of the issue, only that some operations may be much slower than they should.</p>

<p>Before taking your machine apart and re-installing everything on it, check your hardware settings, there may be options made available by the manufacturer or the OS that you&#8217;re not aware of&#8230;</p>

<p>Lesson learnt.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2009/sysadmin-sql-server-performance-madness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sysadmin: Multiple ISP firewall &#8211; The setup</title>
		<link>http://blog.nkadesign.com/2009/sysadmin-multiple-isp-firewall-servers-and-redundancy/</link>
		<comments>http://blog.nkadesign.com/2009/sysadmin-multiple-isp-firewall-servers-and-redundancy/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 07:22:24 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=336</guid>
		<description><![CDATA[After suffering broadband trouble for the past 9 months, including interruptions that lasted a few days, I decided to get an additional line installed by a different ISP. I could have bought one of these multi-WAN devices but decided against it for a couple of reasons: I like a challenge and I wanted to achieve [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/linux.png" alt="Linux" title="Linux" align="left" width="54" height="64" hspace="5" vspace="5" border="0" />
After suffering broadband trouble for the past 9 months, including interruptions that lasted a few days, I decided to get an additional line installed by a different ISP.<br />
I could have bought one of these multi-WAN devices but decided against it for a couple of reasons: I like a challenge and I wanted to achieve a particular setup that I wasn&#8217;t sure could be answered by off-the-shelf products (for a reasonable price that is).</p>

<p>This long article is fairly detailed but if your setup is similar it should be enough to get you going quickly.</p>

<ul>
<li><a href="#basicsetup">The basic setup</a></li>
<li><a href="#objectives">Objectives</a></li>
<li><a href="#technologies">Technologies</a></li>
<li><a href="#thingstoknow">Things to know</a></li>
<li><a href="#thingstoread">Things to read</a></li>
<li><a href="#installingshorewall">Installing shorewall</a></li>
<li><a href="#preparingthesystem">Preparing the system</a></li>
<li><a href="#shorewallconfiguration">Shorewall configuration</a></li>
<li><a href="#installingourfirewallrules">Installing our firewall rules</a></li>
<li><a href="#dns">DNS</a></li>
<li><a href="#initialconclusions">Initial conclusions</a></li>
<li><a href="#references">References</a></li>
</ul>

<h3 id="basicsetup">The basic setup</h3>

<p>Without further ado, this is the network configuration:</p>

<p><img src="/wp-content/uploads/2009/02/20090203NetworkDiagram.png" alt="Network Diagram" /></p>

<h4>Notable things</h4>

<p>We have 2 broadband connections:</p>

<ul>
<li><strong>CYBR</strong>, a standard DSL line with a fixed IP <code>111.99.88.77</code> allocated through PPPoE.</li>
<li><strong>HKBN</strong>, a standard 100Mbps line with a fixed IP <code>30.40.50.62</code>.</li>
</ul>

<p>The network is split into different <em>zones</em>:</p>

<ul>
<li>the <strong>Internet zone</strong>, connected to our Firewall through interfaces <code>eth0</code> (<code>ppp0</code>) and <code>eth1</code>.</li>
<li>a <strong>Firewall zone</strong>, delimited by the firewall system itself</li>
<li>a <strong><a href="http://en.wikipedia.org/wiki/DMZ_(computing)">DMZ</a> zone</strong> connected through interface <code>eth2</code> for the servers we want to make visible from the Internet.<br />
The DMZ has its own private subnet delimited by <code>192.168.254.0/255.255.255.0</code>.</li>
<li>a <strong>LAN zone</strong> connected through interface <code>eth3</code> so local computers can access the Internet and be protected from it.<br />
The DMZ has its own private subnet delimited by <code>192.168.0.0/255.255.255.0</code>.  </li>
</ul>

<h3 id="objectives">Objectives</h3>

<p>What we want from our setup:</p>

<ol>
<li>our <em>firewall</em> protects our DMZ and LAN from unwanted access.</li>
<li>our <em>win</em> server can host websites or other services.</li>
<li>our <em>linux</em> server can handle receiving and sending email or other services.</li>
<li>our <em>firewall</em> can handle incoming traffic from either ISP.</li>
<li>our <em>firewall</em> can load-balance local outgoing traffic across both ISP.</li>
<li>If one line fails, <em>incoming</em> traffic switches to the other line.</li>
<li>If one line fails, <em>outgoing</em> traffic switches to the other line.</li>
<li>Eventually, we want both the <em>linux</em> and <em>win</em> servers to be able to host different websites and we want the firewall to send incoming requests to the right server.</li>
</ol>

<p>In this first article, I&#8217;ll present the setup for items 1-5.<br />
The remaining topics will be the subject of subsequent articles of their own.</p>

<h3 id="technologies">Technologies</h3>

<p>The firewall is our primary subject. What is being discussed here is pretty much distribution-independent and should work on all flavours of Linux.</p>

<h4>OS on the firewall system</h4>

<p>I chose <a href="http://www.centos.org/">CentOS</a> on the firewall.<br />
Being an almost byte-for-byte identical copy of <a href="http://www.redhat.com/rhel/">RedHat Enterprise Linux</a>, all configuration will be identical on RedHat and its derivatives such as Fedora.</p>

<h4>Firewall software, first try</h4>

<p>When my firewall needs are simpler, I use the <a href="http://tldp.org/HOWTO/IP-Masquerade-HOWTO/stronger-firewall-examples.html">Stronger IP Firewall Ruleset</a> from the <a href="http://tldp.org/HOWTO/IP-Masquerade-HOWTO/index.html">Linux IP Masquerade HOWTO</a>.<br />
I started to modify the script to adapt it to my new Multi-ISP setup but things got complicated once I needed to debug routing tables.<br />
I got it 80% of the way but tracing network connections and packet routing is complicated and time-consuming.<br />
After a couple of days of peering into log files and <a href="http://www.wireshark.org/">wireshark</a> capture screens, I gave up manual configuration and decided to go with something else.</p>

<h4>Firewall software, final</h4>

<p>The product I chose in the end is <a href="http://shorewall.net/">shorewall</a>: it&#8217;s a very flexible firewall system that create the necessary iptable rules and configure most of the routing needs to properly handle complex network setup.<br />
Shorewall is Open Source, very stable, has been out for a long time, is actively maintained and has lots of excellent documentation and examples.</p>

<h3 id="thingstoknow">Things to know</h3>

<p>Before we get into the meat of the article, you should brush up on the following topics:</p>

<ul>
<li>You have some knowledge of Linux system administration, know how to configure network connections, know how to enable/disable/stop/start  services, able to edit config files.</li>
<li>Networking: you should know what a netmask is, what a gateway is, what a subnet is and have a passing understanding of IP classes, IP notation, what ports are for, what&#8217;s the difference between the tcp, udp, icmp protocols, what Dynamic Port Forwarding (DNAT) is, what Network Address Translation (NAT) is, what <em>masquerading</em> means.</li>
<li>Some basic understanding of DNS and local host name resolving (using <code>host.conf</code> and <code>resolv.conf</code>)</li>
<li>Some basic knowledge of what <em>routing</em> is for and how it works.</li>
<li>Some knowledge of how the linux kernel handles network packets (NetFilter, basics of iptables).</li>
</ul>

<p>You don&#8217;t need to be a specialist in any of these areas but any knowledge helps.<br />
I&#8217;m far from being well versed into Netfilter and routing, it&#8217;s not often that I have to deal directly with these topics, but brushing up on these topics helped.</p>

<h4 id="thingstoread">Things to read</h4>

<p>Shorewall has very extensive documentation. So much so that it can be a bit daunting, not knowing where to start.<br />
I found the following documents helpful to get me started:</p>

<ul>
<li><a href="http://shorewall.net/shorewall_setup_guide.htm">Setup Guide for multiple interfaces</a>.</li>
<li><a href="http://shorewall.net/Shorewall_and_Routing.html">Routing article</a></li>
<li><a href="http://shorewall.net/MultiISP.html">Guide for handling Multi-ISP</a></li>
</ul>

<h3 id="installingshorewall">Installing shorewall</h3>

<p>Go to the download site list [http://shorewall.net/download.htm#Sites]  and download the most appropriate binary package for your distribution.</p>

<p>If you get RPMs for RedHat systems, you only need to install (<code>rpm -ivh</code>) the following packages:</p>

<pre><code>shorewall-4.X.X-X.noarch.rpm
shorewall-perl-4.X.X-X.noarch.rpm 
</code></pre>

<p>If you install from source, only download, compile and install the <em>common</em>, <em>doc</em> and <em>perl</em> packages.</p>

<h3 id="preparingthesystem">Preparing the system</h3>

<p>For shorewall to properly handle both our firewall and packet routing needs, we need to make sure that the other parts of the system are not interfering with it.</p>

<h4>Internet lines</h4>

<p>Make sure that your multiple internet lines are properly working on their own!</p>

<h4>Disable routing</h4>

<ul>
<li>Make sure that you don&#8217;t define a <code>GATEWAY</code> in the configuration of your network interfaces (in <code>/etc/sysconfig/network-scripts/ifcfg-XXX</code>) .</li>
<li>If you use an (A)DSL connection, also set <code>DEFROUTE=no</code> if its <code>ifcfg-XXX</code> file as well.</li>
<li>Remove the <code>GATEWAY</code> from the <code>/etc/sysconfig/network</code> file if there is one.</li>
<li>Edit your <code>/etc/sysctl.conf</code> file and set <code>net.ipv4.conf.default.rp_filter = 0</code>.</li>
</ul>

<h4>Disable firewall</h4>

<p>Disable the current firewall, for instance using the <code>system-config-securitylevel</code> helper tool.<br />
Be careful if you&#8217;re directly connected to the Internet, you will be left without protection!<br />
You can actually wait until shorewall is properly configured to disable the firewall.</p>

<h3 id="shorewallconfiguration">Shorewall configuration</h3>

<p>Shorewall uses a set of simple configuration files, all located under <code>/etc/shorewall/</code>.
For exact detail of each configuration files, have a look at the list of <a href="http://shorewall.net/Manpages.html">man pages</a>.</p>

<h4>Zones</h4>

<p><code>zones</code> are probably the simplest configuration file.<br />
Details in the <a href="http://shorewall.net/manpages/shorewall-zones.html">zones man page</a>.
Here we just name the various zones we want our firewall to handle:</p>

<pre><code>################################################################
#ZONE   TYPE          OPTIONS       IN                  OUT
#                                   OPTIONS             OPTIONS
fw      firewall
net     ipv4
loc     ipv4
dmz     ipv4
</code></pre>

<p>This just reflects our setup as highlighted in the diagram above.</p>

<p>Note that the <code>fw</code> zone is often referred to as the  <code>$FW</code> variable instead in various configuration files.</p>

<h4>Interfaces</h4>

<p>Here we list all the network interfaces connected to our firewall and for which zone they apply.<br />
Details in the <a href="http://shorewall.net/manpages/shorewall-interfaces.html">interfaces man page</a>.</p>

<pre><code>################################################################
#ZONE   INTERFACE       BROADCAST       OPTIONS
net     ppp0            detect
net     eth1            detect
dmz     eth2            detect
loc     eth3            detect
</code></pre>

<p>Note that for our <code>net</code> zone, we list the 2 interfaces connected to our ISPs.<br />
If you&#8217;re using PPPoE to connect, don;t use the interface name <code>eth0</code> but use <code>ppp0</code> instead.</p>

<h4>Policy</h4>

<p>The <code>policy</code> file tells shorewall which default actions should be taken when traffic is moving from one zone to another.<br />
These default actions are taken if no other special action was specified in other configuration files.<br />
View the <code>policy</code> file as a list of default actions for the firewall.<br />
Details about this configuration file as in its <a href="http://shorewall.net/manpages/shorewall-policy.html">man page</a>.</p>

<pre><code>################################################################
#SOURCE DEST    POLICY          LOG     LIMIT:      CONNLIMIT:
#                               LEVEL   BURST       MASK
net     net     DROP            info
loc     net     ACCEPT
dmz     net     ACCEPT
loc     dmz     ACCEPT
loc     $FW     ACCEPT
dmz     $FW     ACCEPT
$FW     net     ACCEPT
dmz     loc     DROP            info
net     all     DROP            info
all     all     DROP            info
</code></pre>

<p>Traffic from one zone to another needs to be explicitely <code>ACCEPTed</code>, <code>REJECTed</code> or <code>DROPped</code>.<br />
For instance, <code>loc net ACCEPT</code> means that we allow all traffic from our local LAN to the Internet, while <code>net all DROP</code> means we don&#8217;t allow incoming traffic from the internet to anyone (remember this is the default action, in most cases we will override this for specific types of traffic in the <code>rules</code> file).<br />
When we set the default action to <code>DROP</code>, we can tell shorewall to keep a trace of the details in the <code>/var/log/messages</code> log.</p>

<h4>Providers</h4>

<p>The providers file is generally only used in a multi-ISP environment.<br />
Here we define how we want to <em>mark</em> packets originating from one ISP with a unique ID so we can tell the kernel to route these packets to the right interface.<br />
Not doing this would get packets received from one interface to be routed to the default gateway instead.<br />
The details of this configuration file are explained in the <a href="http://shorewall.net/manpages/shorewall-providers.html">providers man page</a> for it.</p>

<pre><code>#############################################################################
#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY      OPTIONS          COPY
CYBR  1      0x1  main      ppp0      -            track,balance=1  eth2,eth3
HKBN  2      0x2  main      eth1      30.40.50.61  track,balance=5  eth2,eth3
</code></pre>

<p>Note that the <code>DUPLICATE</code> columns tells shorewall that it should make a copy of the main default routing table for this particular routing table (called <code>CYBR</code> or <code>HKBN</code> depending on which ISP we refer to).<br />
Packets are marked with number 0&#215;1 or 0&#215;2 so we can distinguish them during their travel through the system.<br />
For PPPoE connections, don&#8217;t specify a <code>GATEWAY</code> since it&#8217;s most likely that your ISP didn&#8217;t give you one.</p>

<p>The most interesting part of this file are the <code>OPTIONS</code>: <code>track</code> means that we want the packets to be tracked as they travel through the system; <code>balance</code> tells the kernel that we want traffic coming out to be spread over both interfaces.<br />
Additionally, we want HKBN to receive more or less 5 times more traffic than CYBR (note that this has no effect on reply packets).</p>

<p>The <code>COPY</code> columns will ensure that the routing tables created for CYBR and HKBN are copied for each internal interface, so our <code>eth2</code> and <code>eth3</code> interfaces know how to route packets to the right ISP.</p>

<h4>Route Rules</h4>

<p>For our purpsose, the <code>route_rules</code> file only describes how traffic should be routed through one or the other ISP we set up in <code>/etc/shorewall/providers</code>.<br />
Details are in the <a href="http://shorewall.net/manpages/shorewall-route_rules.html">route_rules file man page</a>.</p>

<pre><code>#####################################################################
#SOURCE             DEST               PROVIDER        PRIORITY
ppp0                -                  CYBR            1000
eth1                -                  HKBN            1000
</code></pre>

<p>Here we simply say that all traffic through the <code>CYBR</code> table should be sent to <code>ppp0</code>.<br />
The <code>PRIORITY</code> is an ordering number that tell shorewall to consider this routing rule before it marks the packets. Since we know the packets originated from <code>ppp0</code> or <code>eth1</code> we don&#8217;t really need to mark them.</p>

<h4>Masq</h4>

<p>The <code>masq</code> file will contain the masquerading rules for our private interfaces: in essence, we want traffic from the local LAN and DMZ to be hidden behind our limited number of external IPs.<br />
See the <a href="http://shorewall.net/manpages/shorewall-masq.html">masq manpage</a> for all the details.</p>

<pre><code>#####################################################################
#INTERFACE              SOURCE           ADDRESS                 
# Ensure that traffic originating on the firewall and redirected via 
# packet marks always has the source IP address corresponding to the 
# interface that it is routed out of.
# See http://shorewall.net/MultiISP.html#Example1
ppp0                    30.40.50.62      111.99.88.77
eth1                    111.99.88.77     30.40.50.62
ppp0                    eth2             111.99.88.77
eth1                    eth2             30.40.50.62
ppp0                    eth3             111.99.88.77
eth1                    eth3             30.40.50.62
</code></pre>

<p>The first part ensures that the traffic coming out of our public interfaces but originating from the other is actually rewritten as originating from the right IP for the interface.<br />
This ensures that packets leaving <code>eth1</code> for instance don&#8217;t come out with the wrong source address of the <em>other</em> interface.<br />
The second part of the ensures that packets from our LAN or DMZ leaving either public interfaces are doing so with the right IP address, so traffic from my desktop going through <code>ppp0</code> for instance, will have its source address as <code>100.90.80.70</code>.</p>

<h4>Rules</h4>

<p>This is the main file where we tell shorewall our basic configuration and how we want packets to be handled in the general case.<br />
The <code>/etc/shorewall/rules</code> file contains the specific instructions on where to direct traffic that will override the default actions defined in the <code>/etc/shorewall/policy</code> file.</p>

<pre><code>#####################################################################
#ACTION    SOURCE                DEST                   PROTO  
#                                                                     
SECTION NEW
# Drop and log packets that come from the outside but pretend 
# to have a local address
DROP:info  net:192.168.0.0/24    all
DROP:info  net:192.168.254.0/24  all

# Redirect incoming traffic to the correct server for WWW and email
DNAT       all                   dmz:192.168.254.20     tcp   www
DNAT       all                   dmz:192.168.254.10     tcp   110
DNAT       all                   dmz:192.168.254.10     tcp   143
DNAT       all                   dmz:192.168.254.10     tcp   25
</code></pre>

<p>In its most basic form, what we&#8217;ve just defined here is that we want all traffic from anywhere destined for port 80 (www) to be sent to our <em>win</em> server.<br />
All mail traffic, POP3 (port 110), IMAP (port 143) and SMTP (port 25) is to be redirected to our <em>linux</em> server in the DMZ.</p>

<p>There are a few more useful rules that we can include, for instance, I want to be able to access my servers  through either ISPs from home (IP <code>123.45.67.89</code>) and disallow everyone else from accessing it.</p>

<pre><code>#####################################################################
#ACTION    SOURCE                DEST                   PROTO  
#                                                                     
# Allow SSH to the firewall from the outside only from home

ACCEPT     net:123.45.67.89      $FW                    tcp   ssh
# Redirect input traffic to the correct server for RDP, VNC and SSH 
DNAT       net:123.45.67.89      dmz:192.168.254.10:22  tcp   2222
DNAT       net:123.45.67.89      dmz:192.168.254.10     tcp   5901
DNAT       net:123.45.67.89      dmz:192.168.254.20     tcp   3389
</code></pre>

<p>When I SSH to <code>30.40.50.62</code> or <code>100.90.80.70</code>, on the normal port 22, I will access the firewall.<br />
Now if I SSH to the non-standard port 2222, I will instead access the <em>linux</em> server.<br />
Ports 5901 are for remoting through VNC on the <em>linux</em> machine, and port 3389 will be used for Remote Desktop connections to the <em>win</em> server.</p>

<p>To make sure my machines are up and running, I like to be able to ping them:</p>

<pre><code>#####################################################################
#ACTION    SOURCE              DEST              PROTO  
#                                                                     
# Accept pings between zones
ACCEPT     dmz                 loc               icmp  echo-request
ACCEPT     loc                 dmz               icmp  echo-request
</code></pre>

<p>Note that ping will only work between the LAN and the DMZ and pinging my firewall from the Internet will result in the requests being silently dropped.<br />
I usually prefer that configuration as it makes discovering the servers by random bots slightly less likely.</p>

<p>There are lots of other cool things we can do with forwarding but that will do for now.</p>

<h4>shorewall.conf</h4>

<p>The last file we&#8217;re going to look at is the main configuration file for shorewall.<br />
See details about each option from the <a href="http://shorewall.net/manpages/shorewall.conf.html">man page for <code>shorewall.conf</code></a>.</p>

<p>Most options are OK by default. The only ones that I have had to change are:</p>

<pre><code>STARTUP_ENABLED=Yes
MARK_IN_FORWARD_CHAIN=Yes
FASTACCEPT=Yes
OPTIMIZE=1
</code></pre>

<p>The first option tells shorewall that we want it to start automatically when the system boots.<br />
That&#8217;s not enough though, so make sure that the service will be started:</p>

<pre><code># chkconfig shorewall --levels 235 on
</code></pre>

<h3 id="installingourfirewallrules">Installing our firewall rules</h3>

<p>Shorewall configuration files need to be compiled without error before the firewall is actually loaded by shorewall.<br />
The command:</p>

<pre><code># shorewall restart
</code></pre>

<p>will stop and recompile the current configuration.<br />
If there are any errors, the current firewall rules will be unchanged.<br />
There are lots of other commands that can be issued. Check the man page for a complete list.</p>

<p>If you use PPPoE, you will want the firewall to be restarted every time the line reconnects.<br />
The simplest way is to create a file <code>/etc/ppp/if-up.local</code> with only a single line:</p>

<pre><code>shorewall restart
</code></pre>

<h3 id="dns">DNS</h3>

<p>There is one remaining issue with our firewall: if a user on the LAN attempts to access the web server by its name the request will probably fail.<br />
Same for accessing our mail server: we can configure our desktop to connect to <code>192.168.254.10</code> to get and send emails, but on the laptop we would usually use something like <code>pop.acme.com</code> instead so we can read our emails from outside the office.</p>

<p>Similarly, trying to access <code>www.acme.com</code> hosted on the <em>win</em> server from the <em>linux</em> server will fail.</p>

<p>One solution is to route traffic through the firewall but that&#8217;s actually fairly complicated to setup properly.<br />
The shorewall FAQ 2 discourages this and instead recommends the use of <a href="http://en.wikipedia.org/wiki/Split-horizon_DNS">split-DNS</a>: it&#8217;s very easy to setup and it works like a charm.</p>

<h4>dnsmasq</h4>

<p>Just install  <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a> on the firewall. There are ready-made packages available for it and a simple <code>yum install dsnmasq</code> should suffice.</p>

<p>Dnsmasq provides a simple DNS forwarding and DHCP service. I had already configured <code>dhcpd</code> -which is already fairly simple to configure- on my firewall so I won&#8217;t need DHCP from dnsmasq but you can easily set it up if you want.</p>

<p>On the DNS side, dnsmasq can be told to first try to resolve hostnames by looking at the standard <code>/etc/hosts</code> file and then query the DNS servers defined in <code>/etc/resolv.conf</code> if necessary.</p>

<p>This simple trick means that we can:</p>

<ul>
<li>Keep our normal DNS service pointing to say <code>100.90.80.70</code> for <code>www.acme.com</code> so that people on the Internet will properly resolve their web requests to our <em>win</em> server.</li>
<li>Add an entry in the firewall&#8217;s <code>hosts</code> file to point local clients to <code>192.168.254.20</code> instead.</li>
</ul>

<p>To achieve this, simply edit  <code>/etc/hosts</code>and add entries matching all your services:</p>

<pre><code># Acme's services. 
# One line for each DNS entries accessible from the Internet
192.168.254.20        acme.com
192.168.254.20        www.acme.com
192.168.254.10        pop.acme.com
192.168.254.10        mail.acme.com
</code></pre>

<h4>dsnmasq configuration</h4>

<p>Edit the <code>/etc/dsnmasq.conf</code> and uncomment or add the following lines:</p>

<pre><code># Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv
# listen on DMZ and LAN interfaces
interface=eth2
interface=eth3
# don't want dnsmasq to provide dhcp
no-dhcp-interface=eth2
no-dhcp-interface=eth3
</code></pre>

<p>Then make sure that dsnmasq will start on boot:</p>

<pre><code># chkconfig dnsmasq --levels 235 on
# service dnsmasq restart
</code></pre>

<h4 id="dnsresolution">DNS resolution</h4>

<p>There may be one last issue with DNS: in your <code>/etc/resolv.conf</code> you will have listed the DNS servers of one or both of your ISPs.<br />
The problem is that some ISPs don&#8217;t allow access to their name servers from a network different than theirs.</p>

<p>The result is that each time any of the systems issues a DNS request it may fail and need to be sent to the next server instead, which may also fail and introduce delays in accessing named resources on the Internet.</p>

<p>One easy way out is to not use the ISPs DNS servers but instead only list the free <a href="http://opendns.org/">OpenDNS</a> name servers in your <code>resolv.conf</code>:</p>

<pre><code>search acme.com
nameserver 208.67.222.222
nameserver 208.67.220.220
</code></pre>

<p>Then make sure that you disable DNS in your <code>/etc/sysconfig/network-config/ifcfg-XXX</code> configuration file for your PPPoE connection:</p>

<pre><code>PEERDNS=no
</code></pre>

<p>Failure to do so will result in your <code>/etc/resolv.conf</code> file being rewritten with the DNS servers of one of your ISP every time you reconnect to them.</p>

<h4>DHCP configuration</h4>

<p>If you use <code>dhcpd</code> for local users, then you will need to make sure that its DNS server is set to the firewall&#8217;s:</p>

<pre><code># DHCP Server Configuration file.
ddns-update-style none;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {
    option routers                  192.168.0.1;
    option subnet-mask              255.255.255.0;
    option domain-name              "acme.com";
    option domain-name-servers      192.168.0.1;
    range 192.168.0.200 192.168.0.250;
    default-lease-time 86400;
    max-lease-time 132000;
}
</code></pre>

<p>On your local machines that use DHCP, make sure to renew your IP.<br />
All other machines should be configured to use <code>192.168.0.1</code> as their unique DNS server and the machines in the DMZ should have their DNS set to <code>192.168.254.1</code>.</p>

<p>Unless you reboot, don&#8217;t forget and flush the local DNS cache of each machine:<br />
On Windows, from the command line:</p>

<pre><code>C:\&gt; ipconfig /flushdns
</code></pre>

<p>On Mac, from the terminal:</p>

<pre><code>bash-x.xxx$ dnscacheutil -flushcache
</code></pre>

<h3 id="initialconclusions">Initial conclusions</h3>

<p>I believe this type of firewall setup is fairly common and I hope that the -rather long- article helped you get your own setup in place.<br />
In the -much shorter- follow-up articles, we&#8217;ll make our system as redundant as possible so our web and email services stay online even when one of the broadband connections fails.</p>

<p>In the meantime, don&#8217;t hesitate to leave your comments and corrections below.</p>

<h3 id="history">History</h3>

<ul>
<li>06FEB2009: added info about restarting the firewall on <a href="#installingourfirewallrules">PPPoE reconnection</a> and disabling <a href="#dnsresolution">ISP&#8217;s DNS resolution</a>.</li>
<li>04FEB2009: initial release.</li>
</ul>

<h3 id="references">References</h3>

<ul>
<li><a href="http://shorewall.net/">Shorewall</a>&#8216;s main site.</li>
<li>Shorewall&#8217;s [man page][manpage] list for all configuration files.</li>
<li><a href="http://opendns.org/">OpenDNS</a> free worldwide DNS service (and more).</li>
<li><a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a> DNS forwarder (for easily setting up <a href="http://en.wikipedia.org/wiki/Split-horizon_DNS">split-horizon-DNS</a>).</li>
<li><a href="http://www.centos.org/">CentOS</a> linux distribution, based on <a href="http://www.redhat.com/rhel/">RedHat Enterprise Linux</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2009/sysadmin-multiple-isp-firewall-servers-and-redundancy/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Sysadmin: file and folder synchronisation</title>
		<link>http://blog.nkadesign.com/2009/sysadmin-data-folder-synchronisation/</link>
		<comments>http://blog.nkadesign.com/2009/sysadmin-data-folder-synchronisation/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 14:54:09 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=311</guid>
		<description><![CDATA[Over the years I&#8217;ve struggled to keep my folder data synchronised between my various desktop and laptops. Here I present the tools I&#8217;ve tried and what I&#8217;ve finally settled on as possibly the ultimate answer to the problem of synchronising files and folders across multiple computers: rsync unison WinSCP General Backup tools Revision Control Systems [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/technology01.png" alt="Technology" title="Technology" align="left" width="64" height="64" hspace="5" vspace="5" border="0" />
Over the years I&#8217;ve struggled to keep my folder data synchronised between my various desktop and laptops.</p>

<p>Here I present the tools I&#8217;ve tried and what I&#8217;ve finally settled on as possibly the ultimate answer to the problem of synchronising files and folders across multiple computers:</p>

<ul>
<li><a href="#rsync">rsync</a></li>
<li><a href="#unison">unison</a></li>
<li><a href="#winscp">WinSCP</a></li>
<li><a href="#backup">General Backup tools</a></li>
<li><a href="#rcs">Revision Control Systems</a></li>
<li><a href="#compexsetup">Complex setup</a></li>
<li><a href="#whatwewant">What we want from data synchronisation</a></li>
<li><a href="#livemesh">Live Mesh folders</a></li>
<li><a href="#conclusion">Conclusion</a></li>
<li><a href="#references">References</a></li>
</ul>

<p><center><img src="http://blog.nkadesign.com/wp-content/uploads/2009/01/mesh.png" alt="Sync Files" title="Sync" width="416" height="232" class="size-full wp-image-323" /></center></p>

<h3 id="rsync">rsync</h3>

<p>I&#8217;ve tried <a href="http://samba.anu.edu.au/rsync/">rsync</a>, which is a great Open Source tool to securely synchronise data either one-way or both-ways.<br />
It&#8217;s very efficient with bandwidth as it only transfer blocks of data that have actually changed in a file instead of the whole file. It can tunnel traffic across SSH and I&#8217;ve got a few <a href="http://en.wikipedia.org/wiki/Cronjob">cronjobs</a> set up between various servers to back-up files daily.</p>

<p>It&#8217;s only weaknesses are that:</p>

<ul>
<li>Every time it runs, it needs to inspect all files on both sides to determine the
 changes, which is quite an expensive operation.   </li>
<li>Setting up synchronisation between multiple copies of the data can be tricky: 
 you need to sync your computers in pairs multiple times, which quickly becomes 
 expensive and risky if you have the same copy across multiple computers.</li>
<li>It doesn&#8217;t necessarily detect that files are in use at the time of the sync, which 
could corrupt them.</li>
</ul>

<h3 id="unison">unison</h3>

<p>It a folder synchronisation tool whose specific purpose is to address some of the shortcomings of <code>rsync</code> when synchronising folders between computers.
It&#8217;s also a cross-platform Open Source tool that works on Linux, OS/X, Windows, etc.</p>

<p><a href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a> uses the efficient file transfer capabilities of <code>rsync</code> but it is better at detecting conflicts and it will give you a chance to decide which copy you want when a conflict is detected.</p>

<p>The issue though is that, like <code>rsync</code>, it needs to inspect all files to detect changes which prevents it from detecting and propagating updates as they happen.</p>

<p>The biggest issue with these synchronisation tools is that they tend to increase the risk of conflict because changes are only detected infrequently.</p>

<h3 id="winscp">WinSCP</h3>

<p><a href="http://winscp.net/eng/">WinSCP</a> Is an Open Source Windows GUI FTP utility that also allows you to synchonise folders between a local copy and a remote one on the FTP server.</p>

<p>It has conflict resolution and allows you to decide which copy to keep.</p>

<p>It&#8217;s great for what it does and allows you to keep a repository of your data in sync with your local copies but here again, WinSCP needs to go through each file to detect the differences and you need to sync manually each computer against the server, which is cumbersome and time consuming.</p>

<h3 id="backup">General Backup tools</h3>

<p>There are lot more tools that fall into that category of backup utilities: they all keep a copy of your current data in an archive, on a separate disk or online.
Some are great in that they allow you to access that data on the web (I use the excellent <a href="http://www.jungledisk.com/">JungleDisk</a> myself) but file synchronisation is not their purpose.</p>

<p>Now for some <a href="http://uncyclopedia.wikia.com/wiki/Captain_Obvious">Captain Obvious</a> recommendation: remember that file synchronisation is <em>not a backup plan</em>: you must have a separate process to keep read-only copies of your important data.<br />
File synchronisation will update and delete files you modify across all your machines, clearly not what you want if you need to be able to recover them!</p>

<h3 id="rcs">Revision Control Systems</h3>

<p><a href="http://en.wikipedia.org/wiki/Revision_control">Revision control software</a> like <a href="http://savannah.nongnu.org/project/memberlist.php?detailed=1&amp;group=cvs">cvs</a>, <a href="http://subversion.tigris.org/">subversion</a>, <a href="http://en.wikipedia.org/wiki/Git_(software)">git</a>, <a href="http://en.wikipedia.org/wiki/Comparison_of_revision_control_software">etc</a> are generally used to keep track of changes of source code files; however, they have also been used successfully to keep multiple copies of the same data in sync.<br />
It&#8217;s actually exactly <a href="http://tortoisesvn.tigris.org/">what I use</a> for all my source code and associated files: I have a subversion server and I check-out copies of my software project folders on various computers.</p>

<p>After making changes on one computer, I <em>commit</em> the changes back to the server and <em>update</em> these changes on all other computers manually.</p>

<p>While great at keeping track of each version of your files and ideally suited to pure text documents like source code, using revision control systems have drawbacks that make them cumbersome for general data synchronisation:</p>

<ul>
<li>you need to manually commit and update your local copies against the server.</li>
<li>not all of them are well suited to deal with binary files</li>
<li>when they work with binary files, they just copy the whole file when it changed, which is wasteful and inefficient.</li>
</ul>

<p>Revision Control System are great for synchronising source code and configuration files but using them beyond that is rather cumbersome.</p>

<h3 id="compexsetup">Complex setup</h3>

<p>All of the above solutions also have a major drawback: getting them to work across the Internet requires complex setup involving firewall configurations, security logins, exchange of public encryption keys in some cases, etc.</p>

<p>All these are workable but don&#8217;t make for friendly and piece-of-mind setup.</p>

<h3 id="whatwewant">What we want from data synchronisation</h3>

<p>I don&#8217;t know about you but what I&#8217;m looking for in a synchronisation tool is pretty straightforward:</p>

<ul>
<li>Being able to point to a folder on one computer and make it synchronise across one or multiple computers.</li>
<li>Detect and update the changed files transparently in the background without my intervention, as the changes happen.</li>
<li>Be smart about conflict detection and only ask me to make a decision if the case isn&#8217;t obvious to resolve.</li>
</ul>

<h3 id="livemesh">Live Mesh folders</h3>

<p>Enters <a href="http://en.wikipedia.org/wiki/Windows_Live_Core">Microsoft Live Mesh Folders</a>, now in beta and available to the public.
Live Mesh is meant to be Microsoft answer&#8217;s to synchronising <em>information</em> (note, I&#8217;m not saying <em>data</em> here) across computers, devices and the Internet.<br />
While Live Mesh wants to be something a lot bigger than just synchronising folders, let&#8217;s just concentrate on that aspect of it.</p>

<p>Installing Live Mesh is pretty easy: you will need a Windows Live account to log-in but once this is done, it&#8217;s a small download and a short installation.</p>

<p>Once you&#8217;ve added your computer to your &#8220;Mesh&#8221; and are logged in you are ready to use Live Mesh:</p>

<ul>
<li>You decide how the data is synchronised for each computer participating in your Mesh:<br />
you&#8217;re in charge of what gets copied where, so it&#8217;s easy to make large folders pair between say your laptop and work desktop and not your online Live Desktop (which has a 5GB limit) or your computer at home. You&#8217;re in control.</li>
<li>Files are automatically synchronised as they change across all computers that share the particular folder you&#8217;re working in.<br />
If the file is currently used, it won&#8217;t be synced before it is closed.</li>
<li>If the other computers are not available, the sync will automatically happen as they are up again.</li>
<li>There is no firewall setup: each computer knows how to contact the others and automatically -and uses- the appropriate network: transfers are local if the computers are on the same LAN or done across the Internet otherwise.<br />
All that without user intervention at all.</li>
<li>Whenever possible, data is exchanged in a P2P fashion where each device gets data from all the other devices it can see, making transfers quite efficient.</li>
<li>File transfers are encrypted so they should be pretty safe even when using unsafe public connections.</li>
<li>If you don&#8217;t want to allow sync, say you&#8217;re on a low-bandwidth dialup, you can work offline.</li>
<li>The Mesh Operating Environment (MOE) is pretty efficient at detecting changes to files. Unlike other systems, in most cases it doesn&#8217;t need to scan all files to find out which ones have been updated or deleted.</li>
</ul>

<p><strong>Some drawbacks</strong></p>

<ul>
<li>It&#8217;s not a final product, so there are some quirks and not all expected functionalities are there yet.</li>
<li>The Mesh Operating Environment (MOE) services can be pretty resource hungry, although, in fairness, it&#8217;s not too bad except that it slows down your computer&#8217;s responsiveness while it loads at boot time.</li>
<li>You can&#8217;t define patterns of files to exclude in your folder hierarchy.<br />
That can be a bit annoying if the software you use is often creating large backup files automatically (like CorelDraw does) or if there are sub folders you don&#8217;t need to take everywhere.</li>
<li>The initial sync process can take a long time if you have lots of files.<br />
A solution if you have large folders to sync is to copy them first manually on each computer and then force Live Mesh to use these specific folders: the folders will be merged together and the initial sync process will be a lot faster as very little data needs to be exchanged between computers.</li>
</ul>

<p>Bear in mind that Live Mesh is currently early beta and that most of these drawback will surely be addressed in the next months.</p>

<h3 id="conclusion">Conclusion</h3>

<p>I currently have more than 18GB representing about 20,000 files synchronised between 3 computers (work desktop, laptop and home desktop) using Live Mesh.</p>

<p>While not 100% there, Live Mesh Folder synchronisation is really close to the real thing: it&#8217;s transparent, efficient, easy to use and it just works as you would 
expect.</p>

<p>Now that Microsoft has released the <a href="http://msdn.microsoft.com/en-us/sync/default.aspx">Sync Framework</a> to developers, I&#8217;m sure that other products will come on the market to further enhance data synchronisation in a more capable way.<br />
In the meantime, Live Mesh has answered my needs so far.</p>

<h3 id="references">References</h3>

<ul>
<li><a href="http://en.wikipedia.org/wiki/File_synchronization">Wikipedia reference on file synchronisation</a>.</li>
<li><a href="http://samba.anu.edu.au/rsync/">rsync</a> home page and <a href="http://en.wikipedia.org/wiki/Rsync">Wikipedia entry</a></li>
<li><a href="http://www.cis.upenn.edu/~bcpierce/unison/">unison</a> home page and <a href="http://en.wikipedia.org/wiki/Unison_(file_synchronizer)">Wikipedia entry</a></li>
<li><a href="http://www.jungledisk.com/">JungleDisk</a> online backup (cheap and very configurable, uses <a href="http://aws.amazon.com/s3/">Amazon S3</a> for storage)</li>
<li>Microsoft <a href="http://mesh.com">Live Mesh</a> web site and <a href="http://en.wikipedia.org/wiki/Windows_Live_Core">Live Mesh Wikipedia entry</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2009/sysadmin-data-folder-synchronisation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sysadmin: Recovering deleted Windows partitions</title>
		<link>http://blog.nkadesign.com/2009/sysadmin-recovering-deleted-partitions/</link>
		<comments>http://blog.nkadesign.com/2009/sysadmin-recovering-deleted-partitions/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 02:57:08 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=306</guid>
		<description><![CDATA[I made a mistake the other day: I wanted to delete the partition on an external drive and in my haste ended up deleting the partition of a local hard drive instead&#8230; The good thing is when you delete a partition using the Windows Disk Management console it doesn&#8217;t actually delete your files, only the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/windows.png" alt="Technology" title="Technology" align="left" width="64" height="60" hspace="5" vspace="5" border="0" />I made a mistake the other day: I wanted to delete the partition on an external drive and in my haste ended up deleting the partition of a local hard drive instead&#8230;</p>

<p>The good thing is when you delete a partition using the Windows Disk Management console it doesn&#8217;t actually delete your files, only the partition header.</p>

<p><img src="/wp-content/uploads/2009/01/Recover1.png" alt="Windows Disk Management Console" /></p>

<p>With NTFS files systems, there is a backup at the end of the partition. The problem is how do you recover it?</p>

<p>I first looked at the instructions from Microsoft knowledge base article <a href="http://support.microsoft.com/kb/245725">kb245725</a>, downloaded the low-level sector editor <code>Dskprobe</code> but was getting no-where with it.</p>

<p>Searching google brings you to the usual list of recovery software that you can&#8217;t be sure will actually do the job until you fork $$ for them.<br />
I&#8217;ve got nothing against paying for software but I&#8217;ve been bitten by false promises before.</p>

<p>My search ended up with <a href="http://www.cgsecurity.org/wiki/TestDisk"><code>TestDisk</code></a> an OpenSource utility to manipulate and recover partitions that works on almost all platforms.<br />
The user interface is DOS only, so it&#8217;s not pretty, not point-and-click user friendly but it has a fair amount of options and after fiddling around with it for 10 minutes, I was able to simply recover the backup boot sector and tada! all my files were back!</p>

<p><img src="/wp-content/uploads/2009/01/Recover2.png" alt="TestDisk in action" /></p>

<p>So, some recommendations when recovering lost partitions:</p>

<ul>
<li>Don&#8217;t panic! If you only deleted the partition (whichever type), chances are you&#8217;re likely to recover it or at least salvage the files.</li>
<li>Obviously, be careful not to write anything over them, like recreating partitions and a file system.</li>
<li>If you use a utility like <code>TestDisk</code>, don&#8217;t blindly follow the on-screen instructions. At first, it was telling me that I had 2 Linux partitions on the device (which used to be true) but it did not see the NTFS one. Then it thought I had a FAT partition only until I switched to the advanced options and inspected the boot partition.<br />
Just know enough about file systems to know what you&#8217;re looking for.</li>
<li>Low-level tools are not for everyone, so if you&#8217;re not comfortable using them, don&#8217;t tempt your luck and try a paid-for recovery tool with an easier interface.</li>
</ul>

<p>If you use <code>TestDisk</code> and you manage to recover your files, don&#8217;t forget to <a href="http://www.cgsecurity.org/wiki/Donation">donate</a> to encourage Christophe GRENIER, the author.</p>

<h3>References</h3>

<ul>
<li><a href="http://support.microsoft.com/kb/245725">KB245725: How To Recover an Accidentally Deleted NTFS or FAT32 Dynamic Volume.</a></li>
<li><a href="http://www.cgsecurity.org/wiki/TestDisk">TestDisk</a> data recovery utility for Windows, Linux, OS/X, etc</li>
<li><a href="http://www.cgsecurity.org/wiki/PhotoRec">PhotoRec Digital Picture and File Recovery</a> Open Source utility from the same author.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2009/sysadmin-recovering-deleted-partitions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows 2008 / Windows 7 x64: The &#8216;Microsoft.Jet.OLEDB.4.0&#8242; provider is not registered on the local machine.</title>
		<link>http://blog.nkadesign.com/2008/windows-2008-the-microsoftjetoledb40-provider-is-not-registered-on-the-local-machine/</link>
		<comments>http://blog.nkadesign.com/2008/windows-2008-the-microsoftjetoledb40-provider-is-not-registered-on-the-local-machine/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 13:31:53 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=236</guid>
		<description><![CDATA[There are times when the coexistence of 64 and 32 bit code on the same machine can cause all sorts of seemingly strange issues. One of them just occurred to me while trying to run the ASPx demos from Developer Express, my main provider of .Net components (the best supplier I&#8217;ve ever been able to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/technology01.png" alt="Technology" title="Technology" align="left" width="64" height="64" hspace="5" vspace="5" border="0" />There are times when the coexistence of 64 and 32 bit code on the same machine can cause all sorts of seemingly strange issues.<br />
One of them just occurred to me while trying to run the <a href="http://www.devexpress.com/Downloads/NET/OnlineDemos.xml">ASPx demos</a> from <a href="http://www.devexpress.com/">Developer Express</a>, my main provider of .Net components (the best supplier I&#8217;ve ever been able to find).<br />
I was getting the following error:</p>

<p><em>The &#8216;Microsoft.Jet.OLEDB.4.0&#8242; provider is not registered on the local machine:</em> 
<center><img src="/wp-content/uploads/2008/10/sshot-2.png" alt="Server Error" /></center></p>

<p>It may look otherwise, but this error is generally due to either of two thing:</p>

<ul>
<li>you don&#8217;t have Office 2007/2010 Jet drivers installed</li>
<li>or you are running a 32 bit application in a default x64 environment.</li>
</ul>

<p>The first issue is easy to solve, just download the <a href="http://www.microsoft.com/download/en/details.aspx?id=13255">Access 2010 Database Engine</a> from Microsoft (works with Access 2007 databases as well).</p>

<p>For the second one, the fix is also easy enough:</p>

<ul>
<li><em>For Windows 2008</em>: Navigate to  Server Manager > Roles > Web Server (IIS)  > Internet Information Services (IIS) Manager,  then look under your machine name > Application Pool.</li>
<li><em>For Windows 7</em>: Navigate to  Programs > Administrative Tools > Internet Information Services (IIS) Manager,  then look under your machine name > Application Pool.</li>
</ul>

<p><center><a title="Server Manager" style="border:0;" href="/wp-content/uploads/2008/10/sshot-6.png" rel="lightbox"><img title="Server Manager" src="/wp-content/uploads/2008/10/sshot-6sm.png" width=560 Height=410 /></a></center></p>

<p>Under there you can call the DefaultAppPool&#8217;s advanced settings to change <code>Enable 32-Bits Applications</code> to <code>True</code>:<br />
<center><img src="/wp-content/uploads/2008/10/sshot-3.png" alt="Advanced Settings" /></center></p>

<p>You may have to restart the service for it to take effect but it should work.</p>

<h3>References</h3>

<ul>
<li><a href="http://www.hanselman.com/blog/BackToBasics32bitAnd64bitConfusionAroundX86AndX64AndTheNETFrameworkAndCLR.aspx">Scott Hanselman&#8217;s blog entry</a> about undestanding 64 vs. 32 bitness in .Net.</li>
<li><a href="http://www.microsoft.com/download/en/details.aspx?id=13255">Access 2010 Database Engine driver</a></li>
</ul>

<h3>Updates</h3>

<ul>
<li>10DEC2011: Updated driver link to use the Access 2010 engine.</li>
<li>03APR2010: Added instructions for Windows 7</li>
<li>12FEB2009: Added reference to Scott&#8217;s article.</li>
<li>28OCT2008: Original version</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2008/windows-2008-the-microsoftjetoledb40-provider-is-not-registered-on-the-local-machine/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
		<item>
		<title>Sysadmin: Macbook Pro, after the honeymoon</title>
		<link>http://blog.nkadesign.com/2008/sysadmin-macbook-pro-after-the-honeymoon/</link>
		<comments>http://blog.nkadesign.com/2008/sysadmin-macbook-pro-after-the-honeymoon/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 19:00:29 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=207</guid>
		<description><![CDATA[I&#8217;ve been using the MacBook Pro I introduced in my previous blog entry for a few weeks now. Between love and frustration I hang&#8230; Here is a review of our relationship so far. The Great Hardware delight Whether running OS/X or Windows 2008 I&#8217;ve got no major complaint about the performance of the machine. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/apple.png" alt="security01.png" title="security01.png" align="left" width="53" height="64" hspace="5" vspace="5" border="0" />I&#8217;ve been using the MacBook Pro I introduced in my <a href="/2008/mac-installing-windows-server-2008-x64-on-a-macbook-pro/">previous blog entry</a> for a few weeks now.<br />
Between love and frustration I hang&#8230;<br />
Here is a review of our relationship so far.</p>

<h2>The Great</h2>

<h3>Hardware delight</h3>

<p>Whether running OS/X or Windows 2008 I&#8217;ve got no major complaint about the performance of the machine.
It&#8217;s fast, stable (except sometimes it&#8217;s not waking up from sleep or it does but the screen remains black). The screen is nice and vibrant, I just love the magnetic power connector and the small size of the power adapter.
I have a few complaints though, see below.</p>

<h3>OSX battery Power usage</h3>

<p>For such a large and powerful laptop I&#8217;m pleasantly surprised with the duration of the battery under OSX: I&#8217;ve been able to watch videos for 3h, full screen, without trouble and overheating (although I would lower the screen brightness to reduce consumption).<br />
I haven&#8217;t had such luck under Windows 2008 where I&#8217;ve been struggling to find the right power settings balance, but remember that&#8217;s a server OS and it&#8217;s not really meant to be run on a laptop.</p>

<p><center><img title="mac vs vista" src="/wp-content/uploads/2008/08/GetAMacAd.jpg" width=420 Height=319 style="margin-left:10px;margin-bottom:5px;" /></center></p>

<h2>The Ugly</h2>

<h3>The mouse</h3>

<p>You wonder why Apple, in all its hardware expertise could design the mighty-mouse with a single big button that can still do right-clicking but can&#8217;t give us the same thing with the enormous single-button of the trackpad.<br />
Now the new models -just released this week- have done away with the button entirely, which may be just as well although I&#8217;m curious about how well the drivers will work under Windows.</p>

<p>Mouse acceleration in OSX is pretty frustrating to me.
When you&#8217;ve got a large screen, you&#8217;re endlessly shuffling the mouse to get that pointer in the right place. It feels slow, inaccurate and is extremely irritating after a while.
The problem is even worse when you&#8217;re working in OSX under VMware Fusion: while it might still be usable under OSX, the difference is really severe and unnatural in Windows.<br />
This does not happen under bootcamp though where mouse acceleration behaves as you would expect (for windows).<br />
I&#8217;ve tried a number of utilities (<a href="http://lavacat.com/iMouseFix/index.html">iMouse</a> , <a href="http://plentycom.jp/en/steermouse/">SteerMouse</a> and others) but none gave me what I needed.</p>

<h3>The keyboard</h3>

<p>The keyboard feels great to type on, with a nice spring and softness.
There are a few issues though:<br />
Why is the Return key so small compared to the right Shift?<br />
The rule is that the more a key is used, the bigger it is, yet the Enter is rather small, it&#8217;s the same size as the caps lock which serves almost no useful purpose in comparison.<br />
The arrow keys are also minuscule, another probable example of Apple choosing form over function.
The lack of delete key forces you to type both the <code>fn</code> + <code>backspace</code> keys instead, which is an unnecessary pain, it&#8217;s not like understanding the difference between <code>delete</code> and <code>backspace</code> is <em>that</em> confusing to people using a complex machine like a computer.</p>

<h3>The lid</h3>

<p>I love the way the hooks for the lid come out just when you close it. It makes for a neat screen without protruding bits of metal or plastic.<br />
My main issue with the lid is with its limited opening angle: if you&#8217;re just a little tall and you place your laptop on your lap then there is no way to open the screen enough to have it properly face you.<br />
This is also an issue if you place your Macbook Pro on a cooling pad or a riser that&#8217;ll put the laptop too vertical (for instance to free some space around it when using an external keyboard): you just can&#8217;t use these devices.</p>

<h3>The sound</h3>

<p>That one really makes me mad: the MacBook Pro has audio issues that you won&#8217;t even find in a US$15 MP3 player and it&#8217;s totally unacceptable.<br />
When idle, I can hear hissing sounds that vary in power and frequency if I slide the volume control; when playing music, there is a lot of noise and &#8220;cutting&#8221; sounds between songs.<br />
These are not noticeable when using the integrated speakers but,they become really annoying once you use earphones.<br />
I am sorely disappointed with sound quality to say the least.</p>

<h3>Electronic noises</h3>

<p>On top of the annoying sounds from the sound chipset, the LCD inverter also makes a hissing sound that increases in volume when I lower the LCD brightness&#8230;<br />
Coupled with that, the processor also makes a hissing noise when it gets into its C4 power saving state&#8230;<br />
The noise is probably not high enough to get the laptop fixed but it might be great as a mosquito repellent.</p>

<h3>Boot &#8216;song&#8217;</h3>

<p>Apple knows best and they know that your only aim in life is to become a poster boy for the brand.<br />
When booting/rebooting your mac, it likes to play its welcome song that says &#8220;hey, over here, I&#8217;m a mac and I&#8217;m telling the world I&#8217;m booting up. Everyone listen how awesome I am!&#8221;.<br />
The perverse thing is that even if you have earphones plugged in (as in: you don&#8217;t want to disturb people around you) the boot song will be played on the speakers&#8230;<br />
Of course, there is no option anywhere to disable it.<br />
Apple knows best.<br />
After much trials, I found that booting under OSX, lowering the volume to zero, then rebooting under windows and changing the volume there would be OK: no more booting song -at least for now- and I can still change the volume in OSX and Windows.</p>

<h2>Conclusion</h2>

<p>Would I buy a Mac again knowing what I know now?<br />
Mmmm, probably <em>not</em>.<br />
I find the annoyances a bit too much relative to my expectations and my usage scenario.
To be fair, it&#8217;s not all bad and most of the time I&#8217;m happy with my mac but I find myself trying to avoid the things that infuriate me and it&#8217;s not really what I want from a laptop; it&#8217;s supposed to liberate me and give me the freedom I need to get things done, not get in the way.<br />
Re-adapting to a strangely layout keyboard, having to deal with Apple&#8217;s brand awareness arrogance, battling with stuff that you just normally take for granted, all this is a bit too much of a price to pay for what is essentially for me a Windows development machine.<br />
I prefer to waste my time actually getting things done rather than searching forums on how to keep Windows and OSX time in sync or bring back my machine for repair if a CD stays stuck in the CD Drive.</p>

<p>So, let&#8217;s say that our relationship is more ambivalent than needed to be.</p>

<h3>References</h3>

<p>Other links to pages of interest.</p>

<ul>
<li><a href="http://www.siftware.co.uk/blog/2007/05/things-that-suck-about-mac-os-x/">Things that suck about Mac OS X</a></li>
<li><a href="http://arewold.wordpress.com/2006/07/22/mac-os-x-annoyances-part-1-whats-up-with-the-mouse-acceleration/">Mac OS X annoyances: What’s up with the mouse acceleration?</a></li>
<li><a href="http://www.macworld.com/article/49691/2006/03/turbomice.html">A manual setting to change the speed factor in OSX</a></li>
<li>The <a href="http://plentycom.jp/en/steermouse/">Steermouse</a> driver to unleash your mouse in OSX</li>
<li>The <a href="http://lavacat.com/iMouseFix/index.html">iMouse</a> utility to correct pointer acceleration in OSX.</li>
<li>Another mouse utility called <a href="http://livecn.huasing.org/imouse/">iMouse</a>, for performing right-clicking in Windows this time.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2008/sysadmin-macbook-pro-after-the-honeymoon/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SysAdmin: Installing Windows Server 2008 x64 on a Macbook Pro</title>
		<link>http://blog.nkadesign.com/2008/mac-installing-windows-server-2008-x64-on-a-macbook-pro/</link>
		<comments>http://blog.nkadesign.com/2008/mac-installing-windows-server-2008-x64-on-a-macbook-pro/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 06:04:39 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[MSAccess]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=149</guid>
		<description><![CDATA[My trusty old gigantic Sony Vaio is about 4 years old. It served me well and still works but it&#8217;s about to become my main development machine for the next couple of months and I can&#8217;t afford to have it die on me during that time. It was time to get something as gigantic and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/apple.png" alt="security01.png" title="security01.png" align="left" width="53" height="64" hspace="5" vspace="5" border="0" />My trusty old gigantic <a href="http://etc.nkadesign.com/Linux/SonyVaio">Sony Vaio</a> is about 4 years old. It served me well and still works but it&#8217;s about to become my main development machine for the next couple of months and I can&#8217;t afford to have it die on me during that time.<br />
It was time to get something as gigantic and more up-to-date in terms of technology.</p>

<p>I use VMware on my main desktop to keep multiple OS setups that match typical configurations of my customer&#8217;s machines.<br />
This allows me to test my software before deployment and make sure everything works as expected.
It saved me many times from strange bugs and I would consider these final tests to be a mandatory step before deployment.<br />
My old trusty vaio would be hard pressed to run any of these without slowing down to a crawl.</p>

<p>I looked at some possible replacements. Initially I checked Lenovo&#8217;s offerings but they don&#8217;t seem to offer anything in large screen size (<a href="http://en.wikipedia.org/wiki/WUXGA">WUXGA</a> 1920&#215;1200) (Note, actually, <a href="http://www.tomshardware.com/news/Lenovo-W700-wacom-17-thinkpad,6117.html">they have</a>, but not really for me).<br />
Dito for Dell, not counting their humongous <a href="http://www.dell.com/content/products/productdetails.aspx/xpsnb_m1730?c=us&amp;l=en&amp;s=dhs">XPS M1730</a> luggable gaming machine that was wayyy over the top as a work computer, not to mention probably heavier than its volume in pure gold.</p>

<p><a title="Powerbook Pro" style="border:0;" href="/wp-content/uploads/images/MacBookPro_cr.png" rel="lightbox"><img title="Macbook Pro" src="/wp-content/uploads/images/MacBookPro_sm.png" width=250 Height=163 style="float:right;margin-left:10px;margin-bottom:5px;" /></a>
On a hint from a friend I checked out <a href="http://store.apple.com/hk/configure/MB166ZP/A?mco=NzUzNDY0">Apple&#8217;s online store</a> and saw they had a nice Macbook Pro configuration. I went to check it out in the retail store close to my office and they had that exact specification in stock, so, in what must have been the highest rated expense/time-to-think ratio of any decision I ever took, well, I bought it&#8230;</p>

<p>The spec, some bragging rights:</p>

<ul>
<li>Macbook Pro 17&#8243;</li>
<li>Core Duo T9500 2.6GHz processor</li>
<li>nVidia 8600M GT 512MB graphics card</li>
<li>200GB 7200rpm drive</li>
<li>Kingston 4GB DDR2 667MHz RAM</li>
<li>Hi Resolution 17&#8243; 1920&#215;1200 glossy screen</li>
</ul>

<p>It&#8217;s a <em>very</em> nice machine, Apple knows how to make nice hardware, there is no question there.<br />
OSX has some cool features, some of them still a bit foreign to me and some minor annoyances are creeping up, like Thunderbird&#8217;s not picking up my system date and time settings and displaying the date in the wrong format (a <a href="http://blog.nkadesign.com/2007/people-mind-your-dates-plz/">pet peeve</a> of me), probably not Apple&#8217;s fault but annoying nonetheless.<br />
So far so good and while I don&#8217;t mind using OSX for my browsing, email and creative stuff, that machine is meant to be running Windows Server 2008 x64 as a development platform.</p>

<h3>Why Windows Server 2008 x64?</h3>

<p>Well, it has some excellent features, a smaller footprint than Vista, all the aero eye candy, is apparently <a href="http://exo-blog.blogspot.com/2008/03/windows-2008-vista-done-right.html">noticeably faster than Vista</a> and has none of the nagging security prompt (you are considered administrator though, so keeping safe is entirely up to you).<br />
The 64 bit version can also address the full 4GB of RAM without limitation and all server features are optionally installable.<br />
By default, the installation is actually pretty minimal and you have to set services and options to get Windows configured as a proper workstation. It is after all, meant to be a server.<br />
Oh, I almost forgot that there is also support for <a href="http://en.wikipedia.org/wiki/Hyperv">HyperV</a>, although you must make sure you download the right version (if you list all available downloads in your MSDN subscription, you&#8217;ll see some that are explicitly without that technology).</p>

<h3>Installing Windows Server 2008 x64 is remarkably easy.</h3>

<ul>
<li>Get your hands on the ISO from your MSDN subscription or an install DVD from somewhere else (like a MS event, or even as a <a href="www.microsoft.com/windowsserver2008">free 240 days download from Microsoft</a>).</li>
<li>You&#8217;ll need to repackage the ISO as it won&#8217;t work properly (something to do with <a href="http://support.microsoft.com/kb/931708">non-standard file naming options</a>).<br />
It&#8217;s fairly easy if you follow the instructions from <a href="http://jowie.com/blog/post/2008/02/24/Select-CD-ROM-Boot-Type-prompt-while-trying-to-boot-from-Vista-x64-DVD-burnt-from-iso-file.aspx">Jowie&#8217;s website</a> <em>(<a href="/wp-content/uploads/2008/08/Select-CD-ROM-Boot-Type-prompt-while-trying-to-boot-from-Vista-x64-DVD-burnt-from-iso-file.aspx.htm">cached version</a>)</em>: you can get the <a href="http://www.imgburn.com/">ImgBurn</a> software for free as well, which is a good find in itself. It should&#8217;t take more than 30 minutes to repackage the DVD.</li>
<li>In OSX, go to Applications > Utilities > Boot camp and follow the instructions on screen.<br />
You will be able to resize the default partition by just moving the slider. I left 60GB for OSX and allocated the rest to Windows. The good thing is that OSX can read Windows partitions, so you can always store data there. Windows however, can&#8217;t read the <a href="http://en.wikipedia.org/wiki/HFS_Plus">HFS+</a> mac file system, although there are some third-party tools that can do it  <a href="http://www.ufsexplorer.com/">[1]</a> <a href="http://www.macdisk.com/prospen.php3">[2]</a> <a href="http://www.acutesystems.com/">[3]</a>.</li>
<li>Insert your repackaged DVD and Bootcamp will have rebooted the machine.<br />
After a few minutes of blank screen (and no HDD activity light to let you know something is happening), windows setup launches.</li>
<li>You will be then prompted with the choice of partition to install to.<br />
Select the one named BOOTCAMP, then click the <em>advanced options</em> button and click <em>format</em>.
From there one, windows will install everything, then reboot, then carry on installing, then reboot one last time.</li>
<li>Now, insert your <em>OSX recovery CD 1</em>. It should automatically launch the driver installation.<br />
Once done, you&#8217;ll reboot to a nice, full-resolution windows prompt.</li>
<li>All drivers will have been installed correctly except the one for Bluetooth. To easily solve that issue, just go to <a href="http://www.harbar.net/Default.aspx">Spencer Harbar&#8217;s website</a> and read <a href="http://www.harbar.net/archive/2008/06/13/Enabling-Bluetooth-on-MacBook-Pro-and-Windows-Server-2008-x64.aspx">how to install the Bluetooth drivers</a>. Takes 5 minutes tops.</li>
</ul>

<h3>The final touches</h3>

<p>A few notes to quickly get things running as expected.</p>

<ul>
<li>Get the most of your configuration by following the <a href="http://blogs.msdn.com/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx">list of tweaks from Vijayshinva Karnure</a> from Microsoft India.</li>
<li>There are <a href="http://www.win2008workstation.com/wordpress/">more tweaks</a>, and <a href="http://weblogs.asp.net/israelio/archive/2008/02/21/windows-server-2008-as-workstation.aspx">even more tweaks</a> available as well (don&#8217;t forget to enable <a href="http://www.2008server.org/?q=SuperFetch">Superfetch</a>).</li>
<li>Microsoft has a whole KB entry on <a href="http://support.microsoft.com/kb/947036">enabling user experience</a>.</li>
<li>In the Control Panel > System > Advanced System Settings > Advanced > Settings > Advanced > Processor scheduling, set to <em>Programs</em> instead of <em>Background services</em>.</li>
<li>Activate your copy of Windows using Control Panel > System.<br />
I was getting an error code 0x8007232B <em>DNS name does not exist</em> error. To force activation, just click on the <em>Change Product Key</em> button and re-enter the same key you used during install.<br />
Windows will activate straight away.</li>
<li>When booting your Macbook, press the <em>Option</em> key and you will be presented a list of boot choices.</li>
<li>You can check on <a href="http://www.apple.com/support/bootcamp/">Apple&#8217;s Bootcamp webpage</a> other information about how to use the track pad, keyboard layouts etc,</li>
</ul>

<h3>References</h3>

<ul>
<li><a href="http://stuartd.blogspot.com/2008/04/windows-server-2008-boot-camp-and.html">http://stuartd.blogspot.com/2008/04/windows-server-2008-boot-camp-and.html</a></li>
<li><a href="http://burnetts.homeserver.com/post/Windows-Server-2008-on-the-Mac.aspx">http://burnetts.homeserver.com/post/Windows-Server-2008-on-the-Mac.aspx</a></li>
<li><a href="http://csaborio.wordpress.com/2008/03/28/installing-windows-server-2008-on-a-mac-book-pro/">http://csaborio.wordpress.com/2008/03/28/installing-windows-server-2008-on-a-mac-book-pro/</a></li>
<li><a href="http://exo-blog.blogspot.com/2008/03/windows-2008-vista-done-right.html">http://exo-blog.blogspot.com/2008/03/windows-2008-vista-done-right.html</a></li>
<li><a href="http://www.sturmnet.org/blog/archives/2008/10/02/stuff-i-use-on-the-mac/">http://www.sturmnet.org/blog/archives/2008/10/02/stuff-i-use-on-the-mac/</a> Lots of software recommendations for someone switching from Windows to the Mac.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2008/mac-installing-windows-server-2008-x64-on-a-macbook-pro/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Linux sysadmin: a short RAID trouble-shooting story</title>
		<link>http://blog.nkadesign.com/2008/linux-sysadmin-a-short-troubleshooting-story/</link>
		<comments>http://blog.nkadesign.com/2008/linux-sysadmin-a-short-troubleshooting-story/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 11:15:29 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=86</guid>
		<description><![CDATA[I recently had an issue at a remote location (12000km away) where the old multi-purpose Linux server that had been working for the past 5 years wouldn&#8217;t boot again after a nasty power failure. The server was used as a firewall, a local email store, a file server and a backup server, so its failure [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/linux.png" alt="Linux" title="Linux" align="left" width="54" height="64" hspace="5" vspace="5" border="0" />
I recently had an issue at a remote location (12000km away) where the old multi-purpose Linux server that had been working for the past 5 years wouldn&#8217;t boot again after a nasty power failure.<br />
The server was used as a firewall, a local email store, a file server and a backup server, so its failure is a big deal for the small business that was using it.<br />
<center><img src="http://blog.nkadesign.com/wp-content/uploads/2008/06/266169495_863b3d935f.jpg" alt="RAID explained" /><br />
<small>RAID configurations explained</small></center>
You can&#8217;t always have complete redundancy, so some amount of bad crash is to be expected over the years. Fortunately, I always construct my servers around a simple software RAID1 array and that leaves some hope for recovery.<br />
In this instance, the server would start and then miserably fail in a fashion that would suggest a hardware failure of some sort. Not being able to be physically present and having no dedicated system admin on location, I directed the most knowledgeable person there to use a spare internet router to recover Internet connectivity and connect one of the disk to another Linux server (their fax server) through a USB external drive.</p>

<p>Doing this, I was able to remotely connect to the working server and access the disk, mount it and access the data.</p>

<h3>Salvaging the data</h3>

<p>Once one of the RAID1 drives was placed into the USB enclosure and connected to the other available Linux box it was easy to just remount the drives:</p>

<p><code>fdisk</code> will tell us which partitions are interesting, assuming that <code>/dev/sdc</code> is our usb harddrive:</p>

<pre><code>[root@fax ~]# fdisk -l /dev/sdc

Disk /dev/sdc: 81.9 GB, 81964302336 bytes
16 heads, 63 sectors/track, 158816 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes  

Device      Boot    Start         End      Blocks   Id  System
/dev/sdc1   *           1         207      104296+  fd  Linux raid autodetect
/dev/sdc2             208       20526    10240776   fd  Linux raid autodetect
/dev/sdc3           20527       22615     1052856   fd  Linux raid autodetect
/dev/sdc4           22616      158816    68645304    f  W95 Ext'd (LBA)
/dev/sdc5           22616      158816    68645272+  fd  Linux raid autodetect
</code></pre>

<p>We can&#8217;t simply <code>mount</code> the partitions, they need to be assembled into a RAID partition first:</p>

<pre><code>[root@fax ~]# mdadm --assemble /dev/md6 /dev/sdc1 --run
mdadm: /dev/md6 has been started with 1 drive (out of 2).
</code></pre>

<p>The <code>--run</code> argument forces the RAID partition to be assembled, otherwise, <code>mdadm</code> will complain that there is only a single drive available instead of the 2 -or more- it would expect.</p>

<p>Now simply mount the assembled partition to make it accessible in <code>/mnt</code> for instance:</p>

<pre><code>[root@fax ~]# mount /dev/md6 /mnt
</code></pre>

<p>We can now salvage our data by repeating this process for every partition.<br />
Using RAID1 means you have at least 2 disks to choose from, so if one is damaged beyond repair, you may be lucky and the mirror one on the other drive should work.</p>

<p>If the drives are not physically damaged but they won&#8217;t boot, you can always use a pair (or more) of USB HDD enclosures and reconstruct the RAID arrays manually from another Linux box.</p>

<h3>Planning for disasters</h3>

<p>The lesson here is about planning: you can&#8217;t foresee every possible event and have contingencies for each one of them, either because of complexity or cost,  but you can easily make your life much easier by planning ahead a little bit.</p>

<p>Most small businesses cannot afford dedicated IT staff, so they will usually end-up having the least IT-phobic person become their &#8216;system administrator&#8217;.<br />
It&#8217;s your job as a consultant/technical support to ensure that they have the minimum tools at hand to perform emergency recovery, especially if you cannot intervene yourself quickly.</p>

<h3>On-Site emergency tools</h3>

<p>In every small business spare parts closet there should be at least:</p>

<ul>
<li>Whenever possible, a <strong>spare Linux box</strong>, even if it&#8217;s just using older salvaged components (like a decommissioned PC). Just have a generic Linux install on it and make sure it is configured so it can be plugged in and accessed from the network.</li>
<li>a <strong>spare US$50 router</strong>, preferably pre-configured to be a temporary drop-in replacement for the existing router/firewall. Ideally, configure it to forward port 22 (SSH) to the spare Linux box so you can easily access the spare box from outside.</li>
<li>USB external <strong>hard-drive enclosure</strong>.</li>
<li>a spare PC <strong>power supply</strong>.</li>
<li>some network cables, a couple of screwdrivers.</li>
</ul>

<p>There are many more tools, such as rescue-CDs (like bootable Linux distributions), spare HDD, etc that can be kept but you have to remember that your point of contact need to be able to be your eyes and hands, so the amount of tools you provide should match their technical abilities.<br />
Don&#8217;t forget to clearly label confusing things like network ports (LAN, WAN) on routers, cables and PCs.</p>

<p>The point is that if you can&#8217;t be on site within a short period of time, then having these cheap tools and accessories already on site mean that your customers can quickly recover just by following your instructions on the phone.<br />
Once everything is plugged-in, you should be able to remotely carry-out most repairs.</p>

<h3>Resources</h3>

<ul>
<li><a href="http://www.linuxconfig.org/Linux_Software_Raid_1_Setup">Linux software RAID1 setup</a></li>
<li><a href="http://dailypackage.fedorabook.com/index.php?/categories/11-System-Recovery-Week">Fedora System Recovery Week</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2008/linux-sysadmin-a-short-troubleshooting-story/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MS Access: Restarting and compacting the database programmatically</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/</link>
		<comments>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comments</comments>
		<pubDate>Tue, 06 May 2008 03:06:19 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MSAccess]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73</guid>
		<description><![CDATA[In my previous article about changing the MS Access colour scheme I had the need to allow the user to restart the database after the colour scheme was changed. (Article and Code Updated 13FEB2009.) Being able to cleanly restart and compact the application is also useful in other instances: Changes made to the environment Recovering [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/access.png" alt="Microsoft Access" title="Microsoft Access" align="left" width="64" height="64" hspace="5" vspace="5" border="0" />
In my previous article about <a href="http://blog.nkadesign.com/2008/ms-access-changing-the-color-scheme-programmatically/">changing the MS Access colour scheme</a> I had the need to allow the user to restart the database after the colour scheme was changed.<br />
(<strong>Article and Code Updated 13FEB2009.</strong>)</p>

<p>Being able to cleanly restart and compact the application is also useful in other instances:</p>

<ul>
<li>Changes made to the environment</li>
<li>Recovering from errors (for instance after a network disconnection)</li>
<li>Forcing the user to re-log cleanly into the application</li>
<li>Automatically restarting a long-running application (for instance so that it may automatically compact on close and restart afresh with or without user intervention).</li>
</ul>

<p>The problem is that you cannot -to the best of my knowledge- close and open again the same database from within MS Access itself.<br />
Most executables cannot do that and the way to solve the issue is usually to pass the control to another boostrap programme, close the main application and let the bootstrap programme re-open the main application again.<br />
I wanted a simple and clean way of using it. One that would not require shipping external programmes.</p>

<h3>How to use it</h3>

<p>Download the sample database below, copy the <code>Utilities</code> module or just the <code>Restart</code> sub defined in it into your own application.</p>

<p>To use it, just call the <code>Restart</code> sub and the application will close and re-open.<br />
If you supply the optional <code>Compact:=true</code> parameter, the database will also be compacted during the restart process.<br />
This will work for normal databases (mdb/accdb) and also compiled (mde/accde) and runtime (accdr) databases as well.</p>

<h3>Important note</h3>

<p>If you want to use this code do not enable the <em>Compact on Close</em> option in Access for your database as the code doesn&#8217;t pick that up yet.<br />
Instead, you can either simply call <code>restart Compact:=true</code> on user action (for instance from a menu) or on other triggers, for instance when the database is being open and hasn&#8217;t been compacted for more than a week.</p>

<h3>How it works</h3>

<p>If you&#8217;re curious about the technical details, here is how it was put together.<br />
The main idea is that the MS Access database application has to be self-sufficient and restart itself by performing these steps:</p>

<ul>
<li>create a small batch file</li>
<li>run the batch file, passing the path and extension of our database</li>
<li>close the main application</li>
<li>the running batch file would wait for the MS Access lock file to be removed</li>
<li>once the lock file disappears, we open the database after compacting it if required.</li>
</ul>

<p>The key point here is that the batch file cannot just reopen the database right away: if the application is big or if it&#8217;s compacting on close for instance, it may take several seconds to actually close.<br />
The only moment we can be pretty sure that the database is effectively closed is when the lock file is deleted by MS Access.</p>

<p>The batch file is hard-wired in the <code>Restart</code> sub that does all the work:<br />
<textarea name="code" class="bat">
SETLOCAL ENABLEDELAYEDEXPANSION
SET /a counter=0
:CHECKLOCKFILE
ping 0.0.0.255 -n 1 -w 100 > nul
SET /a counter+=1
IF "!counter!"=="60" GOTO CLEANUP
IF EXIST "%~f2.%4" GOTO CHECKLOCKFILE
"%~f1" "%~f2.%3" /compact
start " " "%~f2.%3"
:CLEANUP
del %0
</textarea>
When the application runs the batch file, it passes 4 arguments:</p>

<ul>
<li>the full path to the MSAccess.exe executable (used for compacting the database)</li>
<li>the full path to the database without the extension</li>
<li>the database file extension without the leading &#8220;.&#8221;</li>
<li>the appropriate database lock file extension (<code>laccdb</code> or <code>ldb</code>).</li>
</ul>

<p>This allows us to easily construct the path to either the database or the lock file at line 07 and 09.<br />
Line 08 is actually only inserted if we need to compact the database: it simply launches MSAccess.exe with the <code>/compact</code> command line switch.</p>

<p>The funny use of <code>PING</code> is actually a simple way to wait for some time before we check if the lock file is still there or not. There is not <code>SLEEP</code> or <code>WAIT</code> function provided by default in Windows so we have to be a bit creative and use the time-out option of the <code>PING</code> command trying to ping an inexistent, but valid, IP address.<br />
Once the lock file has disappeared, we open the database at line 09 and then delete the batch file itself so we leave no leftovers.</p>

<p>The other thing of note is that we now use a counter to keep track of the number of times we checked the existence of the lock file.<br />
Once this counter reaches a pre-determined amount (60 by default, ~ 45 seconds) we consider that there is a problem and the database application didn&#8217;t close, so we just exit and delete the batch file.</p>

<p><a href='http://blog.nkadesign.com/wp-content/uploads/2008/05/DatabaseRestart.zip' title='Sample database'><img src='http://blog.nkadesign.com/wp-content/uploads/2008/05/download.png' align="left" alt='Download' /></a>Download the <a href='http://blog.nkadesign.com/wp-content/uploads/2008/05/DatabaseRestart.zip' title='Test database'>DatabaseRestart.zip (48KB)</a> containing both an Access 2007 ACCDB and Access 2000 MDB test databases.</p>

<h3>Other implementations</h3>

<ul>
<li><a href="http://www.rogersaccesslibrary.com/">Roger&#8217;s Access Library</a> (MVP) has a <a href="http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=377">different implementation on offer</a>.</li>
</ul>

<h3>Code Updates</h3>

<p><strong>v1.2: 13FEB2009</strong></p>

<ul>
<li>Added optional parameter to compact the database during restart.</li>
</ul>

<p><strong>v1.1: 09AUG2008</strong></p>

<ul>
<li>Now a separate test database (used to be bundled with the Colour Scheme sample).</li>
<li>Added support for older Access versions (an Access2000 MDB is now included).</li>
<li>Corrected wrong lock file extension for accd* files.</li>
<li>Added a time-out feature after which the batch file will delete itself 
after a while if the Access lock file wasn&#8217;t released 
(for instance following a crash).</li>
<li>Added checks to delete the batch file if it has not deleted itself for some
reason (for instance after a reboot).</li>
<li>The batch file now has a unique name based on the name of the database, 
allowing multiple databases to be restarted from the same directory.</li>
<li>Added license notice at top of source code.</li>
<li>Updated the article to reflect the changes.</li>
</ul>

<p><strong>v1.0: 06MAY2008</strong></p>

<ul>
<li>Original version</li>
</ul>

<p><!--- Code source license -->
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/80x15.png"/></a><br/>This <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" rel="dc:type">work</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>&#8220;Apple&#8217;s OS Edge Is a Threat to Microsoft&#8221;. Really?</title>
		<link>http://blog.nkadesign.com/2008/apples-os-edge-is-a-threat-to-microsoft-really/</link>
		<comments>http://blog.nkadesign.com/2008/apples-os-edge-is-a-threat-to-microsoft-really/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 11:13:18 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/2008/apples-os-edge-is-a-threat-to-microsoft-really/</guid>
		<description><![CDATA[Business Week has a recent article where the author foresee the demise of Windows in favour of Apple&#8217;s OS. Reading it, I couldn&#8217;t help thinking I was reading one of these overenthusiastic 1925 popular-science article promising us that within just a few years we would all use our own flying car to get to work. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/money01.png" alt="Business" title="Business" align="left" width="64" height="64" hspace="5" vspace="5" border="0" />Business Week has a recent article where the author foresee the <a href="http://www.businessweek.com/technology/content/apr2008/tc20080410_206881.htm">demise of Windows</a> in favour of Apple&#8217;s OS.<br />
Reading it, I couldn&#8217;t help thinking I was reading one of these overenthusiastic 1925 popular-science article  promising us that within just a few years we would all use our own flying car to get to work.<br />
Yeah, right, mine is parked right under my window.</p>

<p>The basic premise of the article is that Apple will attack the corporate market through the back-door, using the iPhone and its forthcoming development platform.<br />
The author contend that development to the iPhone will drive interest in the Mac and allow Apple to displace Windows by offering more business-related applications that would eventually not require Microsoft&#8217;s OS running side-by-side in your Mac, freeing you of the dominance of the evil empire.<br />
Please <a href="http://www.businessweek.com/technology/content/apr2008/tc20080410_206881.htm">read the article first</a>.
Done?<br />
Hmmm&#8230;<br />
Ok, let&#8217;s see&#8230;</p>

<p>First, let&#8217;s be nice: if Apple want to eat at Microsoft&#8217;s dominance of the OS market, then all the better: more competition will drive innovation and choice, which is always nice.<br />
There is certainly some truth to the idea that Apple could offer some useful tools and technologies to the corporate world.</p>

<p>The problem is that author of the article was a bit too much of a Mc Fanboy(TM) to make his arguments compelling.</p>

<p>Let&#8217;s start direct quotes from the article.</p>

<p>Speaking of the ability of the Mac to quickly switch from a Windows application to a Mac by using a keyboard shortcut:</p>

<blockquote>
  <p><em>&#8220;Windows users, in the very near future, will be free to switch to Apple computers and mobile devices, drawn by a widening array of Mac software, without suffering the pain of giving up critical Windows-based applications right away.&#8221;</em></p>
</blockquote>

<p>Useful as it may be, it&#8217;s forgetting one thing: if you need to be able to run your windows application under a Mac, you will need to give Microsoft money for the Windows license, making the newly found convenience of running the two OS together seamlessly a fairly expensive one, both in terms of computer resources and money.<br />
While it will interest a lot of people and they may use their windows apps on Apple hardware is this really compelling enough to make it a viable migration path?</p>

<p>About the new Mac OS kernel:</p>

<blockquote>
  <p><em>&#8220;That kernel has proved easily adaptable across the entire Apple product line, from highly complex servers all the way down to the relatively simple iPod Touch. Such modularity allows Apple to add whatever functions are necessary for each product environment—all while maintaining cross-product compatibility.<br />
  By contrast, Microsoft has held on to an OS tethered to the 1980s, piling additions upon additions with each upgrade to Windows. With last year&#8217;s arrival of Vista, Windows has swollen to 1 billion bytes (a gigabyte) or more of software code. The &#8220;Mach&#8221; kernel of the Mac OS X, however, requires less than 1 million bytes (a megabyte) of data in its smallest configuration, expanding modestly with the sophistication of the application.&#8221;</em></p>
</blockquote>

<p>All this is so silly and skewed that I wonder where to start.<br />
First, kernel size is irrelevant: a basic kernel functionality does not make an operating system. Additionally, I doubt that we&#8217;re comparing the same functionality and for desktop or server applications this is utterly irrelevant.<br />
For small devices Windows has its own flavours and they can <a href="http://channel9.msdn.com/ShowPost.aspx?PostID=15615">quickly be deployed to almost any hardware with minimal effort</a>.<br />
Applications built for Windows built for mobile devices can be ported to Windows <a href="http://en.wikipedia.org/wiki/.NET_Compact_Framework">without too much trouble</a>, and vice versa. Whatever platform you&#8217;re developing on, applications for small hardware are always an exercise in compromise: there is no way that you can just recompile an app for a different target and have it just work beautifully in any device. A mobile app must take care of power requirements, limited screen estate, memory and CPU limitations and specific usability issues like the presence of a touch-screen instead of a keyboard and mouse.<br />
The point is that you have to take the platform into consideration when crafting software.
Besides, using .Net makes it fairly easy to develop applications for any flavour of Windows.
Additionally, whether the OS under the XBox is different or not from the desktop version of Windows is also irrelevant: you can develop games under the <a href="http://en.wikipedia.org/wiki/Microsoft_XNA">XNA platform </a>that compile and work just the same under Windows as they do on the Xbox.</p>

<p>Now, for the argument regarding the <em>&#8220;additions upon additions&#8221;</em> made upon Windows that contribute to its bloat, it&#8217;s an easy shot to make and an unfair one: Apple has had no regards for its legacy applications and since its primary market was consumers, it could get away with making each of its major OS release incompatible with the previous one.<br />
We can argue whether it was a good thing for Microsoft to keep all the quirks from previous releases of its operating system alive but we must not forget that in the corporate world, <a href="http://www.microsoft-watch.com/content/operating_systems/windows_a_monopoly_shakes.html">Windows has close to 100% market </a>share on the desktop.<br />
What that means is that Microsoft could not afford not supporting business applications across versions. it would have been suicidal to even envisage dropping compatibility.<br />
If Apple ever get into that corporate market above a few percent it will have to guarantee compatibility between versions of its OS and programming tools if it wants to have any chance at being taken seriously at all.<br />
When companies spend money developing an application that is critical to their business, they don&#8217;t want to hear about its supporting OS becoming incompatible every couple of years.<br />
Apple would have to support and maintain compatibility for at least 10 years for every major OS version. So far Apple hasn&#8217;t shown that it was capable of that type of commitment.</p>

<p><a href='http://blog.nkadesign.com/wp-content/uploads/2008/04/amipro.png' title='Amipro 3.1 on my computer'><img src='http://blog.nkadesign.com/wp-content/uploads/2008/04/amiprosm.png' alt='Amipro 3.1 on my computer'  style="float:right;margin-left:10px;margin-bottom:5px"/></a>A small digression.<br />
A couple of weeks ago I found some old files of mine on a floppy.<br />
They were Ami Pro files, made at a time when <a href="http://en.wikipedia.org/wiki/AmiPro">Ami Pro 3.1</a> was the best word processor around.<br />
Problem was that I could not safely open these files any longer: filters for various word processors would mangle the complex layout of the pages, making them un-usable.
Out of curiosity, I found a full version of the original Amipro 3.1.<br />
I had no expectations of being able to run that setup package. After all, Ami Pro 3.1 came out in 1994, before Windows 95 was even released!<br />
Well, I clicked on that setup.exe file and watched the installation process go through&#8230;
Everything went fine.<br />
Surely, I thought, there is no way this is going to run under Windows XP. It&#8217;s going to crash for sure.<br />
I double-clicked on the 16 colour icon and lo and behold, the whole thing actually ran! Flawlessly!<br />
I was able to open my old files without any issue, save them under another format.
Everything worked, miraculously.<br />
That application was written at a time the Internet didn&#8217;t even exist yet I was able to install and run it without problem on a current operating system.<br />
Back to our regular schedule.</p>

<blockquote>
  <p><em>&#8220;Despite Apple&#8217;s relative scarcity on corporate desktops, Mac laptops are already well accepted within the enterprise, with a market share of more than 20% and growing. For business travellers, the new MacBook Air, some three pounds lighter than comparable Windows-based laptops, already offers one huge advantage.&#8221;</em></p>
</blockquote>

<p>First, Apple has a almost 20% market share on overall laptops sales only, not corporate sales.<br />
Second, that <a href="http://www.macworld.com/article/59616/2007/08/appleshare.html">figure is for the US only</a>. Apple&#8217;s laptop market share in the world is certainly not bad, but it&#8217;s a <a href="http://www.macnn.com/articles/08/03/05/apple.ninth.in.laptops/">quarter of that figure</a>, making adoption of Apple laptops outside the US very small indeed.<br />
Third, while Apple laptops are certainly sexy, they bring their own issues to businesses: lack of in-house serviceable parts, issues with making them fit into a complex infrastructure, hardware and software compatibility problems.<br />
Bringing Macs into your organisation can be painful. Of course, it&#8217;s never impossible, but beyond simple setups, it takes time, energy and money to make stuff work seamlessly.<br />
So I contend that, unless you have a serious commitment to Apple, most of the Macs getting into companies are for simple usage: fetching emails, browsing, making presentations and maybe Photoshop, although it seems that the application that was once the sole reason for some to use macs is now <a href="http://arstechnica.com/staff/fatbits.ars/2008/04/02/rhapsody-and-blues">going to switch side</a>, at least for a little while.<br />
For Macs to become a first-class corporate platform would require that Apple makes a very serious commitment to cross-platform development to make applications work on Windows as well.<br />
I seriously don&#8217;t think that the ability of Macs to run Windows side-by-side will do much: as mentioned above, the expense incurred offers no real benefit to businesses and having to support both platforms would increase the cost of ownership because of the upfront cost of buying and installing multiple OS, 15% higher average cost of Apple laptops compared to other similarly specified laptops and the cost of maintaining and supporting multiple hardware and OS stacks.<br />
Slickness can only get you so far I suppose.</p>

<blockquote>
  <p><em>&#8220;While Mac desktops offer a growing number of superior features over Windows desktops&#8221;</em></p>
</blockquote>

<p>Seriously dude, what superior features?</p>

<blockquote>
  <p><em>&#8220;Apple&#8217;s recently introduced Leopard servers compete in a market of unhappy Vista server buyers where Microsoft&#8217;s market share is only 40%. Leopard has a decent chance to expand from its small beachhead.&#8221;</em></p>
</blockquote>

<p>Huh? Vista servers?<br />
WTF is that?<br />
You can&#8217;t be talking about Windows 2003 because it&#8217;s actually a rock-solid platform and there isn&#8217;t much to complain about.<br />
Windows 2008 is just coming out and it looks just as promising.<br />
Apple has some seriously nice server hardware, it&#8217;s so beautiful to look at all this engineering that it gets me all hot and bothered.<br />
Seriously though, on the server side, Leopard would not be in competition with Windows but with *nix.<br />
Server-side applications like ASP, Exchange, Sharepoint, SQL Server and the myriad other Microsoft-only server software will only work on Windows.<br />
Apple is not going to compete as a platform for hosting these which means it will host services traditionally found on Linux/Unix/BSD systems.<br />
In that *nix camp Apple would certainly be a good contender, although it would have to prove that it can compete with the low license and hardware cost of its competitors and offer more.</p>

<p>One more thing to remember: Apple is in the hardware business: it uses software to lock people into its hardware business.<br />
I&#8217;m all for competition but at least using Linux or Microsoft products doesn&#8217;t lock me into a single hardware/software platform pair: I have orders of magnitude more choices when it comes to my servers, desktops and laptops than what Apple can offer me.<br />
Apple products may be slick and beautifully engineered but they certainly don&#8217;t offer more freedom: chose an iPhone and get stuck with a single network provider, buy an iPod and get stuck with iTune, buy a mac and get stuck with Apple, limited software offerings, no serious games and limited hardware support.</p>

<p>One other thing to keep in mind is that Microsoft has acquired a huge weight in terms of software development power: new technologies have been pouring out of Redmond at a pace that is impossible to follow.<br />
The number of developers and companies able to develop software for Windows platforms is wayyy above what Apple can dream of at the moment (we&#8217;re talking about millions of developer making a living off Windows).<br />
Apple will need to make serious efforts to woo the huge amounts of developers it needs to bring enough business and non-business applications to its platforms before it can become a serious competitor to Windows in the corporate world.<br />
Whether Apple has the capacity and will to do that instead of remaining a consumer-oriented company remains to be seen.</p>

<p>That being said I wouldn&#8217;t mind developing software for Apple platforms. I would love to be able to use a generic &#8220;surface laptop&#8221;, a sort of larger iPhone that could be used by sales people for taking orders and showing off new products.</p>

<p>Anyway, the point of all this was simply to offer a modest reality-check to an article that should have been a bit more measured and balanced in its fanboy-ish enthusiasm.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2008/apples-os-edge-is-a-threat-to-microsoft-really/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MediaWiki: Formating and colouring Code</title>
		<link>http://blog.nkadesign.com/2007/mediawiki-formating-and-colouring-code/</link>
		<comments>http://blog.nkadesign.com/2007/mediawiki-formating-and-colouring-code/#comments</comments>
		<pubDate>Tue, 20 Feb 2007 07:57:37 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=39</guid>
		<description><![CDATA[MediaWiki is the wiki software behind WikiPedia. The issue, when using it as a software development tool, is formatting code in a pretty way. As we did with WordPress before, here are some details to make dp.SyntaxHighlighter work fairly seamlessly with MediaWiki. Install the client-side highlighter Download dp.SyntaxHighlighter. Uncompress its content under a new /skins/common/SyntaxHighlighter [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/technology01.png" alt="technology01.png" title="technology01.png" align="left" width="64" height="64" hspace="5" vspace="5" border="0" /><a href="http://www.mediawiki.org">MediaWiki </a>is the wiki software behind <a href="http://www.wikipedia.org">WikiPedia</a>.<br />
The issue, when using it as a software development tool, is formatting code in a pretty way.
<a href="http://blog.nkadesign.com/?p=30">As we did with WordPress before</a>, here are some details to make <a href="http://www.dreamprojections.com/syntaxhighlighter/">dp.SyntaxHighlighter</a> work fairly seamlessly with MediaWiki.</p>

<h3>Install the client-side highlighter</h3>

<p>Download <a href="http://www.dreamprojections.com/syntaxhighlighter/">dp.SyntaxHighlighter</a>.
Uncompress its content under a new <code>/skins/common/SyntaxHighlighter</code> folder in your MediaWiki installation (don&#8217;t forget to make sure the files can be read by the web server; for instance, on Linux you may use <code>chown apache.apache -R *</code>).</p>

<p>In the skin template you are using for your MediaWiki site, insert the necessary code as required. In my example, I use the default <code>/skins/MonoBook.php</code> template into which I added the following:</p>

<p>Just before the closing <code>&lt;/head&gt;</code> tag:<br />
<textarea name="code" class="xml:nogutter:nocontrols">
<!-- http://www.dreamprojections.com/syntaxhighlighter/ -->
<link type="text/css" rel="stylesheet" href="/skins/common/SyntaxHighlighter/Styles/SyntaxHighlighter.css"></link></textarea>Just before the closing <code>&lt;/body&gt;</code> tag:<textarea name="code" class="xml:nogutter:nocontrols"><!-- http://www.dreamprojections.com/syntaxhighlighter/ -->
<script language="javascript" src="/skins/common/SyntaxHighlighter/Scripts/shCore.js"></script>
<script language="javascript" src="/skins/common/SyntaxHighlighter/Scripts/shBrushCSharp.js"></script>
<script language="javascript" src="/skins/common/SyntaxHighlighter/Scripts/shBrushXml.js"></script>
<script language="javascript" src="/skins/common/SyntaxHighlighter/Scripts/shBrushSql.js"></script>
<script language="javascript" src="/skins/common/SyntaxHighlighter/Scripts/shBrushJScript.js"></script>
<script language="javascript" src="/skins/common/SyntaxHighlighter/Scripts/shBrushPhp.js"></script>
<script language="javascript">
    dp.SyntaxHighlighter.HighlightAll('code');
</script></textarea></p>

<blockquote>
  <p><em>Note that you must include a reference to each source file corresponding to the type of programming language you want to highlight.<br />
  Have a look under the <code>/skins/common/SyntaxHighlighter/Scripts/</code> folder to see which languages you can highlight; there are a lot more than the few I use on my site.</em></p>
</blockquote>

<h3>Install the WikiMedia extension</h3>

<p>I&#8217;ve created a small extension to WikiMedia to allow us to enclose any source code in a new <code>&lt;codesyntax&gt;</code> tag.
Click on the <em>View Plain</em> option below and copy-paste the following code into a new file that you will save under <code>/extensions/syntaxhighlighter.php</code> (again, make sure this is readable by the webserver).<br />
<textarea name="code" class="php:nogutter">&lt;?php
/************************************************************
** Simple WikiMedia extension to create a new &lt;codesyntax&gt; tag that renders 
** syntax highlighted through the dp.SyntaxHighlighter javascript helper
** See http://www.dreamprojections.com/syntaxhighlighter/
** See http://meta.wikimedia.org/wiki/Extending_wiki_markup
** (c) Renaud Bompuis, 2007
** ------------------------------------------------------------------------------
** v1.0 - 20EFB2007 : first version. Uses the &lt;pre&gt; tag to ensure that the content of 
** the &lt;textarea&gt; containing the source code will not be messed up by WikiMedia.
** There are certainly better ways to do this, but they seem more complicated than this 
** (registering hooks, recording content before it is expanded and then replacing 
**  messed up content with the original)
************************************************************/
$wgExtensionFunctions[] = "wfSyntaxHighlighterExtension";

function wfSyntaxHighlighterExtension() {
    global $wgParser;
    $wgParser->setHook( "codesyntax", "renderCodeSyntax" );
}

// The callback function for converting the input text to HTML output
function renderCodeSyntax( $input, $argv, &$parser ) {
	$output = "&lt;pre style='border:0;padding:0;margin:0;'&gt;"
			  ."&lt;textarea name='code' class='".$argv["lang"]."'&gt;"
			  .Xml::escapeTagsOnly($input)
			  ."&lt;/textarea&gt;&lt;/pre&gt;" ;
    return $output;
}
?&gt;</textarea><br />
Add the following line to the end of your <code>LocalSettings.php</code> file, right before the closing <code>?&gt;</code> tag.<br />
<textarea name="code" class="php:nogutter:nocontrols">
require_once 'extensions/syntaxhighlighter.php';
</textarea></p>

<h3>Usage</h3>

<p>To highlight code in your MediaWiki pages, just enclose your source code with the new <code>&lt;codesyntax&gt;</code> tag. This tag takes a <code>lang</code> attribute to specify the options that normally would be listed in the <code>class</code> attribute in the <em>dp.SyntaxHighlighter</em> documentation.</p>

<p>For example:<br />
<textarea name="code" class="php:nogutter:nocontrols">
&lt;codesyntax lang="c#"&gt;
string url = "&lt;a href=\"" + someObj.getUrl() + "\" target=\"_blank\"&gtl;";
// single line comments
// second single line
override protected void OnLoad(EventArgs e)
{
	if(Attributes["class"] != null)
	{
		//_year.CssClass = Attributes["class"];
	}
//	base.OnLoad(e);
}
&lt;/codesyntax&gt;
</textarea><br />
Will display as:<br />
<textarea name="code" class="c#">string url = "&lt;a href=\"" + someObj.getUrl() + "\" target=\"_blank\"&gt;";
// single line comments
// second single line
override protected void OnLoad(EventArgs e)
{
	if(Attributes["class"] != null)
	{
		//_year.CssClass = Attributes["class"];
	}
//	base.OnLoad(e);
}
</textarea></p>

<p>For more information on using <em>dp.SyntaxHighlighter</em> see:<br />
<a href="http://www.dreamprojections.com/syntaxhighlighter/Usage.aspx">http://www.dreamprojections.com/syntaxhighlighter/Usage.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2007/mediawiki-formating-and-colouring-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SysAdmin: When your computer becomes forgetful</title>
		<link>http://blog.nkadesign.com/2006/sysadmin-when-your-computer-becomes-forgetful/</link>
		<comments>http://blog.nkadesign.com/2006/sysadmin-when-your-computer-becomes-forgetful/#comments</comments>
		<pubDate>Wed, 20 Sep 2006 13:37:02 +0000</pubDate>
		<dc:creator>Renaud Bompuis</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.nkadesign.com/?p=34</guid>
		<description><![CDATA[Sometimes your computer crashes without reason. It happens at any time, for no particular reason. Other times you&#8217;re trying to install a new OS on a brand new PC and at some point, it fails, reboot itself or just hangs. A couple years ago I had this really depressing experience with a brand new system [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/terror01.png" alt="Business" title="Business" align="left" width="64" height="64" hspace="5" vspace="5" border="0" />Sometimes your computer crashes without reason. It happens at any time, for no particular reason.<br />
Other times you&#8217;re trying to install a new OS on a brand new PC and at some point, it fails, reboot itself or just hangs.</p>

<p>A couple years ago I had this really depressing experience with a brand new system I was building. All the components were newly bought, but installing the OS (a Linux distro) used to fail almost at the end of the process.<br />
No matter how many times I tried, I could never get to the end of it.<br />
By clever subterfuge I managed to get it installed only to have it crash on a regular basis.<br />
It was unstable, unreliable and after two days wasted banging my head against the walls, I gave up&#8230;</p>

<p><img id="image35" src="/wp-content/uploads/2006/09/memt_210.jpg" alt="Memtest86" align="right"/>
Well, no for too long. A flash of inspiration came to me and I popped in the install CD and ran the only utility that was available at the prompt: <a href="http://www.memtest86.com/">memtest86</a>.<br />
That simple tool is a godsend (if I may appropriate the word from the believers. I promise to give it back).
After running its various memory tests for 10 minutes it reported errors in one of the RAM sticks installed on the motherboard.<br />
All that aggravation for a puny bit that was not remembering its state&#8230;<br />
I promptly returned the RAM and tested the new one for a few hours until I was confident there was no issue with its chips and went my merry way to install the OS I so desperately needed. All went without a hitch.</p>

<p>So my advice is: go to the <a href="http://www.memtest86.com/">memtest86</a> website. Burn the bootable ISO and test your PC from time to time, especially if you have strange intermittent issues that you can&#8217;t pin down to a simple software problem.<br />
You&#8217;d be amazed at the number of times I had to ditch a stick of RAM&#8230; memtest86 saved by sanity countless times.<br />
By the way, consider <a href="http://www.memtest86.com/#donations">donating</a> a little bit if it helped you too. That&#8217;s always cheaper than a session with a shrink&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nkadesign.com/2006/sysadmin-when-your-computer-becomes-forgetful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

