<?xml version="1.0" encoding="UTF-8"?>
<feed
  xmlns="http://www.w3.org/2005/Atom"
  xmlns:thr="http://purl.org/syndication/thread/1.0"
  xml:lang="en"
   >
  <title type="text">Louwrentius</title>
  <subtitle type="text">Nerd stuff about Linux Mac Storage and Security</subtitle>

  <updated>2013-05-23T20:57:22Z</updated>
  <generator uri="http://blogofile.com/">Blogofile</generator>

  <link rel="alternate" type="text/html" href="http://louwrentius.com/blog" />
  <id>http://louwrentius.com/blog/feed/atom/</id>
  <link rel="self" type="application/atom+xml" href="http://louwrentius.com/blog/feed/atom/" />
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Creating storage benchmark charts with FIO and GNUplot]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2013/05/creating-storage-benchmark-charts-with-fio-and-gnuplot/" />
    <id>http://louwrentius.com/blog/2013/05/creating-storage-benchmark-charts-with-fio-and-gnuplot/</id>
    <updated>2013-05-22T20:00:00Z</updated>
    <published>2013-05-22T20:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Storage" />
    <summary type="html"><![CDATA[Creating storage benchmark charts with FIO and GNUplot]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2013/05/creating-storage-benchmark-charts-with-fio-and-gnuplot/"><![CDATA[<p id="p1">I use <a href="http://freecode.com/projects/fio">FIO</a> to perform storage IO performance benchmarks. FIO does provide a script called "fio_generate_plots" which generates PNG or JPG based charts based on the data generated by FIO. The charts are created with <a href="http://www.gnuplot.info">GNUplot</a>.</p>
<p id="p2">The "fio_generate_plots" didn't make me very happy as it didn't generate the kind of graphs I wanted. Furthermore, the script just contains some copy/pastes of the same blocks of code, slightly altered for the different benchmark types. I understand that the focus lies on FIO itself not some script to generate some fancy graphs, so don't get me wrong, but the script could be improved.</p>
<p id="p3">I used this script as the basis for a significantly reworked version, putting the code in a function that can be called with different parameters for the different benchmark types. </p>
<p id="p4">The result of this new script is something like this:</p>
<p id="p5"><img alt="benchmark" src="http://louwrentius.com/images/fio/Random-4K-write-performance-iops.svg"/></p>
<p id="p6">You can <a href="http://louwrentius.com/files/fio_generate_plots_reworked.sh">download this new script here</a>. This script requires GNUplot 4.4 or higher.</p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Linode hacked: the dark side of cloud hosting]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2013/04/linode-hacked:-the-dark-side-of-cloud-hosting/" />
    <id>http://louwrentius.com/blog/2013/04/linode-hacked:-the-dark-side-of-cloud-hosting/</id>
    <updated>2013-04-16T20:00:00Z</updated>
    <published>2013-04-16T20:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="security" />
    <summary type="html"><![CDATA[Linode hacked: the dark side of cloud hosting]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2013/04/linode-hacked:-the-dark-side-of-cloud-hosting/"><![CDATA[<p id="p1">Linode has released an <a href="http://blog.linode.com/2013/04/16/security-incident-update/">update</a> about the security incident first reported
on April 12, 2013. </p>
<p id="p2">The Linode Manager is the environment where you control your virtual private servers and where you pay for services. This is the environment that got compromised. </p>
<p id="p3">Linode uses Adobe's ColdFusion as a platform for their Linode Manager application. It <a href="http://seclists.org/nmap-dev/2013/q2/3">seems</a> that the ColdFusion software was affected by two significant, previously unknown vulnerabilities that allowed attackers to compromise the entire Linode VPS management environment. </p>
<p id="p4">As the attackers had control over the virtual private servers hosted on the platform, they decided to compromise the VPS used by Nmap. Yes, the famous port scanner.</p>
<p id="p5">Fyodor's remark about the incident:</p>
<pre><code>I guess we've seen the dark side of cloud hosting.
</code></pre>
<p id="p6">That's the thing. Cloud hosting is just an extra layer, an extra attack surface, that may provide an attacker with the opportunity to compromise your server and thus your data.</p>
<p id="p7">Even the author of Nmap, a person fairly conscious about security and aware of the risk of cloud-hosting, still took the risk to save a few bucks and some time setting something up himself.</p>
<p id="p8">If you are a Linode customer and consider becoming a former customer by fleeing to another cheap cloud VPS provider, are you really sure you are solving your problems? </p>
<p id="p9">When using cloud services, you pay less and you outsource the chores that come with hosting on a dedicated private server. </p>
<pre><code>You also lose control over security.
</code></pre>
<p id="p10">Cloud hosting is just storing your data on <a href="http://www.loper-os.org/?p=44">'Other People's Hard Drives</a>. So the security of your stuff depends on those 'other people'. But did you ask those 'other people' for any information about how they tink to address risks like zero-days or other security threats? Or did you just consider their pricing, gave them your credit card and got on with your life?</p>
<p id="p11">If you left Linode for another cloud VPS provider, what assures you that they will do better? How do you know that they aren't compromised already right now? At this moment? You feel paranoid already?</p>
<p id="p12">We all want cheap hosting, but are you also willing to pay the price when the cloud platform is compromised?</p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Linode hacked: thoughts about cloud security]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2013/04/linode-hacked:-thoughts-about-cloud-security/" />
    <id>http://louwrentius.com/blog/2013/04/linode-hacked:-thoughts-about-cloud-security/</id>
    <updated>2013-04-16T00:00:00Z</updated>
    <published>2013-04-16T00:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="security" />
    <summary type="html"><![CDATA[Linode hacked: thoughts about cloud security]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2013/04/linode-hacked:-thoughts-about-cloud-security/"><![CDATA[<p id="p1">I bought a Linode VPS for private usage just after the <a href="http://blog.linode.com/2013/04/12/security-notice-linode-manager-password-reset/">report that Linode had reset all passwords</a> of existing users regarding the Linode management console. </p>
<p id="p2">Resetting passwords is not something you do when under a simple attack such as a DDOS attack. Such a measure is only taken if you suspect or have proof of a serious security breach. I should have known.</p>
<p id="p3">There are <a href="https://news.ycombinator.com/item?id=5552756">strong</a> <a href="http://slashdot.org/firehose.pl?op=view&amp;type=submission&amp;id=2603667">rumours</a> that Linode has actually been <a href="http://turtle.dereferenced.org/~nenolod/linode/linode-abridged.txt">hacked</a>. Although I signed up for a Linode VPS after the attack, I still checked my creditcard for any suspicious withdrawals. </p>
<p id="p4">Linode is as of this writing very silent about the topic, which only fuels my, and every other's suspicion that something bad has happened.</p>
<p id="p5">Whatever happened, even it isn't as bad as it seems, such an incident as this should make you evaluate your choices about hosting your apps and data on cloud services. </p>
<p id="p6">I don't care that much about rumours that creditcard information may have been compromised. Although in itself quite damning, what I do care is about the security of the data stored in the virtual private servers hosted on their platform. </p>
<p id="p7">I like this phase: <a href="http://www.loper-os.org/?p=44">"There is no cloud, only Other People's Hard Drives"</a>.</p>
<p id="p8">Everybody uses cloud services, so we all put our data in the hands of some other third party and we just hope that they properly secured their environment.</p>
<p id="p9">The cynical truth is that even so, a case can be made that for many companies, data stored in the cloud or on a VPS is a lot safer than within their own company IT environment. But an incident like this may prove otherwise. </p>
<p id="p10">And if you believe that data on a VPS is more secure than within your own IT environment, I believe that you have more pressing problems. The thing is that it doesn't tell you anything about the security of those cloud solutions. It only tells you something about the perceived security of your own IT environment. </p>
<p id="p11">The cloud infrastructure is just another layer between the metal and your services, and it can thus be attacked. It increases the attack surface. It increases the risk of a compromise. The cloud doesn't make your environment more secure, on the contrary.</p>
<p id="p12">So anyway, who performs regular security audits of Linode or (insert your current cloud hosting provider?) and what is the quality of the processes that should assure security at all times?</p>
<p id="p13">Questions. Questions.</p>
<p id="p14">This incident again shows that you should clearly think about what kind of security your company or customer data warrants. Is outsourcing security of your data acceptable?</p>
<p id="p15">Maybe, if security is an important factor, those cheap VPS hosts aren't that cheap after all. You may be better off creating your own private cloud on (rented or owned) dedicated servers and put a little bit more effort in it. </p>
<p id="p16">Building your own environment on your own equipment is more expensive than just a simple VPS, but you are much more in control regarding security. </p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Storage and I/O: reads vs. writes]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2013/04/storage-and-i/o:-reads-vs.-writes/" />
    <id>http://louwrentius.com/blog/2013/04/storage-and-i/o:-reads-vs.-writes/</id>
    <updated>2013-04-02T00:00:00Z</updated>
    <published>2013-04-02T00:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="storage" />
    <summary type="html"><![CDATA[Storage and I/O: reads vs. writes]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2013/04/storage-and-i/o:-reads-vs.-writes/"><![CDATA[<p id="p1">There is a fundamental difference between a read operation and a write operation. Storage can lie about completing a write operation, but it can never lie about completing a read operation. Therefore read and writes have different characteristics. This is what I've learned.</p>
<h3>About writes</h3>
<p id="p2">So what does this mean? Well, if you write data to disk, the I/O subsystem only has to acknowledge that it has written the data to the actual medium. Basically, the application says "please write this data to disk" and the I/O subsystem answers "done, feel free to give me another block of data!". </p>
<p id="p3">But the application cannot be sure that the I/O subsystem actually wrote that data to disk. More likely, the application can be sure the I/O subsystem lied.</p>
<p id="p4">Compared to RAM, non-volatile storage like hard-drives are slow. Orders of magnitudes slower. And the worst-case scenario, which is often also the real-life scenario, is that both read and write patterns are random as perceived from the storage I/O subsystem. </p>
<p id="p5">So you have this mechanical device with rotating platters and a moving arm, governed by Newtons rules of physics, trying to compete with CPUs and memory that are so small that they are affected by quantum mechanical effects. No way that device is going to be able to keep up with that. </p>
<p id="p6">So the I/O subsystem cheats. Hard drives are relatively great at reading and writing blocks of data sequentially, it's the random access patterns that wreaks havoc on performance. So the trick is to lie to the application and collect a bunch of writes in a cache, in memory. </p>
<p id="p7">So, meanwhile, the I/O subsystem looks at the data to be written to disk, and reorders the write operations, so that it becomes as 'serialised' as possible. It tries to take into account all the latencies involved in moving the arm, timing that with the rotation of the platter and that kind of stuff.</p>
<p id="p8">A 7200 RPM hard drive can do only 75 IOPS with random access patterns, but that is a worst-case of worst-case scenario's. Real-life usage scenario's often allow for some optimalisation. </p>
<p id="p9">I used FIO to perform some random-IO performance benchmarks on different hard drive types and RAID configurations. It turns out that read performance was conform the 75 IOPS, but writes where in the thousands of IOPS, not a realistic figure. The operating system (Linux) employed heavy caching of the writes, lying to FIO about the actual IOPS being written to disk. </p>
<p id="p10">Thousands of IOPS sounds great, but you can only lie until your write cache is full. There comes a time when you have to actually deliver and write this data to disk. This is where you see large drops in performance, to almost zero IOPS.</p>
<p id="p11">Most of the time, this behaviour is overall beneficial to application performance, as long as the application usage patterns are often short bursts of data, that need to be written to disk. With more steady streams of data being written to disk in a random order, this might influence application responsiveness. The application might become periodically unresponsive as data is flushed from the cache to disk.</p>
<p id="p12">This write-caching behaviour is often desired, because by reordering and optimising the order of the write requests, the actual overall obtained random I/O write performance is often significantly higher than could be achieved by the disk subsystem itself. </p>
<p id="p13">If the disk subsystem is not just a single disk, but a RAID array, comprised of
multiple drives, write-caching is often even more important to keep performance acceptable, especially for RAID arrays with parity, such as RAID 5 and RAID 6.</p>
<p id="p14">Write-back caching may help increase performance significantly, but it may come at a cost. As the I/O subsystem lies about data being written to disk, that data may get lost if the system crashes or loses power. There is a risk of data loss or data corruption. Only use write-back caching on equipment that is supported by battery backup units and a UPS. Due to the risks associated with write-back caching, there might be use cases where it might be advised not to enable it to retain data consistency. </p>
<h3>About reads</h3>
<p id="p15">The I/O subsystem can't lie to the application about writes. If the application 
asks the I/O subsystem "can I have the contents of file X", the I/O subsystem can't just say "well, yes, sure". It actually has to deliver that data. So any arbitrary write can be easily cached and written to disk in a more optimised way, reads may be harder. There is no easy way out, the I/O subsystem must deliver.</p>
<p id="p16">Where any arbitrary write can be cached, only a limited number of reads can be cached. Cache memory is relatively small compared to the storage of the disk subsystem. The I/O subsystem must be smart about which data needs to be cached.</p>
<p id="p17">More complex storage solutions keep track of 'hot spots' and keep that data cached. As a side note, such caching constructions can now also be found in consumer grade equipment: Apple's fusion drive uses the SSD as a cache and stores the data that is less frequently accessed on the HDD.</p>
<p id="p18">But in the end, regarding reads, chances are higher that data must be retrieved that is not stored in cache (cache miss) and thus the drives must do actual work. Fortunately, that work is not as 'expensive' as writes for RAID 5 or RAID 6 arrays. </p>
<p id="p19">Furthermore, reads can also be 'grouped' and serialised (increased queue depth) at the cost of latency to optimise them (setup a more sequential read access pattern for the disk subsystem) and achieve better performance. But again, at the cost of latency, thus responsiveness. That may or
may not be a problem depending of the type of application. </p>
<h3>Some remarks</h3>
<p id="p20">If possible, it's better to try and avoid having to access the storage subsystem in the first place, if possible. Try and trow RAM memory at the problem. Buy systems with sufficient RAM memory, so that the entire database fits in RAM memory. A few years ago this was unthinkable, but 128 GB of RAM memory can be had for less than two thousand dollars.</p>
<p id="p21">If RAM isn't an option (dataset is too large) still try and put in as much RAM as possible. Also, try and see if server grade Solid State Drives (SSDs) are an option (always RAID 1 at least for redundancy!), although their cost may be an obstacle.</p>
<p id="p22">The gateway of last resort is the old trusted hard drive. If random I/O is really an issue, take a look at 15000 RPM or at least 10000 RPM SAS drives and a good RAID controller with loads of cache memory. In general, more drives or more 'spindles' equals more I/O performance.</p>
<p id="p23">You might encounter a situation where you want to add drives to increase I/O performance, not for the storage. More important: you may choose not to use that extra storage as it may decrease performance. Because if you put more data on a disk, the head must cover larger areas of the disk platter, increasing latency. </p>
<p id="p24">There are usecases where drives are intentionally under-partitioned to (artificially) increase the performance of the drives.</p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Setup a VPN on your iPhone with OpenVPN and Linux]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2013/01/setup-a-vpn-on-your-iphone-with-openvpn-and-linux/" />
    <id>http://louwrentius.com/blog/2013/01/setup-a-vpn-on-your-iphone-with-openvpn-and-linux/</id>
    <updated>2013-01-19T04:00:00Z</updated>
    <published>2013-01-19T04:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Security" />
    <category scheme="http://louwrentius.com/blog" term="VPN" />
    <summary type="html"><![CDATA[Setup a VPN on your iPhone with OpenVPN and Linux]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2013/01/setup-a-vpn-on-your-iphone-with-openvpn-and-linux/"><![CDATA[<h3>Introduction</h3>
<p id="p1">I'm quite happy because finally there is an <a href="https://itunes.apple.com/us/app/openvpn-connect/id590379981">official OpenVPN client for IOS</a>. It took me about an hour to setup an OpenVPN server and got the iPhone working. <a href="https://plus.google.com/u/0/102486415329787631392/posts/faSspbtGkcW">This</a> is the 'press release'. </p>
<p id="p2"><img alt="screenshot" src="http://a272.phobos.apple.com/us/r1000/065/Purple/v4/e1/90/cd/e190cda4-95ee-be3e-3bfa-c95d96eb5490/mzl.idnjsbfa.320x480-75.jpg"/></p>
<p id="p3">The OpenVPN client is great because it automatically reconnects when your iPhone
wakes from sleep, do you don't have to manually reconnect.</p>
<p id="p4">So this is how to quickly setup your own OpenVPN server and hook up your iPhone.</p>
<h3>How It Works</h3>
<p id="p5">OpenVPN is an SSL-based VPN solution. SSL-based VPNs are cool because if you set it up properly, you will never be blocked by any firewall as long as TCP-port 443 is accessible. Standard, OpenVPN uses UDP as a transport at port 1194, but you can switch to TCP to increase the chance that your traffic will not be blocked.</p>
<p id="p6">Authentication is performed based on public/private key cryptography. The OpenVPN server is similar to an HTTPS server. The client however, does not authenticate with a username and password but you use a client certificate. </p>
<p id="p7">So before you can setup an actual VPN configuration with OpenVPN, you need to setup a Certificate Authority.</p>
<p id="p8">With the CA you can create the server certificate and then generate all client certificates for authentication. Clients use the CA certificate to validate the server. </p>
<h3>OpenVPN installation</h3>
<p id="p9">OpenVPN is often standard on most common Linux Distros. apt-get install openvpn for any Debian or Ubuntu version is all you need to install OpenVPN. </p>
<p id="p10">Or take a look <a href="http://openvpn.net/index.php/open-source/documentation/howto.html#install">here</a></p>
<h3>Creating a certificate authority.</h3>
<p id="p11">I assume that you will create a configuration in /etc/openvpn.
But before you can setup the configuration, you need to create a certificate authority. I used the folder /etc/openvpn/easy-rsa for this. </p>
<p id="p12">This is no coincidence, as we use the easy-rsa scripts as part of OpenVPN to quickly setup our certificate authority.</p>
<p id="p13">We start with copying all these files to this new directory:</p>
<pre><code>cp -R /usr/share/doc/openvpn/examples/easy-rsa/2.0* /etc/openvpn/easy-rsa
</code></pre>
<p id="p14">Next, we cd to this directory and edit the 'vars' file. The following instructions are straight from the <a href="http://openvpn.net/index.php/open-source/documentation/howto.html#pki">OpenVPN howto</a>. </p>
<pre><code>export KEY_COUNTRY="US"
export KEY_PROVINCE="California"
export KEY_CITY="San Fransisco"
export KEY_ORG="My Company"
export KEY_EMAIL="my@mail.com"
export KEY_CN=server
export KEY_NAME=server
export KEY_OU=home
</code></pre>
<p id="p15">Then I had to copy openssl-1.0.0.cnf to openssl.cnf because the 'vars' script complained that it couldn't find the latter file.</p>
<pre><code>cp openssl-1.0.0.cnf openssl.cnf
</code></pre>
<p id="p16">Then we 'source' var and run two additional commands that actually generate the certificate authority.</p>
<pre><code>. ./vars
./clean-all
./build-ca
</code></pre>
<p id="p17">You will have to confirm the values or change them if necessary. </p>
<p id="p18">Now we have a certificate authority and we can create new certificates that will be signed by this authority. </p>
<p id="p19">WARNING: be extremely careful with all key files, they should be kept private.</p>
<h3>Creating the Server Certificate</h3>
<p id="p20">First we create the server certificate:</p>
<pre><code>./build-key-server server
</code></pre>
<p id="p21">It's up to you to come up with an alternative for 'server'. This is the file name under which the key files and certificates are stored. </p>
<p id="p22">All files that are generated can be found in the '/etc/openvpn/easy-rsa/keys' directory.</p>
<h3>Creating the Client Certificate</h3>
<p id="p23">Now that we have a server certificate, we are going to create a certificate for our iPhone (or any other iOS device).</p>
<pre><code>./build-key iPhone
</code></pre>
<p id="p24">Last, we must generate Diffie-Helman parameters like this:</p>
<pre><code>./build-dh
</code></pre>
<p id="p25">So now we have everything in place to start creating an OpenVPN configuration.
We must create a configuration for the server and the client. Those configurations are based on the examples that can be find in /usr/share/doc/openvpn/examples/.</p>
<h3>Example Server configuration</h3>
<p id="p26">This is my server configuration which is operational. It is stored in /etc/openvpn/iphone.conf</p>
<pre><code>dev tun2
tls-server
dh easy-rsa/keys/dh1024.pem
ca easy-rsa/keys/ca.crt
cert easy-rsa/keys/server.crt
key easy-rsa/keys/server.key
server 10.0.0.0 255.255.255.0
log /var/log/openvpn-iphone.log
comp-lzo
script-security 2
route-up "/sbin/ifconfig tun2 up"
port 443
proto tcp-server
keepalive 30 120
</code></pre>
<p id="p27">I use TCP-port 443 as this destination port is almost never blocked as this would break most internet connectivity. The downside is that I can no longer host any secure web site on this IP-address. </p>
<p id="p28">I'm aware that you now know that I'm running OpenVPN on this box and you will be able to talk to this service, however, as it uses certificates for authentication, security will be sufficient, unless OpenVPN itself is vulnerable.</p>
<p id="p29">The keepalive parameter prevents your phone from reconnecting every 40 seconds by default, as I experienced. </p>
<p id="p30">Change any parameters if required and then start or restart the OpenVPN service:</p>
<pre><code>/etc/init.d/openvpn restart
</code></pre>
<p id="p31">Make sure that the server is running properly in /var/log/openvpn-iphone.log</p>
<p id="p32">If you want to use your VPN to browse the internet, we still need to configure a basic firewall setup. </p>
<p id="p33">I'm assuming that you already have some kind of IPtables file wall running. If not, you might want to look at <a href="https://code.google.com/p/lifs/">LIFS</a>, a powerful Linux firewall script. So I assume that you already have a secure IPtables configuration, you only need to add some stuff. </p>
<p id="p34">Assuming that you will - for example - use the 10.0.0.0/24 network for VPN clients such as your iPhone, you must also create a NAT rule so VPN clients can use the IP-address of the Linux server to access Internet. </p>
<pre><code>iptables -t nat -A POSTROUTING -s "10.0.0.0/24" -o "eth0" -j MASQUERADE
</code></pre>
<p id="p35">Please note that you must change eth0 with the appropriate interface of your router. Change the IP-address range according to your own situation. It should not conflict with your existing network.</p>
<pre><code>iptables -A FORWARD -p tcp -s 10.0.0.0/24 -d 0.0.0.0/0 -j ACCEPT
</code></pre>
<p id="p36">Please note that I haven't tested these rules, as I have a different setup. But this should be sufficient. And make sure that forwarding is enabled like this:</p>
<pre><code>echo 1 &gt; /proc/sys/net/ipv4/ip_forward
</code></pre>
<h3>Example Client configuration</h3>
<p id="p37">Create a file called iphone.ovpn and configure it like this:</p>
<pre><code>tls-client
remote &lt;some domain name or IP address&gt;
ca ca.crt
cert iphone.crt
key iphone.key
comp-lzo
port 443
proto tcp
</code></pre>
<h3>Setting up your iPhone</h3>
<p id="p38">You need to get the following files on your iOS device:</p>
<pre><code>iphone.ovpn
ca.crt
iphone.crt
iphone.key
</code></pre>
<p id="p39">The safest way is to use iTunes and connect your device with a cable, although I believe that iCloud stuff works too. </p>
<ol>
<li>Open iTunes</li>
<li>Select your device at the top right</li>
<li>Go to the Apps tab</li>
<li>Scroll to the file sharing section</li>
<li>Select the OpenVPN application</li>
<li>Add all mentioned files at the right side</li>
<li>Sync your device</li>
</ol>
<h3>Test your iPhone</h3>
<p id="p40">Open the OpenVPN client. You will see a notice that a new configuration has been
imported and you need to accept this configuration. As it might not work straight away, you need to monitor /var/log/openvpn-iphone.log on the server to watch for any errors. </p>
<p id="p41">Now try to connect and enjoy.</p>
<hr/>
<p id="p42">Updated 20130123 with keepalive option.</p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Benchmark results of Random I/O performance of different RAID levels]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2013/01/benchmark-results-of-random-i/o-performance-of-different-raid-levels/" />
    <id>http://louwrentius.com/blog/2013/01/benchmark-results-of-random-i/o-performance-of-different-raid-levels/</id>
    <updated>2013-01-01T00:00:00Z</updated>
    <published>2013-01-01T00:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Storage" />
    <summary type="html"><![CDATA[Benchmark results of Random I/O performance of different RAID levels]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2013/01/benchmark-results-of-random-i/o-performance-of-different-raid-levels/"><![CDATA[<h3>Introduction</h3>
<p id="p1">I have performed some benchmarks to determine how different RAID levels perform when handling a 100% random workload of 4K requests. This is a worst-case scenario for almost every storage subsystem. Normal day-to-day workloads may not be that harsh in a real-life environment, but worst-case, these tests show what kind of performance you might expect when you face such a workload. </p>
<p id="p2">To create a worst-case worst-case solution, I even disabled write-caching for all write-related tests.</p>
<p id="p3">At the moment, I only have access to some consumer-level test hardware. In the future, I'd like to rerun these tests on some 10K RPM SAN storage drives to see how this turns out. </p>
<h3>RAID levels tested</h3>
<p id="p4">I have tested the following RAID levels:</p>
<ul>
<li>RAID 0</li>
<li>RAID 10</li>
<li>RAID 5</li>
<li>RAID 6</li>
</ul>
<h3>Test setup</h3>
<ul>
<li>CPU: Intel Core i5 2400s @ 2.5 GHz</li>
<li>RAM: 4 GB</li>
<li>Drives: 6 x 500 GB, 7200 RPM drives (SATA). </li>
<li>Operating system: Ubuntu Linux</li>
<li>RAID: Build-in Linux software RAID (MDADM)</li>
<li>File system: XFS</li>
<li>Test file size: 10 GB</li>
<li>Test software: <a href="http://freecode.com/projects/fio">FIO</a> <a href="http://louwrentius.com/files/random-read-template.fio">read-config</a> &amp; <a href="http://louwrentius.com/files/random-write-template.fio">write-config</a></li>
<li>Queue depth: 4</li>
<li><a href="http://louwrentius.com/files/raid-tester.sh">Test script</a> that generates RAID arrays, file systems and runs the tests.</li>
<li>Cache: all write caching was disabled during testing (see script)</li>
</ul>
<h3>Test results</h3>
<p id="p5"><a href="http://louwrentius.com/images/fio/Random-4K-read-performance-lat.svg"><img alt="read latency" src="http://louwrentius.com/images/fio/Random-4K-read-performance-lat.svg"/></a>
<a href="http://louwrentius.com/images/fio/Random-4K-read-performance-iops.svg"><img alt="read iops" src="http://louwrentius.com/images/fio/Random-4K-read-performance-iops.svg"/></a>
<a href="http://louwrentius.com/images/fio/Random-4K-read-performance-bw.svg"><img alt="read bw" src="http://louwrentius.com/images/fio/Random-4K-read-performance-bw.svg"/></a></p>
<p id="p6"><a href="http://louwrentius.com/images/fio/Random-4K-write-performance-lat.svg"><img alt="write latency" src="http://louwrentius.com/images/fio/Random-4K-write-performance-lat.svg"/></a>
<a href="http://louwrentius.com/images/fio/Random-4K-write-performance-iops.svg"><img alt="write iops" src="http://louwrentius.com/images/fio/Random-4K-write-performance-iops.svg"/></a>
<a href="http://louwrentius.com/images/fio/Random-4K-write-performance-bw.svg"><img alt="write bw" src="http://louwrentius.com/images/fio/Random-4K-write-performance-bw.svg"/></a></p>
<p id="p7">I also tested various chunk sizes for each RAID level. These are the results for RAID 10.</p>
<p id="p8"><a href="http://louwrentius.com/images/fio/RAID-chunk-size-and-read-performance-iops.svg"><img alt="read iops chunk" src="http://louwrentius.com/images/fio/RAID-chunk-size-and-read-performance-iops.svg"/></a>
<a href="http://louwrentius.com/images/fio/RAID-chunk-size-and-write-performance-iops.svg"><img alt="write iops chunk" src="http://louwrentius.com/images/fio/RAID-chunk-size-and-write-performance-iops.svg"/></a></p>
<p id="p9">If you don't see any images, you are not using Internet Explorer 9, or a recent version of Google Chrome, Mozilla Firefox or Apple Safari.</p>
<h3>Analysis</h3>
<p id="p10">With this kind of testing, there are so many variables that it will be difficult to make any solid observations. But these results are interesting. </p>
<p id="p11"><em>Results are in line with reality</em></p>
<p id="p12">First of all, the results do not seem unexpected. Six drives at 7200 RPM should each provide about 75 IOPS. This should result in a total of 450 IOPS for the entire array. The read performance does show exactly this kind of performance. </p>
<p id="p13">With all caching disabled, write performance is worse. And especially the RAID levels with parity (RAID 5 and RAID 6) show a significant drop in performance when it comes to random writes. RAID 6 write performance got so low and erratic that I wonder if there is something wrong with the driver or the setup. Especially the I/O latency is off-the-charts with RAID 6, so there must be something wrong. </p>
<p id="p14"><em>Read performance is equal for all RAID levels</em></p>
<p id="p15">However, the most interesting graphs are about IOPS and latency. Read performance of all different RAID arrays is almost equal. RAID 10 seems to have the upper hand in all read benchmarks. I'm not sure why this is. Both bandwidth and latency are better than the other RAID levels. I'm really curious about a good technical explanation about why this should be expected. </p>
<p id="p16">RAID 0 is not something that should be used in a production environment, but it is included to provide a comparison for the other RAID levels. The IOPS graph regarding write performance is most telling. With RAID 10 using 6 drives, you only get the effective IOPS of 3 drives, thus about 225 IOPS. This is exactly what the graph is showing us. </p>
<p id="p17"><em>Raid with parity suffers regarding write performance</em></p>
<p id="p18">RAID 5 needs four write I/Os for every application-level write request. So with 6 x 75 = 450 IOPS divided by 4, we get 112,5 IOPS. This is also on par with the graph. This is still ok, but notice the latency: it is clearly around 40 milliseconds, whereas 20 milliseconds is the rule of thumb where performance will start to significantly degrade.</p>
<p id="p19">RAID 6 needs six write I/Os for every application-level write request. So with 450 IOPS total, divided by 6, we only have single-disk performance of 75 IOPS. If we average the line, we do approximately get this performance, but the latency is so erratic that it would not be usable.</p>
<p id="p20"><em>RAID chunk size and performance</em></p>
<p id="p21">So I was wondering if the RAID array chunk size does impact random I/O performance. It seems not. </p>
<h3>Conclusion</h3>
<p id="p22">Overall, the results seem to indicate that the actual testing itself is realistic. We do get figures that are in tune with theoretical results. </p>
<p id="p23">The erratic RAID 6 write performance would need a thorougher explanation, one that I can't give. </p>
<p id="p24">Based on the test results, it seems that random I/O performance for a single test file is not affected by the chunk size or stripe size of an RAID array.</p>
<p id="p25">The results show to me that my benchmarking method provides a nice basis for further testing. </p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Statistics showing relevance of caching proxy]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2012/12/statistics-showing-relevance-of-caching-proxy/" />
    <id>http://louwrentius.com/blog/2012/12/statistics-showing-relevance-of-caching-proxy/</id>
    <updated>2012-12-18T01:00:00Z</updated>
    <published>2012-12-18T01:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Proxy" />
    <summary type="html"><![CDATA[Statistics showing relevance of caching proxy]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2012/12/statistics-showing-relevance-of-caching-proxy/"><![CDATA[<p id="p1">In this day and age of dynamic web content, how relevant can a caching proxy server be? I believe that the answer could be: quite!</p>
<p id="p2">I have installed a caching proxy server based on Squid, which is now used within my company. It also does content scanning using <a href="http://squidclamav.darold.net">squidclamav</a> and Clamav. I wrote an <a href="http://louwrentius.com/blog/2012/08/setting-up-a-squid-proxy-with-clamav-anti-virus-using-c-icap/">article</a> about how to setup such a content scanning proxy.</p>
<p id="p3">The thing is that I didn't much care for the actual caching functionality of Squid, I deemed the content-scanning part more interesting. But I'm quite pleased with the actual caching hit ratio. </p>
<p id="p4"><img alt="proxy stats" src="http://louwrentius.com/images/proxyisrelevant.gif"/></p>
<p id="p5">It seems that we have a hit ratio between 20% to 25% and that is more than I expected. Most content is dynamic in nature, so I would expect that most content
is not cached but it seems that there is still quite some data that can be cached. This must also improve the end-user surfing experience as latency for downloading content should be reduced. </p>
<p id="p6">Of course, this is just a sample for the last hour. However, multiple measurements at different moments yield similar results. </p>
<p id="p7">I think this result proves that a caching proxy server is still relevant, especially if you don't have a fast internet connection. If you do, you can still improve the overall browsing experience due to the fact that data is cached. </p>
<p id="p8">There is a caveat: the proxy server itself also introduces latency. I haven't performed a side-by-side comparison and measured actual responsiveness of browsing with or without a proxy. </p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Understanding IOPS, latency and storage performance]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2012/11/understanding-iops,-latency-and-storage-performance/" />
    <id>http://louwrentius.com/blog/2012/11/understanding-iops,-latency-and-storage-performance/</id>
    <updated>2012-11-25T21:00:00Z</updated>
    <published>2012-11-25T21:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Storage" />
    <summary type="html"><![CDATA[Understanding IOPS, latency and storage performance]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2012/11/understanding-iops,-latency-and-storage-performance/"><![CDATA[<p id="p1">When most people think about storage performance, they think about throughput. But throughput is similar to the top speed of a car. In reality, you will almost never reach the top speed of your car (unless you are living in Germany). And that's fine, because in most situations that's not so relevant. </p>
<p id="p2">For instance, properties like how fast your car accelerates and how well the car handles bends and corners are often more important than its top speed. And this example also holds for storage performance. </p>
<p id="p3">Most people know that SSDs are often way faster than regular mechanical hard drives. But it's not about the throughput of these devices. Its all about Input/Output operations per second (IOPS). If you can handle a high number of IOPS, that is great for real life application performance. But IOPS does not tell you the whole story. To be more precise: IOPS is a meaningless figure unless tied to an average latency and a certain request size (how much data is processed with the I/O). Let's first focus on IOPS and Latency and talk about the request size later.</p>
<p id="p4"><img alt="latency" src="http://louwrentius.com/images/io03.png"/></p>
<p id="p5">Latency is how fast a single I/O-request is handled. This is very important, because a storage subsystem that can handle 1000 IOPS with an average latency of 10ms may get better application performance than a subsystem that can handle 5000 IOPS with an average latency of 50ms. Especially if the application is sensitive to latency, such as a database service. </p>
<p id="p6">This is a very important thing to understand: how IOPS and latency relate to each other. Here, the car analogy probably breaks down. We need a different one to better understand what is going on. So picture you are in a super market. This is a special supermarket, where customers (I/Os) are served by cashiers (disk) at an average speed of 10ms. If you divide one second with 10ms, we understand that this cashier can handle 100 customers per second. But only one at a time, in succession. </p>
<p id="p7"><img alt="serial" src="http://louwrentius.com/images/io04.png"/></p>
<p id="p8">It is clear that although the cashier can handle 100 customers per second, he cannot handle them at the same time! So when a customer arrives at the register, and within those 10ms handling time, a second customer arrives, that customer must wait. Once the waiting customer is handled by the cashier, handling of that customer still takes just 10ms, but the overal processing time was maybe 15ms or worst case (two customers arriving at the same time) even 20ms.</p>
<p id="p9"><img alt="queue" src="http://louwrentius.com/images/io05.png"/></p>
<p id="p10">So it is very important to understand that although a disk may handle individual I/Os with an average latency of 10ms, the actual latency as perceived by the application may be higher as some I/Os must wait in line. </p>
<p id="p11">This example also illustrates that waiting in line increases the latency for a particular I/O to be handled. So if you increase the Read I/O queue, you will notice that the average latency will increase. Longer queues will mean higher latency, but also more IOPS!!!</p>
<p id="p12"><img alt="queue 4" src="http://louwrentius.com/images/io02.png"/></p>
<p id="p13">How is that possible? How can a disk drive suddenly do more random IOPs at the cost of latency? The trick lies in that the storage subsystem can be smart and look at the queue and then order the I/Os in such a way that the actual access pattern to disk will be more serialised. So a disk can serve more IOPS/s at the cost of an increase in average latency. Depending on the achieved latency and the performance requirements of the application layer, this can be acceptable or not.</p>
<p id="p14">In future blog posts I will show some performance benchmarks of a single drive to illustrate these examples.</p>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Linux: get a list of al disks and their size]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2012/11/linux:-get-a-list-of-al-disks-and-their-size/" />
    <id>http://louwrentius.com/blog/2012/11/linux:-get-a-list-of-al-disks-and-their-size/</id>
    <updated>2012-11-25T02:00:00Z</updated>
    <published>2012-11-25T02:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Linux" />
    <summary type="html"><![CDATA[Linux: get a list of al disks and their size]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2012/11/linux:-get-a-list-of-al-disks-and-their-size/"><![CDATA[<p id="p1">To get a list of all disk drives of a Linux system, such as this:</p>
<pre><code>Disk /dev/md0: 58.0 GB
Disk /dev/md1: 2015 MB
Disk /dev/md5: 18002.2 GB
Disk /dev/sda: 60.0 GB
Disk /dev/sdb: 60.0 GB
Disk /dev/sdc: 1000.1 GB
Disk /dev/sdd: 1000.1 GB
Disk /dev/sde: 1000.1 GB
Disk /dev/sdf: 1000.1 GB
Disk /dev/sdg: 1000.1 GB
Disk /dev/sdh: 1000.1 GB
Disk /dev/sdi: 1000.1 GB
Disk /dev/sdj: 1000.1 GB
Disk /dev/sdk: 1000.1 GB
Disk /dev/sdl: 1000.1 GB
Disk /dev/sdm: 1000.1 GB
Disk /dev/sdn: 1000.1 GB
Disk /dev/sdo: 1000.1 GB
Disk /dev/sdp: 1000.1 GB
Disk /dev/sdq: 1000.1 GB
Disk /dev/sdr: 1000.1 GB
Disk /dev/sds: 1000.2 GB
Disk /dev/sdt: 1000.2 GB
Disk /dev/sdu: 1000.2 GB
Disk /dev/sdv: 1000.2 GB
</code></pre>
<p id="p2">You can use the following command:</p>
<pre><code>#!/bin/bash
for x in `cat /proc/diskstats | grep -o 'sd.\|hd.\|md.' | sort -u`
do 
    fdisk -l /dev/$x 2&gt;/dev/nul| grep 'Disk /' | cut -d "," -f 1 
done
</code></pre>]]></content>
  </entry>
  <entry>
    <author>
      <name>Louwrentius</name>
      <uri>http://louwrentius.com/blog</uri>
    </author>
    <title type="html"><![CDATA[Why VMware vSphere replication is changing the game]]></title>
    <link rel="alternate" type="text/html" href="http://louwrentius.com/blog/2012/11/why-vmware-vsphere-replication-is-changing-the-game/" />
    <id>http://louwrentius.com/blog/2012/11/why-vmware-vsphere-replication-is-changing-the-game/</id>
    <updated>2012-11-12T23:00:00Z</updated>
    <published>2012-11-12T23:00:00Z</published>
    <category scheme="http://louwrentius.com/blog" term="Storage" />
    <category scheme="http://louwrentius.com/blog" term="VMware" />
    <summary type="html"><![CDATA[Why VMware vSphere replication is changing the game]]></summary>
    <content type="html" xml:base="http://louwrentius.com/blog/2012/11/why-vmware-vsphere-replication-is-changing-the-game/"><![CDATA[<p id="p1">If you are running a serious VMware environment, chances are you do have a SAN. Often with smaller setups, many people do employ multiple VMware hosts, but the SAN is a single point of failure.</p>
<p id="p2">SANs are often fully redundant devices, with redundant PSUs, storage controllers, network links and RAID arrays.  But with all that redundancy build in, they still fail. I've seen it happen and a failing SAN is the worst.</p>
<p id="p3">So I'd rather have two cheap entry level SANs if possible than just a single big one and keeping my fingers crossed that they won't fail.</p>
<p id="p4">A redundant SAN environment where you basically deploy two separate SAN devices with their own storage needs a replication setup. And replication between SAN environments needs often extra licences or more expensive setups. And the replication mechanism must play well with your virtualisation layer, such as VMware.</p>
<p id="p5">But the fun thing is that VMware made everything way simpler by integrating their own <a href="http://www.google.nl/url?sa=t&amp;rct=j&amp;q=vmware%20vsphere%20replication%205.1&amp;source=web&amp;cd=1&amp;cad=rja&amp;sqi=2&amp;ved=0CCYQFjAA&amp;url=http%3A%2F%2Fwww.vmware.com%2Ffiles%2Fpdf%2Ftechpaper%2FIntroduction-to-vSphere-Replication.pdf&amp;ei=0muhUPayNMfe4QS2woGIDg&amp;usg=AFQjCNERmOjUUuCjMaNGBAU9RZ4--By4JQ">storage replication</a> into their vSphere product. I have no experience whatsoever with VMware's new build-in replication feature. But I believe that it is significant. </p>
<p id="p6"><a href="http://pubs.vmware.com/vsphere-51/topic/com.vmware.ICbase/PDF/vsphere-replication-51-admin.pdf">Replication</a> is a new feature introduced in VMware vSphere 5.1 that is now part of the vSphere Essentials Plus Kit and vSphere Standard. So if you start with two or three VMware hosts and two entry-level SAN devices, you can be quite redundant and can have a fully redundant setup. And that will cost you around 3800 Euro ~ 4800 US dollar. </p>
<p id="p7">The Essentials Plus Kit is a nice environment for smaller companies, but license-wise, it does not scale as you are stuck with a maximum of 6 physical CPUs and a maximum of three hosts. However it seems that when you need to expand beyond that capacity, you can trade in your existing license and obtain a discount when upgrading to - for example - vSphere Standard or Enterprise.</p>
<p id="p8">The most significant thing about the build-in replication is that it does not matter any more what you use for your storage backend. If you use two entirely different devices from different vendors, that's OK. Because VMware handles all the replication stuff. Those SAN devices become just dumb storage boxes. Most of us just can configure whatever does support iSCSI.</p>
<p id="p9">You could even try and be cheap and setup your own <a href="http://louwrentius.com/blog/2009/07/20-disk-18-tb-raid-6-storage-based-on-debian-linux/">homegrown storage box</a>es. 
It may not have all the cool features of a true SAN, but at least you have redundant storage. </p>
<p id="p10">I'm really curious about this feature and I hope it works well. I'm seriously considering deploying this for the VMware setup of the company I currently work for. It does however require an extra external host that manages the actual replication, which may add to the cost. </p>
<p id="p11">Any comments are welcome. </p>]]></content>
  </entry>
</feed>
