<?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"
	>

<channel>
	<title>WPKG Blog</title>
	<atom:link href="http://blog.wpkg.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wpkg.org</link>
	<description>a technical IT blog</description>
	<pubDate>Wed, 27 Aug 2008 18:25:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>DRDB and link compression</title>
		<link>http://blog.wpkg.org/2008/08/27/drdb-and-link-compression/</link>
		<comments>http://blog.wpkg.org/2008/08/27/drdb-and-link-compression/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 18:16:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[iSCSI]]></category>

		<category><![CDATA[compression]]></category>

		<category><![CDATA[DRBD]]></category>

		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/?p=27</guid>
		<description><![CDATA[Recently I was setting up DRBD (in short: &#8220;block devices designed as a building block to form high availability (HA) clusters&#8221;) between two data centers.
DRBD doesn&#8217;t apply any form of compression on the data that is replicated; is it a good idea to enable compression in the VPN link if you replicate your data with DRBD over Internet? [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was setting up <a href="http://www.drbd.org" rel="nofollow">DRBD</a> (in short: &#8220;block devices designed as a building block to form high availability (HA) clusters&#8221;) between two data centers.</p>
<p>DRBD doesn&#8217;t apply any form of compression on the data that is replicated; is it a good idea to enable compression in the VPN link if you replicate your data with DRBD over Internet? Here is a quick test.</p>
<p><span id="more-27"></span></p>
<p>I used OpenVPN with its lzo compression to test it, as it is easy to set up and to get the results.</p>
<p>tun0 interface is the &#8220;compressed&#8221; link; it shows the amount of data sent between two DRBD servers.</p>
<p>bond0 is the real network interface; as the underlying tun0 link sends data in compressed form, this one shows the real traffic.</p>
<p>As you can see by looking at &#8220;total&#8221; column, OpenVPN lzo compression saves us more than 50% of traffic. Not bad. I wonder how does IPsec&#8217;s IPcomp compare to OpenVPN&#8217;s lzo?</p>
<p><code>tun0<br />
day ......... rx ... | .... tx ...    | ... total<br />
---------------------+-------------+--------------<br />
04.06.      2292 MB  |   85.50 MB  |    2377 MB<br />
05.06.      2085 MB  |   80.69 MB  |    2166 MB<br />
06.06.      2585 MB  |   91.83 MB  |    2677 MB<br />
07.06.      2047 MB  |   80.20 MB  |    2128 MB<br />
08.06.      2298 MB  |   85.70 MB  |    2384 MB<br />
09.06.      2440 MB  |   90.20 MB  |    2530 MB<br />
10.06.      2461 MB  |   90.54 MB  |    2551 MB<br />
</code><br />
<code><br />
bond0<br />
04.06.      1035 MB  |  145.26 MB  |    1180 MB<br />
05.06.    936.28 MB  |  130.98 MB  |    1067 MB<br />
06.06.      1452 MB  |  157.91 MB  |    1610 MB<br />
07.06.    885.48 MB  |  134.84 MB  |    1020 MB<br />
08.06.    992.08 MB  |  147.36 MB  |    1139 MB<br />
09.06.      1064 MB  |  151.25 MB  |    1215 MB<br />
10.06.      1143 MB  |  154.26 MB  |    1297 MB<br />
</code></p>
<p>What was tested: a couple of virtual machines (Linux on Xen and Windows on VMware) with their block devices placed on LVM; LVM was placed on DRBD.</p>
<p>DRBD replication was disabled between 8 am and 8 pm, so normally, we would see more traffic.</p>
<p>Note that &#8220;tx&#8221; for bond0 is bigger than &#8220;tx&#8221; for tun0; it is because DRBD server was exchanging data with other machines in LAN as well (backups etc.).</p>
<p>Compressing the link between two DRBD machines make sense over a WAN interface only (if you have to pay for the amount of data transferred, the link is too slow, or both); it doesn&#8217;t make much sense locally if you have 1 Gbit network or better.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2008/08/27/drdb-and-link-compression/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Linux and Lumix digital cameras</title>
		<link>http://blog.wpkg.org/2008/07/21/linux-and-lumix-digital-cameras/</link>
		<comments>http://blog.wpkg.org/2008/07/21/linux-and-lumix-digital-cameras/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 20:17:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/?p=26</guid>
		<description><![CDATA[Do you happen to be running a Linux distribution and have Panasonic Lumix digital camera?
If yes, you may have problems downloading photos from it - depending on your kernel and udev settings, or more generally, on Linux distribution used.
The tips from below may help you.

Every USB device connected to your Linux system will make the [...]]]></description>
			<content:encoded><![CDATA[<p>Do you happen to be running a Linux distribution and have Panasonic Lumix digital camera?</p>
<p>If yes, you may have problems downloading photos from it - depending on your kernel and udev settings, or more generally, on Linux distribution used.</p>
<p>The tips from below may help you.</p>
<p><span id="more-26"></span></p>
<p>Every USB device connected to your Linux system will make the kernel print some messages. You can print them with <code>dmesg</code> command, started in the console, i.e.:</p>
<p><code><br />
# dmesg -c<br />
scsi 4:0:0:0: Direct-Access     MATSHITA DMC-TZ5          0100 PQ: 0 ANSI: 2<br />
usb-storage: device scan complete<br />
Driver 'sd' needs updating - please use bus_type methods<br />
sd 4:0:0:0: [sda] 7954431 512-byte hardware sectors (4073 MB)<br />
sd 4:0:0:0: [sda] Write Protect is off<br />
sd 4:0:0:0: [sda] Mode Sense: 04 00 00 00<br />
sd 4:0:0:0: [sda] Assuming drive cache: write through<br />
sd 4:0:0:0: [sda] 7954431 512-byte hardware sectors (4073 MB)<br />
sd 4:0:0:0: [sda] Write Protect is off<br />
sd 4:0:0:0: [sda] Mode Sense: 04 00 00 00<br />
sd 4:0:0:0: [sda] Assuming drive cache: write through</code></p>
<p>The above output meant that the connected camera was recognized as <em>/dev/sda</em> block device - good, your distro supports it out of the box. If you never see a block device like <em>sda</em> or <em>sdb</em>, but only output like below - it means you need to complain to your distribution vendor:</p>
<p><code><br />
# dmesg -c<br />
usb 1-2: new high speed USB device using ehci_hcd and address 3<br />
usb 1-2: configuration #1 chosen from 1 choice<br />
scsi3 : SCSI emulation for USB Mass Storage devices<br />
usb 1-2: New USB device found, idVendor=04da, idProduct=2372<br />
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3<br />
usb 1-2: Product: DMC-TZ5<br />
usb 1-2: Manufacturer: Panasonic<br />
usb 1-2: SerialNumber: 0000000000000000005F0208220775<br />
usb-storage: device found at 3<br />
usb-storage: waiting for device to settle before scanning<br />
scsi 3:0:0:0: Direct-Access     MATSHITA DMC-TZ5          0100 PQ: 0 ANSI: 2<br />
usb-storage: device scan complete</code></p>
<p>There is a simple workaround to that. In <code>/etc/udev</code>, search for such a line:<br />
<code><br />
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"</code></p>
<p>You can do it with <code>grep</code> command:</p>
<p><code># grep -r "bus/usb" /etc/udev</code></p>
<p>When you localize it, comment it out, restart <em>udevd</em>, i.e. use <code>killall</code> command to stop it, and start it in verbose mode to see more information on what it does:</p>
<p><code># killall udevd<br />
# udevd --verbose</code></p>
<p>For me, I had problems getting photos from DMZ-FZ20 and DMC-TZ5 Lumix models on Mandriva and OpenSuse. On Ubuntu though, everything worked from scratch and I didn&#8217;t have to do any udev changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2008/07/21/linux-and-lumix-digital-cameras/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accessing Windows console remotely from Linux</title>
		<link>http://blog.wpkg.org/2008/06/15/accessing-windows-console-remotely-from-linux/</link>
		<comments>http://blog.wpkg.org/2008/06/15/accessing-windows-console-remotely-from-linux/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 20:13:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Samba]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/?p=21</guid>
		<description><![CDATA[Have you ever needed to execute a command or to connect to an interactive text console on a remote Windows station?
Probably several times, and usually, you had to log in using either VNC or RDP (Remote Desktop Protocol - Microsoft Terminal Services). If you&#8217;re used to SSH, you may wonder why the overhead of a [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to execute a command or to connect to an interactive text console on a remote Windows station?</p>
<p>Probably several times, and usually, you had to log in using either VNC or RDP (Remote Desktop Protocol - Microsoft Terminal Services). If you&#8217;re used to SSH, you may wonder why the overhead of a complete desktop is needed just to start a few text commands.<br />
Of course, there are free and commercial SSH servers for Windows, but one problem with them is that they have to be installed separately. Which may be too much work for a one-off task now and then. Are there any other methods of accessing a remote Window text console from your Linux station?</p>
<p><span id="more-21"></span></p>
<p>But hey, here comes <a rel="nofollow" href="http://eol.ovh.org/winexe/">winexe</a> to the rescue! Below, accessing Windows CLI from Linux remotely (using a Windows domain account):</p>
<p><a href="http://blog.wpkg.org/wp-content/uploads/2008/05/winexe.png"><img class="alignnone size-medium wp-image-24" title="winexe on Linux" src="http://blog.wpkg.org/wp-content/uploads/2008/05/winexe-300x206.png" alt="winexe on Linux" width="300" height="206" /></a><a href="http://blog.wpkg.org/wp-content/uploads/2008/05/winexe.png"> </a></p>
<p>From the project&#8217;s page, &#8220;<em><strong>winexe</strong> remotely executes commands on WindowsNT/2000/XP/2003 systems from GNU/Linux (probably also other Unices capable to compile Samba4)</em>&#8220;.</p>
<p>Some notes:</p>
<ul>
<li>note that winexe doesn&#8217;t offer encryption of any kind - you may want to use VPN to make sure your connection is secure,</li>
<li>if your distribution doesn&#8217;t offer a packaged version of winexe (most distributions don&#8217;t), winexe homepage offers a static binary; on the other hand if you have a recent Linux distribution, the static binary will most probably not work for you - in that case, just build the tool from source,</li>
<li>you can use winexe in your Linux scripts - this way, you may execute certain tasks on your Linux machines, other tasks on your Windows machines - all that as a part of one bigger task / script,</li>
<li>winexe can be seen as a Linux equivalent of psexec (a similar tool available for Windows).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2008/06/15/accessing-windows-console-remotely-from-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>HP loves Linux the Windows way</title>
		<link>http://blog.wpkg.org/2008/04/17/hp-loves-linux-the-windows-way/</link>
		<comments>http://blog.wpkg.org/2008/04/17/hp-loves-linux-the-windows-way/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 21:31:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Misc]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/?p=15</guid>
		<description><![CDATA[Quite recently, HP announced a new line of thin clients with Debian Etch 4.0 preinstalled. That&#8217;s certainly good news for Linux, but why HP&#8217;s Linux support is Windows only?

HP, as every reputable hardware vendor, provides support for the products it sells. Its Linux-based HP Compaq t5735 Thin Client is no exception here:

So what happens if [...]]]></description>
			<content:encoded><![CDATA[<p>Quite recently, HP announced a new line of thin clients with Debian Etch 4.0 preinstalled. That&#8217;s certainly good news for Linux, but why HP&#8217;s Linux support is Windows only?</p>
<p><span id="more-15"></span></p>
<p>HP, as every reputable hardware vendor, provides support for the products it sells. Its Linux-based <a class="themebodylink" rel="nofollow" href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF05a/12454-12454-321959-338927-89307-3634729.html">HP Compaq t5735 Thin Client</a> is no exception here:</p>
<p><a href="http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=3634730&#038;lang=en&#038;cc=us&#038;prodTypeId=12454&#038;prodSeriesId=3634729&#038;taskId=135" rel="nofollow"><img class="alignnone size-medium wp-image-16" title="Does HP love Linux the Windows way?" src="http://blog.wpkg.org/wp-content/uploads/2008/04/hp-linux1-300x216.png" alt="" width="300" height="216" /></a></p>
<p>So what happens if we choose the only supported operating system, which happens to be Debian GNU/Linux 4.0?</p>
<p>Well, unless you&#8217;re used to the fact that your hardware vendor&#8217;s domain is to offer you RPM or DEB packages for Windows products, it shouldn&#8217;t surprise you that HP offers only Windows executables as a way to support its Linux products:</p>
<pre><a href="http://blog.wpkg.org/wp-content/uploads/2008/04/hp-linux21.png"><img class="alignnone size-medium wp-image-18" title="Oh yes, .EXE downloads for Linux products" src="http://blog.wpkg.org/wp-content/uploads/2008/04/hp-linux21-300x56.png" alt="" width="300" height="56" /></a></pre>
<p>Heck, have fun figuring out what to do with these instructions on your Linux distro:</p>
<pre><span class="body">INSTALLATION INSTRUCTIONS:
1. Download the SoftPaq .EXE file to a directory on your hard drive.

2. Execute the downloaded file and follow the on-screen instructions.
</span><a href="http://blog.wpkg.org/wp-content/uploads/2008/04/hp-linux21.png">
</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2008/04/17/hp-loves-linux-the-windows-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New wave of Blogspot spam</title>
		<link>http://blog.wpkg.org/2008/04/12/new-wave-of-blogspot-spam/</link>
		<comments>http://blog.wpkg.org/2008/04/12/new-wave-of-blogspot-spam/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 20:43:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/2008/04/12/new-wave-of-blogspot-spam/</guid>
		<description><![CDATA[Did you also notice an increase of unwanted &#8220;Blogspot messages&#8221; either in your inbox or spam folder? These messages contain a link to http://&#60;some_random_letters_and_numbers&#62;.blogspot.com, but in the end, you end up on entirely different page - why? Let&#8217;s try to analyse the page and find out.
These spam messages - which want the user to visit [...]]]></description>
			<content:encoded><![CDATA[<p>Did you also notice an increase of unwanted &#8220;Blogspot messages&#8221; either in your inbox or spam folder? These messages contain a link to <strong>http://&lt;some_random_letters_and_numbers&gt;.blogspot.com</strong>, but in the end, you end up on entirely different page - why? Let&#8217;s try to analyse the page and find out.</p>
<p><span id="more-14"></span>These spam messages - which want the user to visit a crafted Blogspot website - contain a small, but simple JavaScript hack. In order to see it, we either have to disable JavaScript in a browser, or, download the page with a tool which does not interpret the HTML code, for example, <a href="http://en.wikipedia.org/wiki/Wget" rel="nofollow">wget</a>.</p>
<p>If you already have this crafted Blogspot page&#8217;s source opened in your favourite text editor, search for &#8220;&lt;script language=&#8221;javascript&#8221;&gt;&#8221;. In this tag, you will find such a string:</p>
<blockquote><p>document.write(unescape(&#8221;<strong>&lt;some_long_and_rather_human_unreadable_encoded_text&gt;</strong>&#8220;));</p></blockquote>
<p>Now we know what the spammers did to trick us to visit a page which promises to grow your manhood and chest in no time:</p>
<ul>
<li>they encoded some text first to make it unreadable for human eye or simple spam filters,</li>
<li>they make the browser decode it with JavaScript <em>unescape</em> function,</li>
<li>finally, they write it to the original HTML page using <em>document.write</em>.</li>
</ul>
<p>But still, we don&#8217;t know why does it redirect us to a totally different page? An easy way to find out is to use a HTML/JavaScript encoder/decoder - the first link in Google should be just right for us: <a href="http://www.google.com/search?q=javascript+decoder" rel="nofollow">http://www.google.com/search?q=javascript+decoder</a>. Follow the first link and paste the obfuscated text into the right box titled &#8220;Escaped Text/HTML/JavaScript&#8221;. As we can see, it decodes to this JavaScript code:</p>
<blockquote><p>&lt;script language=&#8221;javascript&#8221;&gt;location.replace(&#8221;http://spammers.website.example.com&#8221;);&lt;/script&gt;</p></blockquote>
<p>Which just replaces the current Blogspot website (the one which was found in a spam email) with the spammer&#8217;s website specified in <em>location.replace</em>.</p>
<p>Very simple, isn&#8217;t it?</p>
<p>Unfortunately, Blogspot doesn&#8217;t seem to care or just is unable to do anything about it. Which might be the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2008/04/12/new-wave-of-blogspot-spam/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CPUfreq and dm-crypt performance problems</title>
		<link>http://blog.wpkg.org/2008/01/22/cpufreq-and-dm-crypt-performance-problems/</link>
		<comments>http://blog.wpkg.org/2008/01/22/cpufreq-and-dm-crypt-performance-problems/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 15:38:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/2008/01/22/cpufreq-and-dm-crypt-performance-problems/</guid>
		<description><![CDATA[Is using CPU frequency scaling on a server a good idea? After all, some servers don&#8217;t do very much at night, so why shouldn&#8217;t we scale CPU frequency down when servers are idle?
Unfortunately, simple tests revealed serious performance problems when reading from a drive encrypted with dm-crypt / LUKS - here is why (with a [...]]]></description>
			<content:encoded><![CDATA[<p>Is using CPU frequency scaling on a server a good idea? After all, some servers don&#8217;t do very much at night, so why shouldn&#8217;t we scale CPU frequency down when servers are idle?</p>
<p>Unfortunately, simple tests revealed serious performance problems when reading from a drive encrypted with dm-crypt / LUKS - here is why (with a simple solution).</p>
<p><span id="more-13"></span><br />
First, let&#8217;s use &#8220;ondemand&#8221; governor - reads will be only about ~8 MB/s.</p>
<p><code># echo ondemand &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</code></p>
<p># cat /proc/cpuinfo | grep MHz<br />
cpu MHz         : 349.991<br />
cpu MHz         : 349.991</p>
<p># echo 3 &gt; /proc/sys/vm/drop_caches</p>
<p># dd if=/dev/san2_data/test of=/dev/null bs=64k count=1000<br />
1000+0 records in<br />
1000+0 records out<br />
65536000 bytes (66 MB) copied, 8.64089 seconds, 7.6 MB/s</p>
<p>During the test, the CPU was using the lowest frequency possible.<br />
However, starting &#8220;cat /dev/zero | bzip2 &gt;/dev/null&#8221; for a second or two was causing the CPU to switch to the full speed and fast reading.</p>
<p>Now, let&#8217;s use performance governor (or, full CPU speed) - we get almost 60 MB/s:</p>
<p><code># echo performance &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</code></p>
<p># cat /proc/cpuinfo | grep MHz<br />
cpu MHz         : 2799.930<br />
cpu MHz         : 2799.930</p>
<p># echo 3 &gt; /proc/sys/vm/drop_caches</p>
<p># dd if=/dev/san2_data/test of=/dev/null bs=64k count=1000<br />
1000+0 records in<br />
1000+0 records out<br />
65536000 bytes (66 MB) copied, 1.14821 seconds, 57.1 MB/s</p>
<p>Why is it happening? Does a bell ring somewhere?</p>
<p>&#8220;ondemand&#8221; CPUfreq governor has a few tunables, described in Documentation/cpu-freq. One of them is up_threshold:</p>
<p><code>up_threshold: defines what the average CPU usaged between the samplings<br />
of 'sampling_rate' needs to be for the kernel to make a decision on<br />
whether it should increase the frequency.  For example when it is set<br />
to its default value of '80' it means that between the checking<br />
intervals the CPU needs to be on average more than 80% in use to then<br />
decide that the CPU frequency needs to be increased.</code></p>
<p>While reading from that dm-crypt device, the following CPU usage was shown on yet another machine (the<br />
numbers were consistent across a few tests):</p>
<p>187 MHz -&gt; ~75% system CPU time in top<br />
375 MHz -&gt; ~66% system CPU time in top<br />
562 MHz -&gt; ~94% system CPU time in top<br />
750 MHz -&gt; ~85% system CPU time in top<br />
937 MHz -&gt; ~85% system CPU time in top<br />
1125 MHz -&gt; ~83% system CPU time in top<br />
1312 MHz -&gt; ~70% system CPU time in top<br />
1500 MHz -&gt; ~70% system CPU time in top</p>
<p>dm-crypt won&#8217;t eat the whole CPU power.</p>
<p>With default 80 as up_threshold for &#8220;ondemand&#8221; governor, no wonder the<br />
frequency didn&#8217;t scale up.</p>
<p>So a &#8220;fix&#8221; for this problem was a matter of lowering up_threshold.<br />
One more thing as a final note. Some CPUs don&#8217;t support lowering their voltage automatically, and the only way to lower CPU frequency is by using throttling. However, throttling won&#8217;t save any energy on an idle machine. It&#8217;s designed only to cool down a busy CPU by forcing it to HALT from time to time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2008/01/22/cpufreq-and-dm-crypt-performance-problems/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using fault injection</title>
		<link>http://blog.wpkg.org/2007/11/08/using-fault-injection/</link>
		<comments>http://blog.wpkg.org/2007/11/08/using-fault-injection/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 19:30:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/2007/11/08/using-fault-injection/</guid>
		<description><![CDATA[Lately, I was playing with logfs, a scalable flash filesystem. It&#8217;s interesting because of at least three reasons:

it can compress data transparently,
it provides wear levelling,
it works with block devices.

In other words, a perfect filesystem to use for all flash-based devices, like USB-sticks.
Any filesystem should aim for high reliability, no doubt about it. But how to [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I was playing with <a href="http://logfs.org" rel="nofollow">logfs</a>, a scalable flash filesystem. It&#8217;s interesting because of at least three reasons:</p>
<ul>
<li>it can compress data transparently,</li>
<li>it provides wear levelling,</li>
<li>it works with block devices.</li>
</ul>
<p>In other words, a perfect filesystem to use for all flash-based devices, like USB-sticks.</p>
<p>Any filesystem should aim for high reliability, no doubt about it. But how to test it? Linux kernel provides a nice feature called &#8220;fault injection&#8221;. If Documentation/fault-injection/fault-injection.txt isn&#8217;t clear for you after the first read, here&#8217;s a quick help.</p>
<p><span id="more-12"></span></p>
<p>You need fault injection and debugfs compiled in the kernel.</p>
<p>First, mount debugfs:</p>
<p><code>mount debugfs /debug -t debugfs<br />
mount -t logfs /dev/sdb1 /mnt/2</code></p>
<p>Then, set up fault injection:</p>
<p><code>cd /debug/fail_make_request<br />
echo 10 &gt; interval         # interval<br />
echo 100 &gt; probability  # 100% probability<br />
echo -1 &gt; times             # how many times: -1 means no limit</code></p>
<p>Mount the filesystem on the device, start copying files etc. and then, make the device fail:</p>
<p><code>echo 1 &gt; /sys/block/sdb/sdb1/make-it-fail</code></p>
<p>Logfs was working for some time, but eventually, it failed - we can blame a proprietary nvidia module which tainted the kernel, of course <img src='http://blog.wpkg.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code>FAULT_INJECTION: forcing a failure<br />
[&lt;c0104d19&gt;] show_trace_log_lvl+0&#215;1a/0&#215;2f<br />
[&lt;c01057b1&gt;] show_trace+0&#215;12/0&#215;14<br />
[&lt;c0105837&gt;] dump_stack+0&#215;15/0&#215;17<br />
[&lt;c01e87d8&gt;] should_fail+0&#215;113/0&#215;144<br />
[&lt;c01d40f2&gt;] generic_make_request+0&#215;167/0&#215;2c0<br />
[&lt;c01d6142&gt;] submit_bio+0xd7/0xdf<br />
[&lt;c01837e6&gt;] submit_bh+0xbc/0xd9<br />
[&lt;c0185e84&gt;] block_read_full_page+0&#215;26c/0&#215;27c<br />
[&lt;c0187823&gt;] blkdev_readpage+0xf/0&#215;11<br />
[&lt;c014aecb&gt;] read_cache_page_async+0&#215;96/0&#215;129<br />
[&lt;c014c903&gt;] read_cache_page+0&#215;12/0&#215;42<br />
[&lt;c01c3aca&gt;] bdev_read+0&#215;5d/0xcd<br />
[&lt;c01bd9f8&gt;] scan_segment+0&#215;16e/0&#215;331<br />
[&lt;c01bdbe8&gt;] logfs_scan_pass+0&#215;2d/0&#215;71<br />
[&lt;c01bdce9&gt;] logfs_gc_pass+0&#215;44/0&#215;3f3<br />
[&lt;c01c07a0&gt;] logfs_get_wblocks+0&#215;21/0&#215;2f<br />
[&lt;c01c1751&gt;] logfs_write_buf+0&#215;22/0&#215;30b<br />
[&lt;c01bd790&gt;] logfs_commit_write+0xed/0&#215;101<br />
[&lt;c014c11f&gt;] generic_file_buffered_write+0&#215;3a9/0&#215;522<br />
[&lt;c014c6d3&gt;] __generic_file_aio_write_nolock+0&#215;43b/0&#215;471<br />
[&lt;c014c76d&gt;] generic_file_aio_write+0&#215;64/0xc1<br />
[&lt;c01672f6&gt;] do_sync_write+0xc4/0&#215;101<br />
[&lt;c0167af5&gt;] vfs_write+0xaf/0&#215;138<br />
[&lt;c0167fe2&gt;] sys_write+0&#215;3d/0&#215;61<br />
[&lt;c0103da2&gt;] sysenter_past_esp+0&#215;5f/0&#215;99<br />
=======================<br />
Buffer I/O error on device sdb1, logical block 35497<br />
&#8212;&#8212;&#8212;&#8212;[ cut here ]&#8212;&#8212;&#8212;&#8212;<br />
kernel BUG at fs/logfs/gc.c:88!<br />
invalid opcode: 0000 [#1]<br />
PREEMPT<br />
Modules linked in: iptable_nat nf_nat ipt_ULOG ipt_recent  nf_conntrack_ipv4 xt_state nf_conntrack nfnetlink ipt_REJECT xt_tcpudp  iptable_filter ip_tables x_tables capability usblp commoncap loop dm_mod  video thermal sbs fan container dock battery ac floppy  cpufreq_conservative cpufreq_powersave processor pcspkr kqemu af_packet  usb_storage snd_pcm_oss snd_mixer_oss snd_via82xx snd_ac97_codec  ac97_bus snd_pcm ehci_hcd snd_timer snd_page_alloc snd_mpu401_uart  snd_rawmidi snd_seq_device snd soundcore nvidia(P) uhci_hcd evdev  i2c_viapro via_agp agpgart i2c_core usbcore 8139cp via_rhine 8139too  sr_mod mii tsdev sg cdrom<br />
CPU:    0<br />
EIP:    0060:[&lt;c01bd9fc&gt;]    Tainted: P       VLI<br />
EFLAGS: 00010282   (2.6.22.5-1 #2)<br />
EIP is at scan_segment+0&#215;172/0&#215;331<br />
eax: fffffffb   ebx: c02cfa98   ecx: c1809d80   edx: 00000000<br />
esi: 08aa0000   edi: c749fbdc   ebp: c749fc1c   esp: c749fb8c<br />
ds: 007b   es: 007b   fs: 0000  gs: 0033  ss: 0068<br />
Process rsync (pid: 3940, ti=c749e000 task=d79574e0 task.ti=c749e000)<br />
Stack: 0000001c c749fbdc 0000031a 00000000 0000899c f695dff4 00000013  00000000<br />
00000455 dd4c1c00 00020000 00000000 022cfa98 00009114 00009114  00000000<br />
00000455 00000000 0000101c d7e7c800 5ccc4658 00040010 00000000  13000000<br />
Call Trace:<br />
[&lt;c0104d19&gt;] show_trace_log_lvl+0&#215;1a/0&#215;2f<br />
[&lt;c0104dc9&gt;] show_stack_log_lvl+0&#215;9b/0xa3<br />
[&lt;c0104fa8&gt;] show_registers+0&#215;1d7/0&#215;30c<br />
[&lt;c01051db&gt;] die+0xfe/0&#215;1d6<br />
[&lt;c02bddd7&gt;] do_trap+0&#215;89/0xa2<br />
[&lt;c0105605&gt;] do_invalid_op+0&#215;88/0&#215;92<br />
[&lt;c02bdbb2&gt;] error_code+0&#215;6a/0&#215;70<br />
[&lt;c01bdbe8&gt;] logfs_scan_pass+0&#215;2d/0&#215;71<br />
[&lt;c01bdce9&gt;] logfs_gc_pass+0&#215;44/0&#215;3f3<br />
[&lt;c01c07a0&gt;] logfs_get_wblocks+0&#215;21/0&#215;2f<br />
[&lt;c01c1751&gt;] logfs_write_buf+0&#215;22/0&#215;30b<br />
[&lt;c01bd790&gt;] logfs_commit_write+0xed/0&#215;101<br />
[&lt;c014c11f&gt;] generic_file_buffered_write+0&#215;3a9/0&#215;522<br />
[&lt;c014c6d3&gt;] __generic_file_aio_write_nolock+0&#215;43b/0&#215;471<br />
[&lt;c014c76d&gt;] generic_file_aio_write+0&#215;64/0xc1<br />
[&lt;c01672f6&gt;] do_sync_write+0xc4/0&#215;101<br />
[&lt;c0167af5&gt;] vfs_write+0xaf/0&#215;138<br />
[&lt;c0167fe2&gt;] sys_write+0&#215;3d/0&#215;61<br />
[&lt;c0103da2&gt;] sysenter_past_esp+0&#215;5f/0&#215;99<br />
=======================<br />
Code: 00 00 00 0f a5 f7 d3 e6 f6 c1 20 0f 45 fe 0f 45 f0 8b 45 94 89 f9  89 f2 8d 7d c0 03 55 a8 13 4d ac 89 7c 24 04 ff 13 85 c0 74 04 &lt;0f&gt; 0b  eb fe 8d 45 c0 b9 1c 00 00 00 ba ff 00 00 00 e8 82 55 00<br />
EIP: [&lt;c01bd9fc&gt;] scan_segment+0&#215;172/0&#215;331 SS:ESP 0068:c749fb8c</code></p>
<p>Hopefully, the bug is not there anymore, as I notified the logfs&#8217; author, Jörn Engel. He also fixed some other bugs I found.</p>
<p>I wonder if and how easy other filesystems can be abused with the fault injection?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2007/11/08/using-fault-injection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stale NFS file handle</title>
		<link>http://blog.wpkg.org/2007/10/26/stale-nfs-file-handle/</link>
		<comments>http://blog.wpkg.org/2007/10/26/stale-nfs-file-handle/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 19:49:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/2007/10/26/stale-nfs-file-handle/</guid>
		<description><![CDATA[Ever rebooted your NFS server, just to find out that your NFS clients can&#8217;t access it any more, with an error message &#8220;Stale NFS file handle&#8221;? If this happened to you and you have your NFS server&#8217;s exports on a LVM volume, this means that you didn&#8217;t read a fine exports manual:
fsid=num
This option forces the [...]]]></description>
			<content:encoded><![CDATA[<p>Ever rebooted your NFS server, just to find out that your NFS clients can&#8217;t access it any more, with an error message &#8220;Stale NFS file handle&#8221;? If this happened to you and you have your NFS server&#8217;s exports on a LVM volume, this means that you didn&#8217;t read a fine <code>exports</code> manual:</p>
<p><code><small>fsid=num<br />
This option forces the filesystem identification portion of the file handle and file attributes used on the wire to be num instead  of  a number  derived  from  the major and minor number of the block device on which the filesystem is mounted.  Any 32 bit number can be used, but it must be unique amongst all the exported filesystems.</small></code></p>
<p><code><small>This can be useful for NFS failover, to ensure that both servers of the failover pair use the  same  NFS  file  handles  for  the  shared filesystem thus avoiding stale file handles after failover.</small></code></p>
<p><code><small>Some  Linux filesystems are not mounted on a block device; exporting these via NFS requires the use of the fsid option (although that may still not be enough).</small></code></p>
<p>Obvious, and self-explanatory, isn&#8217;t it? If you happened to have this &#8220;Stale NFS file handle&#8221; problem and your exported NFS file systems were on a LVM volume, adding <code>fsid</code> for each exported filesystem should help:</p>
<p><code><small>/nfs4exports                     192.168.18.129/26(ro,sync,insecure,no_root_squash,no_subtree_check,fsid=0)<br />
/nfs4exports/vmware-data         192.168.18.129/26(rw,nohide,sync,insecure,no_root_squash,no_subtree_check,fsid=1)<br />
/nfs4exports/xen-config          192.168.18.129/26(rw,nohide,sync,insecure,no_root_squash,no_subtree_check,fsid=2)</small></code></p>
<p><strong>Note:</strong> if this error only happens when accessing certain files, this means that your (non-network) filesystem is broken:</p>
<p><code># rm fCVS<br />
rm: cannot remove `fCVS': Stale NFS file handle</code></p>
<p>In this case, running fsck is recommended.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2007/10/26/stale-nfs-file-handle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Solving reliability and scalability problems with iSCSI, part 2</title>
		<link>http://blog.wpkg.org/2007/09/27/solving-reliability-and-scalability-problems-with-iscsi-part-2/</link>
		<comments>http://blog.wpkg.org/2007/09/27/solving-reliability-and-scalability-problems-with-iscsi-part-2/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 21:32:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[iSCSI]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/2007/09/27/solving-reliability-and-scalability-problems-with-iscsi-part-2/</guid>
		<description><![CDATA[See Solving reliability and scalability problems with iSCSI, part 1 article.
The latest stable IET release, 0.4.15, suffers yet another misfeature: it will likely break all initiators when the ietd process is restarted (ietd restart, machine restart etc.).
This is because on ietd shutdown, the user space daemon is just killed, but it  doesn&#8217;t have the [...]]]></description>
			<content:encoded><![CDATA[<p>See <a href="http://blog.wpkg.org/2007/09/09/solving-reliability-and-scalability-problems-with-iscsi">Solving reliability and scalability problems with iSCSI, part 1</a> article.</p>
<p>The latest stable IET release, 0.4.15, suffers yet another misfeature: it will likely break all initiators when the ietd process is restarted (ietd restart, machine restart etc.).</p>
<p>This is because on ietd shutdown, the user space daemon is just killed, but it  doesn&#8217;t have the corresponding signal handler and the kernel space  module doesn&#8217;t perform any cleanups for it.</p>
<p>From initiator&#8217;s perspective, several things may happen:</p>
<ul>
<li>the change will happen so fast that the initiator won&#8217;t notice anything</li>
<li>initiator will break the connection, but after reconnection, you will see your iSCSI drives remounted read-only, weird hangs etc.</li>
<li>initiator won&#8217;t be able to connect again</li>
</ul>
<p>Of course, no one wants to have the filesystem remounted read only, or to have the hard drive ripped off from a working system (this is how it looks from the perspective of the kernel if we loose a iSCSI connection).</p>
<p>There is a simple solution to that, although some may say it&#8217;s an ugly hack.</p>
<p><span id="more-10"></span></p>
<p>Using <code>iptables</code> to block the traffic to and from the IET target just before it shuts down does the job - the change is trivial - in <code>/etc/init.d/iscsi-target</code>, add something similar to the lines marked in <strong>bold</strong>:</p>
<p><code>ietd_start()<br />
{<br />
echo -n "Starting iSCSI enterprise target service: "<br />
configure_memsize<br />
modprobe -q crc32c<br />
modprobe iscsi_trgt<br />
start-stop-daemon --start --exec $DAEMON --quiet<br />
RETVAL=$?<br />
<strong>sleep 3s<br />
iptables -D OUTPUT -p tcp &#8211;dport 3260 -j DROP<br />
iptables -D INPUT -p tcp &#8211;dport 3260 -j DROP</strong></code></p>
<p>if [ $RETVAL == "0" ]; then<br />
echo &#8220;succeeded.&#8221;<br />
else<br />
echo &#8220;failed.&#8221;<br />
fi<br />
}</p>
<p>ietd_stop()<br />
{<br />
<strong>iptables -A OUTPUT -p tcp &#8211;dport 3260 -j DROP<br />
iptables -A INPUT -p tcp &#8211;dport 3260 -j DROP</strong><br />
echo -n &#8220;Removing iSCSI enterprise target devices: &#8221;<br />
# ugly, but ietadm does not allways provides correct exit values<br />
RETURN=`ietadm &#8211;op delete 2&gt;&amp;1`</p>
<p>With it, and with changes described in <a href="http://blog.wpkg.org/2007/09/09/solving-reliability-and-scalability-problems-with-iscsi">part 1</a>, your IET iSCSI target installation should be really bullet-proof.</p>
<p>Or, perhaps, instead of using these hacks over and over again, it&#8217;s time to switch to more mature <a href="http://scst.sourceforge.net/">iSCSI-SCST</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2007/09/27/solving-reliability-and-scalability-problems-with-iscsi-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>diff: memory exhausted</title>
		<link>http://blog.wpkg.org/2007/09/26/diff-memory-exhausted/</link>
		<comments>http://blog.wpkg.org/2007/09/26/diff-memory-exhausted/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 21:19:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[All articles]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.wpkg.org/2007/09/26/diff-memory-exhausted/</guid>
		<description><![CDATA[Yesterday, I tried to make a diff of two ~800 MB big files on a machine with 1 GB RAM - unfortunately, it didn&#8217;t work:
# diff -u full/2007-09-25-full.sql  incr/incr.sql
diff: memory exhausted
After some googling and looking through various blogs and articles, it appeared to me that GNU diff just works like that - wants to [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I tried to make a diff of two ~800 MB big files on a machine with 1 GB RAM - unfortunately, it didn&#8217;t work:</p>
<p><code># diff -u full/2007-09-25-full.sql  incr/incr.sql<br />
diff: memory exhausted</code></p>
<p>After some googling and looking through various blogs and articles, it appeared to me that GNU diff just works like that - wants to load both files in memory. So, perhaps adding some more space would help?</p>
<p><code># dd if=/dev/zero of=/swapfile bs=1024 count=5242800<br />
# mkswap /swapfile<br />
# swapon /swapfile</code></p>
<p>Indeed, it helped - I was able to make a diff of these two ~800 MB files. However, as soon as I tried to make a diff of ~1 GB files, diff again exited with &#8220;memory exhausted&#8221; message.</p>
<p>I tried a number of tools, but none of them was giving the output I wanted (similar to that of <code>diff -u</code>).</p>
<p>As I needed that diff for backup only, in the end, I use xdelta tool:</p>
<p><code># xdelta delta -9 full/2007-09-25-full.sql  incr/incr.sql 2007-09-25-sql.delta</code></p>
<p>It gives a binary delta file, but is able to produce it using much less memory than diff.</p>
<p>Ooh, and if your files are so big that xdelta is failing for you&#8230;</p>
<p><code># xdelta delta -9 full/2008-06-01-full.sql incr/incr.sql 2008-06-02-incr.delta.temp<br />
xdelta: mmap failed: Cannot allocate memory</code></p>
<p>&#8230;you may consider using xdelta3. The deltas it produces are a big bigger, but it works much better (read: does not fail) with large files. Syntax:</p>
<p><code># xdelta3 -9 -f -e -s full/2008-06-01-full.sql incr/incr.sql 2008-06-02-incr.delta.temp</code></p>
<p>Still, it would be great to have a tool which could produce <code>diff -u</code> -style output for large files.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wpkg.org/2007/09/26/diff-memory-exhausted/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
