<?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>From Zero To One &#187; Linux</title>
	<atom:link href="http://www.cromis.net/blog/category/os/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cromis.net/blog</link>
	<description>A blog about Delphi programming and all things technical</description>
	<lastBuildDate>Mon, 25 Jul 2011 19:27:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>What do you do when your VMware server dies?</title>
		<link>http://www.cromis.net/blog/2010/01/what-do-you-do-when-your-vmware-server-dies/</link>
		<comments>http://www.cromis.net/blog/2010/01/what-do-you-do-when-your-vmware-server-dies/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 11:26:40 +0000</pubDate>
		<dc:creator>Iztok Kacin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Crash]]></category>
		<category><![CDATA[Failure]]></category>
		<category><![CDATA[Recovery]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Virtual disk failure]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.cromis.net/blog/?p=539</guid>
		<description><![CDATA[You start panicking of course Ok seriously now. You try to fix the problem first. If that doesn&#8217;t work then you bring the server back from the backups you are so regularly making. You are aren&#8217;t you? And you always make sure that your backup plan is actually working. Don&#8217;t you? About a week ago [...]]]></description>
			<content:encoded><![CDATA[<p>You start panicking of course <img src='http://www.cromis.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: center;"><img class=" aligncenter" title="Panic" src="http://charlesgoyette.com/uploaded_images/panic-705224.png" alt="Panic Button" width="332" height="400" /></p>
<p align="justify">Ok seriously now. You try to fix the problem first. If that doesn&#8217;t work then you bring the server back from the backups you are so regularly making. You are aren&#8217;t you? And you always make sure that your backup plan is actually working. Don&#8217;t you?</p>
<p align="justify">About a week ago my virtual Debian server on which this blog is hosted stopped running. The VMware console reported a virtual disk error. I had to shutdown the machine and when I tried to boot it up again it wouldn&#8217;t start. There was an error on one of the virtual disks.  Hm so what to do? I had a fresh, few days old backup, so I went for that. But first, let me tell you how my virtual machines are set up. I have a Debian host OS (stable Lenny currently) and on top of that I have v VMware server 2.0.1. Then inside I have a virtual Debian server where this blog is hosted alongside my whole code repository. I have a couple of other virtual machines for development and testing (Windows and Linux). All important virtual machines are backup-ed regularly to the NAS machine. I have written about that a while ago <a title="Backup VM machine" href="http://www.cromis.net/blog/2009/09/backup-your-linux-debian-virtual-machines-vmware/">here </a>and <a title="FreeNAS" href="http://www.cromis.net/blog/2009/07/do-you-need-a-free-nas-network-attached-storage/">here</a>.</p>
<p align="justify">Ok so I took my last backup which is a tar that is further compressed with 7-zip for reducing size. At first I only had a tar archive. I tested that and it worked just fine. Then at some point I used 7-zip over the tar and because I lacked time I did not test the archives. No errors were reported so I assumed all is well. What a mistake. All 7-zip archives were partially corrupted. But thanks to Sheree dumb luck I could get the VMDK file that was corrupted from the archive. I replaced that file on the virtual machine (the size was the same) and the server booted again. Hooray! Well not quite. Everything was working but SVN was reporting errors. It could not open the database. After investigating the Apache logs (I use DAV SVN and https) it seemed that &#8220;db/current&#8221;  file was corrupted. This file holds the info about the last (current) revision in the SVN. I tried &#8220;svnadmin recover&#8221; to no avail. I tried removing the file and repeating the recover which then failed elsewhere.</p>
<p align="justify">After searching the web and finding nothing I almost gave up. But the I found a little gem on one of the forums. A little Python script that solved my problems. I am posting it here if anybody else will have the same misfortune. If the author finds this offensive I will remove the script.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> dec_to_36<span style="color: black;">&#40;</span>dec<span style="color: black;">&#41;</span>:
  key = <span style="color: #483d8b;">'0123456789abcdefghijklmnopqrstuvwxyz'</span>
  result = <span style="color: #483d8b;">''</span>
  <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
    div = dec / <span style="color: #ff4500;">36</span>
    mod = dec <span style="color: #66cc66;">%</span> <span style="color: #ff4500;">36</span>
    dec = div
    result = key<span style="color: black;">&#91;</span>mod<span style="color: black;">&#93;</span> + result
    <span style="color: #ff7700;font-weight:bold;">if</span> dec == <span style="color: #ff4500;">0</span>:
      <span style="color: #ff7700;font-weight:bold;">break</span>
  <span style="color: #ff7700;font-weight:bold;">return</span> result
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">re</span>, <span style="color: #dc143c;">sys</span>
&nbsp;
repo_path = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
rev_path = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>repo_path, <span style="color: #483d8b;">'db'</span>, <span style="color: #483d8b;">'revs'</span><span style="color: black;">&#41;</span>
current_path = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>repo_path, <span style="color: #483d8b;">'db'</span>, <span style="color: #483d8b;">'current'</span><span style="color: black;">&#41;</span>
&nbsp;
id_re = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^id:<span style="color: #000099; font-weight: bold;">\ </span>([a-z0-9]+)<span style="color: #000099; font-weight: bold;">\.</span>([a-z0-9]+)<span style="color: #000099; font-weight: bold;">\.</span>r([0-9]+).*'</span><span style="color: black;">&#41;</span>
&nbsp;
max_node_id = <span style="color: #ff4500;">0</span>
max_copy_id = <span style="color: #ff4500;">0</span>
max_rev_id = <span style="color: #ff4500;">0</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> rev <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>rev_path<span style="color: black;">&#41;</span>:
  f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>rev_path, rev<span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> f:
    m = id_re.<span style="color: black;">match</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> m:
      node_id = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">36</span><span style="color: black;">&#41;</span>
      copy_id = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">36</span><span style="color: black;">&#41;</span>
      rev_id = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>
&nbsp;
      <span style="color: #ff7700;font-weight:bold;">if</span> copy_id <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> max_copy_id:
        max_copy_id = copy_id
&nbsp;
      <span style="color: #ff7700;font-weight:bold;">if</span> node_id <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> max_node_id:
        max_node_id = node_id
&nbsp;
      <span style="color: #ff7700;font-weight:bold;">if</span> rev_id <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> max_rev_id:
        max_rev_id = rev_id
&nbsp;
f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>current_path, <span style="color: #483d8b;">'w+b'</span><span style="color: black;">&#41;</span>
f.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%d %s %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>max_rev_id, dec_to_36<span style="color: black;">&#40;</span>max_node_id+<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>,
                        dec_to_36<span style="color: black;">&#40;</span>max_copy_id+<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p align="justify">This script is a little gem. It goes through all your revisions and reconstructs the &#8220;db/current&#8221; file. It worked. I lost last 4 or 5 revisions, but that was easily solved as I had them on my computer naturally. So all was well, I made backup of the current state and I was happy. Well that was another false sense of security.</p>
<p align="justify">Last night the blog went down again. This time it could not access the database. It showed that the file system inside the virtual machine was corrupted. I ran &#8220;fsck&#8221; but frankly I was prepared for the worst. To my surprise all errors were corrected and the server is once again running happily. I am suspecting that the physical hard drive of the host is slowly dying so I will migrate to a new drive in the future. But for now I am truly impressed about how sturdy Debian is. The host and the virtual server both run for about 3 years now without a reinstall. Both were migrated from Etch to Lenny (two stable releases) in live mode (no shutdown) and have survived hardware change (CPU, motherboard and RAM) and file system corruptions. Now do that to your Windows if you dare <img src='http://www.cromis.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cromis.net/blog/2010/01/what-do-you-do-when-your-vmware-server-dies/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Upgrading your stable Debian</title>
		<link>http://www.cromis.net/blog/2009/09/upgrading-your-stable-debian/</link>
		<comments>http://www.cromis.net/blog/2009/09/upgrading-your-stable-debian/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:30:29 +0000</pubDate>
		<dc:creator>Iztok Kacin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[apt-pining]]></category>
		<category><![CDATA[bigmem]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[sources]]></category>
		<category><![CDATA[stable]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.cromis.net/blog/?p=330</guid>
		<description><![CDATA[Do you know how to upgrade you stable Debian release? I am not talking about upgrading packages, but upgrading your Debian to a new stable release when that comes around. Typical Debian installation has &#8220;sources.list&#8221; like that deb http://ftp.si.debian.org/debian/ lenny main deb-src http://ftp.si.debian.org/debian/ lenny main &#160; deb http://security.debian.org/ lenny/updates main contrib deb-src http://security.debian.org/ lenny/updates main [...]]]></description>
			<content:encoded><![CDATA[<p>Do you know how to upgrade you stable Debian release? I am not talking about upgrading packages, but upgrading your Debian to a new stable release when that comes around. Typical Debian installation has &#8220;sources.list&#8221; like that</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> lenny main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> lenny main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> lenny<span style="color: #000000; font-weight: bold;">/</span>updates main contrib
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> lenny<span style="color: #000000; font-weight: bold;">/</span>updates main contrib</pre></div></div>

<p>It has a distrubution name (lenny for instance) in it. This insures that we cannot accidentally update it with some other version packages. But if that is not a concern and if you want go to a new stable version as it comes out just change it like this</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> stable main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> stable main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> stable<span style="color: #000000; font-weight: bold;">/</span>updates main contrib
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> stable<span style="color: #000000; font-weight: bold;">/</span>updates main contrib</pre></div></div>

<p>This tells the apt installer to use the stable packages (the latest) instead of specific version of stable packages. This means that when the stable release changes, the installer will automatically use the new packages.</p>
<p>There is another useful technique involved called apt-pinning. Do you get annoyed sometimes because the stable release becomes outdated so fast and some packages are not available in it? Well, apt pinning changes that. It enables you to also install packages from testing and release, but favors packages in the stable release if available. Your &#8220;sources.list&#8221; should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#Stable</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> stable main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> stable main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> stable<span style="color: #000000; font-weight: bold;">/</span>updates main contrib
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> stable<span style="color: #000000; font-weight: bold;">/</span>updates main contrib
&nbsp;
<span style="color: #666666; font-style: italic;">#Testing</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> testing main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> testing main
&nbsp;
<span style="color: #666666; font-style: italic;">#Unstable</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> unstable main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>ftp.si.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> unstable main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>debian.supermind.nl<span style="color: #000000; font-weight: bold;">/</span> current main
deb http:<span style="color: #000000; font-weight: bold;">//</span>debian.supermind.nl<span style="color: #000000; font-weight: bold;">/</span> nightly main</pre></div></div>

<p>As you can see this enable apt installer to read the packages from all three branches (stable, testing, unstable). You will also need a &#8220;preferences&#8221; file in apt directory, which tells apt which packages have the priority. It should look something like this</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Package: <span style="color: #000000; font-weight: bold;">*</span>
Pin: release <span style="color: #007800;">a</span>=stable
Pin-Priority: <span style="color: #000000;">700</span>
&nbsp;
Package: <span style="color: #000000; font-weight: bold;">*</span>
Pin: release <span style="color: #007800;">a</span>=testing
Pin-Priority: <span style="color: #000000;">650</span>
&nbsp;
Package: <span style="color: #000000; font-weight: bold;">*</span>
Pin: release <span style="color: #007800;">a</span>=unstable
Pin-Priority: <span style="color: #000000;">600</span></pre></div></div>

<p>This is all you need. To get more information on the subject read this great article on apt-pinning:</p>
<p><a href="http://jaqque.sbih.org/kplug/apt-pinning.html">http://jaqque.sbih.org/kplug/apt-pinning.html</a></p>
<p>To upgrade just enter the following two commands in sequence.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade</pre></div></div>

<p>You need to do &#8220;dist-upgrade&#8221; instead of just &#8220;upgrade&#8221; as this insures that also the new required packages are installed. This is all there is to it. For the end let me just show what to do if you need a kernel that can use more than 4GB of memory. The following commands check if bigmem is already installed and install it if not. The example is for 2.6 version of the kernel</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">--get-selections</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> bigmem
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> linux-image-<span style="color: #000000;">2.6</span>-<span style="color: #000000;">686</span>-bigmem</pre></div></div>

<p>Again more on the subject can be found here:</p>
<p><a href="http://knowledgelayer.softlayer.com/questions/294/Debian+isn%27t+showing+all+my+ram!">http://knowledgelayer.softlayer.com/questions/294/Debian+isn%27t+showing+all+my+ram!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cromis.net/blog/2009/09/upgrading-your-stable-debian/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Backup your linux (Debian) virtual machines (VMWare)</title>
		<link>http://www.cromis.net/blog/2009/09/backup-your-linux-debian-virtual-machines-vmware/</link>
		<comments>http://www.cromis.net/blog/2009/09/backup-your-linux-debian-virtual-machines-vmware/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 10:26:11 +0000</pubDate>
		<dc:creator>Iztok Kacin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[TAR]]></category>
		<category><![CDATA[Virtual]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.cromis.net/blog/?p=317</guid>
		<description><![CDATA[In the last post I wrote about a free NAS solution for you home (or office) backup strategy. I wrote about the ease of setting it up and how I searched for a free and simple way to backup my windows machines. I am stil using GFI Backup 2009. The only change is, that I [...]]]></description>
			<content:encoded><![CDATA[<p>In the last <a href="http://www.cromis.net/blog/2009/07/do-you-need-a-free-nas-network-attached-storage/">post</a> I wrote about a free NAS solution for you home (or office) backup strategy. I wrote about the ease of setting it up and how I searched for a free and simple way to backup my windows machines. I am stil using <a title="GFI Backup 2009" href="http://www.gfi.com/backup-hm">GFI Backup 2009</a>. The only change is, that I am storing my last 3 complete backups instead of incremental backups. The reason for that is, that I feel more secure this way. If the last backup is corrupted I still have two good backups and I do not have to worry how I will put the increments back together.</p>
<p>Now I would like to show, how I made the backups of my virtual machine. The host is Debian OS (Lenny) and on top of that I have a VMWare server 1.0.9 with several virtual machines running inside. The beauty of this is, that in order to backup the data, I just need to backup the whole virtual machine. No complicated plans and scripts to backup databases, SVN repositories etc. Just stop the virtual machine (you have to stop it first as it is the safest way and the data is not corrupted if you do this) and tar the whole directory to the NAS. In the beggining I had and idea of using rsync to do incremental backups, but I changed my mind. I just followed the windows phlosophy. Store the last three backups of every virtual machine and that is it. This is how I did it.</p>
<p>As I already have a Samba share configured on the NAS I just installed the Samba client</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> smbfs</pre></div></div>

<p>then i added the Samba client to modules</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'smbfs'</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>modules</pre></div></div>

<p>and to fstab, so it will be mounted on each boot</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">//</span>NASServer<span style="color: #000000; font-weight: bold;">/</span>backups  <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>backups  smbfs  defaults,user,<span style="color: #007800;">password</span>=  <span style="color: #000000;">0</span>  <span style="color: #000000;">0</span></pre></div></div>

<p>I did not need username and password because NAS in protected only by IP&#8217;s that can connect to it. Because I have it behind a router and  a firewall, inside LAN and I am the only one using it, there is no need for any other protection. Now all that is left, is the script to backup VM machines on a weekly basis. I tried using ZIP at first to compress them, but found out that it cannot handle files larger that 2GB, so I swithed to TAR. This is the script</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Backup the virtual machines of choic to a samba share</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">CurrentDate</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>
vmrun stop <span style="color: #ff0000;">&quot;/var/vm/Ubuntu 7.10 Server/Ubuntu.vmx&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cvvf</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span>CROMIS<span style="color: #000000; font-weight: bold;">/</span>VM_Cromis_<span style="color: #007800;">$CurrentDate</span>.zip <span style="color: #ff0000;">&quot;/var/vm/Ubuntu 7.10 Server&quot;</span>
vmrun start <span style="color: #ff0000;">&quot;/var/vm/Ubuntu 7.10 Server/Ubuntu.vmx&quot;</span></pre></div></div>

<p>This is the sample of a single VM being archive. What is missing is the rotation of the last 3 backups, but that I still have to implement. No a big deal though. So in short this is it. Simple and efficient. But I would like to point out two problem I encountered on the way to this solution and are both related to the new Lenny Debian distribution.</p>
<p>The first problem is that they changed the default ehternet interface from eth0 to eth1. I don&#8217;t know who has this &#8220;brilliant&#8221; idea, but it took me a lot of time to figure out why I can&#8217;t connect to my server anymore. I will show the way to upgrade between stable releases in the next post, bust let me just say that changes like that are not very smart. And the other problem was that VMWare server was not working anymore with the new 2.6.24 kernel. I tried everything, but could not make it work. I managed to rebuild the VMWare core modules with the <a title="WMVare-any-any patches" href="http://communities.vmware.com/message/76957">WMVare-any-to-any-update patches</a>, but the VM machines wouldn&#8217;t start anymore. So I was forced to go back to 2.6.18 version of the kernel. There all is fine. Why don&#8217;t I upgrade to WMVare server 2.x you wonder. Because the removed the console and left us with java bloated web interface that uses Tomcat. I read a lot of negative reviews and I am not prepared to change my smooth working 1.0.9 version.</p>
<p>Edit: I now use 7zip on top of  the tar archives as this greatly reduces the size of the archived files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cromis.net/blog/2009/09/backup-your-linux-debian-virtual-machines-vmware/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Do you need a free NAS (Network Attached Storage)?</title>
		<link>http://www.cromis.net/blog/2009/07/do-you-need-a-free-nas-network-attached-storage/</link>
		<comments>http://www.cromis.net/blog/2009/07/do-you-need-a-free-nas-network-attached-storage/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 04:17:52 +0000</pubDate>
		<dc:creator>Iztok Kacin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Bakcup]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://www.cromis.net/blog/?p=307</guid>
		<description><![CDATA[For a long time a have been avoiding the centralization of my backup plans. In our house, we have 2 desktop computers, one laptop and one server with several virtual machines running on it (including this blog). So there is a need for a network accessible storage device that would serve as a backup medium [...]]]></description>
			<content:encoded><![CDATA[<p>For a long time a have been avoiding the centralization of my backup plans. In our house, we have 2 desktop computers, one laptop and one server with several virtual machines running on it (including this blog). So there is a need for a network accessible storage device that would serve as a backup medium and also as a place to dump rarely needed files.</p>
<p>I while ago I found <a title="FreeNAS" href="http://www.freenas.org/">FreeNAS</a> an excellent Linux based NAS solution. It can be booted as a live CD with a floppy, USB stick or CF card as a medium to store settings in XML format. But then I did not have the time to play with it and also my old <a title="VIA" href="http://www.via.com.tw/en/products/embedded/boards/index.jsp">VIA</a> based mini server died on me. This week I has enough of waiting. I cannot play with my data, after all if I am not responsible about my data who will be (I make a living out of it after all). So I bought an old Pentium 3 based desktop with 256MB of RAM for 50 EUR. It also has an 1.44 floppy which is perfect in this case. I threw out the 10GB hard drive that was in it and plugged in my 500GB IDE disk I bought a while ago for this purposes. Then I prepared for an afternoon of learning, customizing etc&#8230;</p>
<p>Well it took me 5-10 minutes and I had it running. The FreeNAS is really powerfull and simple to use. You just boot from live CD, assign an interface (LAN card) and IP and you are ready to go. Through a clear web interface you assign a hard drive, format it and mount a partition. Then you enable SAMBA and RSYNC and you are ready to copy data. There is also support for FTP, Unison, NFS, AFP, SSH and even torrents. You can also schedule hard drive tests via S.M.A.R.T, encrypt your data, set access rights and much, much more.</p>
<p>So when this was done (the longest task was finding a 1.44 floppy that didn&#8217;t have bad sectors, which was quite a chalenge with all this old floppies around) I tried to find a good windows backup tool (linux has rsync). I do not want to install <a title="Cygwin" href="http://www.cygwin.com/">Cygwin</a> because I always have a felling that it is an unclean installation (and I don&#8217;t have time to play with it to get the minimum install just to support rsync). In the end I ended with <a title="GFI Backup 2009" href="http://www.gfi.com/backup-hm">GFI Backup 2009</a> and so far I am happy with it. I supports incremental backups and can compress the backup to single archive. And this is pretty much all I need.</p>
<p>I also considered some other solutions. <a title="Cobian" href="http://www.educ.umu.se/~cobian/cobianbackup.htm">Cobian</a>, <a title="FileHamster" href="http://www.mogware.com/FileHamster/">FileHamster</a>, <a title="Unison" href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a> and few others but I will stick with GFI for now on Windows.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cromis.net/blog/2009/07/do-you-need-a-free-nas-network-attached-storage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chrony: If you need a simple NTP daemon</title>
		<link>http://www.cromis.net/blog/2009/07/chrony-if-you-need-a-simple-ntp-daemon/</link>
		<comments>http://www.cromis.net/blog/2009/07/chrony-if-you-need-a-simple-ntp-daemon/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 07:46:47 +0000</pubDate>
		<dc:creator>Iztok Kacin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[NTP]]></category>
		<category><![CDATA[synchronize]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.cromis.net/blog/?p=281</guid>
		<description><![CDATA[Chrony is a small NTP daemon that synchronizes the local time against a number of remote servers. To get it just do (debian) apt-get install chrony The website is at: http://chrony.sunsite.dk/]]></description>
			<content:encoded><![CDATA[<p>Chrony is a small NTP daemon that synchronizes the local time against a number of remote servers. To get it just do (debian)</p>
<p><em>apt-get install chrony</em></p>
<p>The website is at: <a href="http://chrony.sunsite.dk/">http://chrony.sunsite.dk/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cromis.net/blog/2009/07/chrony-if-you-need-a-simple-ntp-daemon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
