<?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>Steve Glendinning &#187; Debian</title>
	<atom:link href="http://www.steveglendinning.com/tag/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.steveglendinning.com</link>
	<description></description>
	<lastBuildDate>Fri, 06 Nov 2009 10:26:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Found a new toy: sshfs</title>
		<link>http://www.steveglendinning.com/2009/11/06/found-a-new-toy-sshfs/</link>
		<comments>http://www.steveglendinning.com/2009/11/06/found-a-new-toy-sshfs/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 10:26:29 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/?p=91</guid>
		<description><![CDATA[sshfs allows you to mount a remote filesystem using nothing at the server end other than a standard ssh server]]></description>
			<content:encoded><![CDATA[<p>I just discovered sshfs.  This allows you to mount a remote filesystem using nothing at the server end other than a standard ssh server.</p>
<p>Once installer, as a non-root user you can just:</p>
<p><code>mkdir mnt<br />
sshfs username@server.domain.com:/path mnt</code></p>
<p>Then you can access it, copy files etc (both directions) as if it were a local directory</p>
<p><code>ls mnt</code></p>
<p>When finished this disconnects it:</p>
<p><code>fusermount -u mnt</code></p>
<p>Found at <a href="http://home.prea.net/hacking/X2200/NFS">http://home.prea.net/hacking/X2200/NFS</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2009/11/06/found-a-new-toy-sshfs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Time went backwards</title>
		<link>http://www.steveglendinning.com/2009/03/23/time-went-backwards/</link>
		<comments>http://www.steveglendinning.com/2009/03/23/time-went-backwards/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 10:06:42 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/?p=69</guid>
		<description><![CDATA[I just applied a hotfix to my XenSource virtual servers, which caused all the virtual machines to be suspended &#38; resumed (while the xen host rebooted).  This caused a problem on the VMs I&#8217;ve upgraded to Debian Lenny: These messages were repeatedly logged:
clocksource/0: Time went backwards: ret=18f26176a5 delta=-8292949932632971 shadow=18e9e0b4b9 offset=880c4ce
This message wasn&#8217;t &#8220;harmless&#8221; &#8211; it [...]]]></description>
			<content:encoded><![CDATA[<p>I just applied a hotfix to my XenSource virtual servers, which caused all the virtual machines to be suspended &amp; resumed (while the xen host rebooted).  This caused a problem on the VMs I&#8217;ve <a href="http://www.steveglendinning.com/2009/02/15/upgrading-xensource-debian-etch-guests-to-lenny/">upgraded to Debian Lenny</a>: These messages were repeatedly logged:</p>
<blockquote><p>clocksource/0: Time went backwards: ret=18f26176a5 delta=-8292949932632971 shadow=18e9e0b4b9 offset=880c4ce</p></blockquote>
<p>This message wasn&#8217;t &#8220;harmless&#8221; &#8211; it caused TCP connections to break, so ssh was practically unusable.</p>
<p>The immediate solution: using the XenCenter console, forcefully reboot the affected VM.  That&#8217;s &#8220;force shutdown&#8221;, followed by &#8220;start&#8221;.  I tried the simple &#8220;reboot&#8221; option, but it wouldn&#8217;t shut down (probably because it was confused over the time).  VMs are now back up and there&#8217;s no sign of time going backwards.</p>
<p>It seems this was triggered by suspending &amp; resuming machines running the Debian Lenny kernel.  Other VMs which are still running the 2.6.18 based XenSource kernels survived suspend/resume ok.</p>
<p>The actual cause is documented <a href="http://wiki.debian.org/Xen#A.27clocksource.2BAC8-0.3ATimewentbackwards.27">here</a>, <a href="http://www.mail-archive.com/debian-kernel@lists.debian.org/msg42367.html">here</a>, <a href="http://lists.bitfolk.com/lurker/message/20090311.001656.36280d5b.en.html">here</a> &amp; <a href="http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1098">here</a>.  I think I&#8217;ll be following that advice and decoupling my VM clocks from the host (using NTP to keep them all in sync the old-fashioned way).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2009/03/23/time-went-backwards/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WCCP with Cisco 877 and Squid</title>
		<link>http://www.steveglendinning.com/2009/03/17/wccp-with-cisco-877-and-squid/</link>
		<comments>http://www.steveglendinning.com/2009/03/17/wccp-with-cisco-877-and-squid/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 11:23:06 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/?p=67</guid>
		<description><![CDATA[I just upgraded my Cisco 877 to the latest 12.4(24)T IOS, so I thought I&#8217;d have another go at getting WCCP to work.  Good news: it works!
Here&#8217;s my working configuration on the Cisco 877:
ip cef
ip wccp web-cache
interface Vlan1
ip wccp web-cache redirect in
This tells the router that web traffic coming into the Vlan1 interface is a [...]]]></description>
			<content:encoded><![CDATA[<p>I just upgraded my Cisco 877 to the latest 12.4(24)T IOS, so I thought I&#8217;d have another go at <a title="transparent webcaching using policy caching" href="http://www.steveglendinning.com/2007/10/28/transparent-webcaching-on-a-cisco-877">getting WCCP to work</a>.  Good news: it works!</p>
<p>Here&#8217;s my working configuration on the Cisco 877:</p>
<blockquote><p>ip cef<br />
ip wccp web-cache</p>
<p>interface Vlan1<br />
ip wccp web-cache redirect in</p></blockquote>
<p>This tells the router that web traffic coming into the Vlan1 interface is a candidate for caching.  With WCCP, web-caches register themselves with the router, then the router forwards requests to them.  This means that if the cache disappears, the router will forward web requests directly to the internet.</p>
<p>I&#8217;m using Debian, so I added this to /etc/network/interfaces (replace 1.2.3.4 with the router identifier shown on the cisco by &#8220;show ip wccp&#8221;.  In my case this is the external internet-facing IP address):</p>
<blockquote><p>auto gre1<br />
iface gre1 inet static<br />
address 127.0.0.2<br />
netmask 255.255.255.255<br />
pre-up ip tunnel add gre1 mode gre remote 1.2.3.4 local 10.0.20.1 dev eth1<br />
post-down ip tunnel del gre1</p></blockquote>
<p>And I added this line to my firewall script.  You could add it to rc.local if you don&#8217;t have anywhere else to put it:</p>
<blockquote><p>iptables -t nat -A PREROUTING -i gre1 -d 0/0 -p tcp &#8211;dport 80 -j DNAT &#8211;to-destination 10.0.20.1:3128</p></blockquote>
<p>The only thing left now is the squid configuration.  I specified the internal address of the cisco 877 here (10.0.20.254):</p>
<blockquote><p>wccp2_router 10.0.20.254<br />
wccp2_rebuild_wait on<br />
wccp2_forwarding_method 1<br />
wccp2_return_method 1<br />
wccp2_assignment_method 1<br />
wccp2_service standard 0<br />
wccp2_address 10.0.20.1</p></blockquote>
<p>Useful links:</p>
<ul>
<li><a href="http://www.usenet-forums.com/squid-users/247645-wccp-gre-redirect-target-failed-solution.html">http://www.usenet-forums.com/squid-users/247645-wccp-gre-redirect-target-failed-solution.html</a></li>
<li><a href="http://wiki.squid-cache.org/SquidFaq/InterceptionProxy">http://wiki.squid-cache.org/SquidFaq/InterceptionProxy</a></li>
<li><a href="http://www.cisco.com/public/news_training/itsnews/tech/chalktalk/200806.html">http://www.cisco.com/public/news_training/itsnews/tech/chalktalk/200806.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2009/03/17/wccp-with-cisco-877-and-squid/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Upgrading Xensource Debian Etch guests to Lenny</title>
		<link>http://www.steveglendinning.com/2009/02/15/upgrading-xensource-debian-etch-guests-to-lenny/</link>
		<comments>http://www.steveglendinning.com/2009/02/15/upgrading-xensource-debian-etch-guests-to-lenny/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 16:44:21 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/?p=61</guid>
		<description><![CDATA[Debian Lenny has been released, so I&#8217;ve started upgrading some of my Xen virtual servers.  For Etch, Xensource shipped their own modified PV kernel package (2.6.18 based).  With Lenny the same kernel can be used, or the standard Debian xen kernel (2.6.26 based) can be used instead.
Upgrading the userland is identical to a physical server [...]]]></description>
			<content:encoded><![CDATA[<p>Debian Lenny has been released, so I&#8217;ve started upgrading some of my Xen virtual servers.  For Etch, Xensource shipped their own modified PV kernel package (2.6.18 based).  With Lenny the same kernel can be used, or the standard Debian xen kernel (2.6.26 based) can be used instead.</p>
<p>Upgrading the userland is identical to a physical server &#8211; instructions are contained <a title="Etch to Lenny dist-upgrade instructions" href="http://www.debian.org/releases/lenny/i386/release-notes/ch-upgrading.en.html#upgradingpackages">within the Debian Lenny release notes</a>.</p>
<p>To use the Debian packaged 2.6.26 kernel, several minor changes have to be made as per <a title="Debian lenny kernel" href="http://forums.citrix.com/thread.jspa?threadID=240753&amp;tstart=0">this form post</a>:</p>
<ol>
<li>Install the linux-image-2.6-xen-686 package (which depends on the latest xen kernel)</li>
<li>Re-order the kernels in /boot/grub/menu.lst so the Debian 2.6.26 kernel is the first (and therefore the default)</li>
<li>Add &#8220;console=hvc0&#8243; to the end of the 2.6.26 kernel line in /boot/grub/menu.lst, so it reads &#8220;kernel /boot/vmlinuz-2.6.26-1-xen-686 root=/dev/xvda1 ro <strong>console=hvc0</strong>&#8220;</li>
<li>edit /etc/inittab, find the line that looks like &#8220;1:2345:respawn:/sbin/getty 38400 tty1&#8243; and add another line: &#8220;0:2345:respawn:/sbin/getty 38400 hvc0&#8243;</li>
</ol>
<p>Then reboot the system, it should boot the new kernel.</p>
<p>Xensource doesn&#8217;t display the grub menu, it just seems to boot straight into the default option (even though I have &#8220;timeout 10&#8243; specified in the config).  There must be a secret keypress or something to make it show the menu, but I don&#8217;t know what it is because the last step just worked for me!</p>
<p>Edit: Theoretically you shouldn&#8217;t need to use the -xen kernel variant, as the -686-bigmem kernel also supports running paravirtualised in domU.  With Xensource 5.0 this boots fine, but Xensource&#8217;s xen-tools refuse to start so XenCenter reports the status as &#8220;unknown&#8221;.  With the -xen kernel xen-tools start fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2009/02/15/upgrading-xensource-debian-etch-guests-to-lenny/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to make home and end keys work with Putty</title>
		<link>http://www.steveglendinning.com/2008/03/25/how-to-make-home-and-end-keys-work-with-putty/</link>
		<comments>http://www.steveglendinning.com/2008/03/25/how-to-make-home-and-end-keys-work-with-putty/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 11:00:08 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/2008/03/25/how-to-make-home-and-end-keys-work-with-putty/</guid>
		<description><![CDATA[Using Putty to ssh onto a Debian machine, the &#8220;home&#8221; and &#8220;end&#8221; keys don&#8217;t behave well.  By default, both of these keys output a &#8220;~&#8221; character instead of moving the cursor to the beginning or end of the line.
I found the solution, it&#8217;s a simple change in Putty&#8217;s settings (Connection -&#62; Data -&#62; Terminal-type string).  [...]]]></description>
			<content:encoded><![CDATA[<p>Using Putty to ssh onto a Debian machine, the &#8220;home&#8221; and &#8220;end&#8221; keys don&#8217;t behave well.  By default, both of these keys output a &#8220;~&#8221; character instead of moving the cursor to the beginning or end of the line.</p>
<p>I found <a href="http://www.linuxquestions.org/questions/linux-software-2/using-home-and-end-keys-via-ssh-putty-484127/" title="Putty fix home and end keys">the solution</a>, it&#8217;s a simple change in Putty&#8217;s settings (Connection -&gt; Data -&gt; Terminal-type string).  By default this is set to &#8220;xterm&#8221; but changing it to &#8220;linux&#8221; fixes the home and end keys.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2008/03/25/how-to-make-home-and-end-keys-work-with-putty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protecting against SSH brute-force password attacks</title>
		<link>http://www.steveglendinning.com/2008/01/27/protecting-against-ssh-brute-force-password-attacks/</link>
		<comments>http://www.steveglendinning.com/2008/01/27/protecting-against-ssh-brute-force-password-attacks/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 12:36:01 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/2008/01/27/protecting-against-ssh-brute-force-password-attacks/</guid>
		<description><![CDATA[I run an internet facing ssh server, so my logs are regularly full of brute-force password attacks like this:
Jan 20 02:59:21 drevil sshd[12803]: error: PAM: Authentication failure for illegal user root from 213.136.100.86
Jan 20 02:59:24 drevil sshd[12806]: error: PAM: Authentication failure for illegal user root from 213.136.100.86
Jan 20 02:59:27 drevil sshd[12816]: error: PAM: Authentication failure [...]]]></description>
			<content:encoded><![CDATA[<p>I run an internet facing ssh server, so my logs are regularly full of brute-force password attacks like this:</p>
<blockquote><p>Jan 20 02:59:21 drevil sshd[12803]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:24 drevil sshd[12806]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:27 drevil sshd[12816]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:30 drevil sshd[12820]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:34 drevil sshd[12827]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:37 drevil sshd[12830]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:40 drevil sshd[12833]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:44 drevil sshd[12836]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:47 drevil sshd[12840]: error: PAM: Authentication failure for illegal user root from 213.136.100.86<br />
Jan 20 02:59:51 drevil sshd[12843]: error: PAM: Authentication failure for illegal user root from 213.136.100.86</p></blockquote>
<p>There are several simple ways of reducing the chance of a break-in through this method:</p>
<p><strong>1. Use strong passwords</strong></p>
<p>This is an obvious place to start.  The vast majority of these attacks come from automated scanning tools.  These attempt to log in using passwords from a commonly used &#8220;dictionary&#8221;, so avoid simple words like &#8220;password&#8221;.  Using a combination of letters, lower and upper case letters, and even symbols (!&#8221;Â£$%^&amp;*) will give a password that is unlikely to be listed in a &#8220;common passwords&#8221; dictionary.</p>
<p><strong>2. Restrict the users who can connect via ssh</strong></p>
<p>OpenSSH has the capability to specify a &#8220;white list&#8221; of allowed users and deny all others.  Simply add this line to your /etc/sshd_config and restart the sshd service:</p>
<blockquote><p>AllowUsers dave mike sarah</p></blockquote>
<p>This will block attempts to connect as any of the common system users (root, postfix, mysql etc), EVEN if the attacker guesses the correct password.  If this list is kept as small as possible, it is much easier to verify these users have strong passwords.</p>
<p><strong>3. Rate limit new ssh connections</strong></p>
<p>A simple iptables script can be used to rate limit new incoming connection attempts.  There are two ways of doing this, using the limit and recent iptables modules.  Here&#8217;s the limit solution:</p>
<blockquote><p>iptables -N NEW_SSH<br />
iptables -A INPUT -p tcp &#8211;dport 22 -m state &#8211;state NEW -j NEW_SSH<br />
iptables -A NEW_SSH -s 10.0.0.0/24 -j ACCEPT<br />
iptables -A NEW_SSH -m limit &#8211;limit 3/min &#8211;limit-burst 3 -j ACCEPT<br />
iptables -A NEW_SSH -j DROP</p></blockquote>
<p>The third line ensures that connections from the internal network (in this example 10.0.0.0/24) are not subject to rate-limiting.  The weakness of this approach is that while an attack is underway, ALL new ssh connections from outside are blocked.  The recent module allows a slightly different approach (taken from <a href="http://www.debian-administration.org/articles/187" title="Debian Administration">debian administration</a>):</p>
<blockquote><p>iptables -N NEW_SSH<br />
iptables -A INPUT -p tcp &#8211;dport 22 -m state &#8211;state NEW -j NEW_SSH<br />
iptables -A NEW_SSH -s 10.0.0.0/24 -j ACCEPT<br />
iptables -A NEW_SSH -m recent &#8211;set<br />
iptables -A NEW_SSH -m recent &#8211;update &#8211;seconds 60 &#8211;hitcount 4 -j DROP<br />
iptables -A NEW_SSH -j ACCEPT</p></blockquote>
<p>This module &#8220;blacklists&#8221; IP addresses that exceed the rate limit, while still allowing other IP addresses to connect.  If a connection makes it past this rate limiting, we accept it (last line).</p>
<p><strong>4. Run your ssh server on a different port</strong></p>
<p>The automated scanners look for ssh services on the default port (22), so if you move your sshd to a non-standard port less scanners will find you.  It&#8217;s worth noting that this approach doesn&#8217;t improve security at all against a determined attacker.  Personally I don&#8217;t use this technique, my SSH servers run on port 22.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2008/01/27/protecting-against-ssh-brute-force-password-attacks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How much memory is in my Linux system?</title>
		<link>http://www.steveglendinning.com/2007/11/04/how-much-memory-is-in-my-linux-system/</link>
		<comments>http://www.steveglendinning.com/2007/11/04/how-much-memory-is-in-my-linux-system/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 17:06:41 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Etch]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/2007/11/04/how-much-memory-is-in-my-linux-system/</guid>
		<description><![CDATA[ I came across a really handy tool for listing the number of RAM sockets you have, and what&#8217;s currently in them all.  The tool is dmidecode, and it&#8217;s installed by default on Debian Etch:
drevil:~# dmidecode -t memory
# dmidecode 2.8
SMBIOS 2.3 present.
Handle 0&#215;1000, DMI type 16, 15 bytes
Physical Memory Array
     [...]]]></description>
			<content:encoded><![CDATA[<p> I came across a really handy tool for listing the number of RAM sockets you have, and what&#8217;s currently in them all.  The tool is dmidecode, and it&#8217;s installed by default on Debian Etch:</p>
<blockquote><p>drevil:~# dmidecode -t memory<br />
# dmidecode 2.8<br />
SMBIOS 2.3 present.</p>
<p>Handle 0&#215;1000, DMI type 16, 15 bytes<br />
Physical Memory Array<br />
        Location: System Board Or Motherboard<br />
        Use: System Memory<br />
        Error Correction Type: None<br />
        Maximum Capacity: 4 GB<br />
        Error Information Handle: Not Provided<br />
        Number Of Devices: 2</p>
<p>Handle 0&#215;1100, DMI type 17, 23 bytes<br />
Memory Device<br />
        Array Handle: 0&#215;1000<br />
        Error Information Handle: Not Provided<br />
        Total Width: 64 bits<br />
        Data Width: 64 bits<br />
        Size: 256 MB<br />
        Form Factor: DIMM<br />
        Set: None<br />
        Locator: DIMM_1<br />
        Bank Locator: Not Specified<br />
        Type: SDRAM<br />
        Type Detail: Synchronous<br />
        Speed: 333 MHz (3.0 ns)</p>
<p>Handle 0&#215;1101, DMI type 17, 23 bytes<br />
Memory Device<br />
        Array Handle: 0&#215;1000<br />
        Error Information Handle: Not Provided<br />
        Total Width: 64 bits<br />
        Data Width: 64 bits<br />
        Size: 256 MB<br />
        Form Factor: DIMM<br />
        Set: None<br />
        Locator: DIMM_2<br />
        Bank Locator: Not Specified<br />
        Type: SDRAM<br />
        Type Detail: Synchronous<br />
        Speed: 333 MHz (3.0 ns)</p></blockquote>
<p>Thanks to <a href="http://mjr.towers.org.uk/blog/2007/software#currentram" title="Current RAM">MJ Ray</a> and <a href="http://www.kryogenix.org/days/2006/10/26/memory-scanner-for-linux" title="Memory scanner for Linux">Stuart Langridge</a>, hopefully this will save me getting the screwdriver out in future!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2007/11/04/how-much-memory-is-in-my-linux-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading Linux software RAID-1 array</title>
		<link>http://www.steveglendinning.com/2007/10/24/upgrading-linux-software-raid-1-array/</link>
		<comments>http://www.steveglendinning.com/2007/10/24/upgrading-linux-software-raid-1-array/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 20:40:06 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/2007/10/24/upgrading-linux-software-raid-1-array/</guid>
		<description><![CDATA[I just finished upgrading my Debian Etch fileserver from 2&#215;200GB IDE disks to 2&#215;500GB SATA disks.  I managed to keep the server running for nearly the entire time, by failing and hot-adding disks to the RAID-1 arrays. If I had room in the case for more than two disks it would have been even [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished upgrading my Debian Etch fileserver from 2&#215;200GB IDE disks to 2&#215;500GB SATA disks.  I managed to keep the server running for nearly the entire time, by failing and hot-adding disks to the RAID-1 arrays. If I had room in the case for more than two disks it would have been even easier.</p>
<p>Here is the configuration BEFORE:</p>
<ul>
<li>/dev/hda partitioned into hda1 (10GB), hda2 (1GB), hda3 (175GB)</li>
<li>/dev/hdc partitioned into hdc1 (10GB), hdc2 (1GB), hdc3 (175GB)</li>
<li>RAID-1 array md0 composed of hda1 and hdc1, mounted as /</li>
<li>RAID-1 array md1 composed of hda2 and hdc2, mounted as swap</li>
<li>RAID-1 array md2 composed of hda3 and hdc3, mounted as /home</li>
</ul>
<p>I started the ball rolling by failing one partition from each RAID array:</p>
<blockquote><p>mdadm &#8211;fail /dev/md0 /dev/hdc1<br />
mdadm &#8211;fail /dev/md1 /dev/hdc2<br />
mdadm &#8211;fail /dev/md2 /dev/hdc3</p></blockquote>
<p>Then I powered down the server, disconnected and removed hdc and added a new 500GB SATA disk to the SATA PCI card.  It booted up fine with all three RAID arrays degraded.  I used fdisk to partition the new SATA disk (/dev/sda) with identical sized partitions 1 and 2, and with the third partition taking up the remainder of the disk.  I set all partition types to fd (linux raid auto-detect):</p>
<ul>
<li>sda1 (10GB), sda2 (1GB), sda3 (454GB)</li>
</ul>
<p>Then one at a time I hot-added these partitions to the running RAID arrays.  This causes a background reconstruction, so it&#8217;s worth waiting for each to finish before starting the next:</p>
<blockquote><p>mdadm &#8211;add /dev/md0 /dev/sda1<br />
mdadm &#8211;add /dev/md1 /dev/sda2<br />
mdadm &#8211;add /dev/md2 /dev/sda3</p></blockquote>
<p>When all three were completely synced (cat /proc/mdstat to see the progress), I edited /etc/mdadm/mdadm.conf to change all references from /dev/hdcx to /dev/sdax.  I then re-built the initramfs so it knew how to start the arrays at boot time:</p>
<blockquote><p>update-initramfs -k all -c -t</p></blockquote>
<p>I then powered down the server again, removed the last IDE disk (hda) and added the second SATA disk (sdb).  At this point the system is unbootable, so I started from a rescue CD (actually the Debian Etch netinst cd, starting with the &#8220;rescue&#8221; boot option).  Once I got a command prompt (Alt-F2 and Alt-F3 virtual consoles), I installed grub:</p>
<blockquote><p>mount /dev/sda1 /mnt<br />
chroot /mnt /bin/bash<br />
nano /boot/grub/device.map</p></blockquote>
<p>I edited the device.map so it looked like this:</p>
<blockquote><p>(hd0)   /dev/sda<br />
(hd1)   /dev/sdb</p></blockquote>
<p>Then installed grub on the first SATA disk:</p>
<blockquote><p>grub-install /dev/sda</p></blockquote>
<p>I rebooted and grub succesfully booted the server.  As expected, all RAID arrays were in degraded mode.  I used fdisk to re-partition the second SATA disk to match the first, then hot-added the mirrors to the RAID arrays (waiting for each re-sync to complete before starting the next):</p>
<blockquote><p>mdadm &#8211;add /dev/md0 /dev/sdb1<br />
mdadm &#8211;add /dev/md1 /dev/sdb2<br />
mdadm &#8211;add /dev/md2 /dev/sdb3</p></blockquote>
<p>Then I edited /etc/mdadm/mdadm.conf to update the partitions to (for example) sda1,sdb1.  I re-build the initramfs again as above, and rebooted to test everything booted up cleanly.  Also I checked /proc/mdstat after the reboot to check all arrays were fully functional.</p>
<p>So now the new disks are installed, but there&#8217;s no extra storage available because the ext3 partition is still set to the old size!  I rebooted into single user mode, unmounted /home, then used resize2fs to expand the filesystem to use the whole partition:</p>
<blockquote><p>e2fsck -f /dev/md2<br />
resize2fs /dev/md2</p></blockquote>
<p>One reboot later and voila, 455GB usable in /home.</p>
<p>Then I followed <a href="http://grub.enbug.org/MirroringRAID" title="Grub Mirroring RAID">this guide to install grub on the second RAID disk</a> in a bootable way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2007/10/24/upgrading-linux-software-raid-1-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Wordpress 2.2 on Debian Etch</title>
		<link>http://www.steveglendinning.com/2007/10/01/etch-wordpress/</link>
		<comments>http://www.steveglendinning.com/2007/10/01/etch-wordpress/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 20:56:15 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Apt]]></category>
		<category><![CDATA[Etch]]></category>

		<guid isPermaLink="false">http://www.steveglendinning.com/2007/10/01/etch-wordpress/</guid>
		<description><![CDATA[The Debian package for Wordpress in Etch is version 2.0.  Lenny (the current testing distribution) has version 2.2, which has quite a few improvements.  Here&#8217;s how I installed this testing package without upsetting the rest of my stable system.
Wordpress is a php package, so it&#8217;s architecture independant and has hardly any dependencies.  [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.debian.org">Debian</a> package for <a href="http://www.wordpress.org">Wordpress</a> in Etch is version 2.0.  Lenny (the current testing distribution) has version 2.2, which has quite a few <a href="http://codex.wordpress.org/Version_2.2" title="Wordpress 2.2">improvements</a>.  Here&#8217;s how I installed this testing package without upsetting the rest of my stable system.</p>
<p>Wordpress is a php package, so it&#8217;s architecture independant and has hardly any dependencies.  In fact the only dependency that can&#8217;t be satisfied from stable is libphp-phpmailer: wordpress 2.2 needs a newer version of this library than shipped with etch.  It&#8217;s possible to manually download those two packages from the testing distribution and install them manually, but there&#8217;s a better way.</p>
<p>Add the testing distribution to your /etc/apt/sources.list so it looks like this (the first two should already be in there):</p>
<blockquote><p>deb http://ftp.uk.debian.org/debian/ etch main contrib non-free<br />
deb http://security.debian.org/ etch/updates main contrib non-free<br />
deb http://ftp.uk.debian.org/debian/ testing main</p></blockquote>
<p>Then use apt-pinning to disable the testing distribution for all packages except the ones you want.  Edit the /etc/apt/preferences file (you may have to create it if it doesn&#8217;t already exist) so it looks like this:</p>
<blockquote><p>Package: *<br />
Pin: release a=stable<br />
Pin-Priority: 700</p>
<p>Package: *<br />
Pin: release a=testing<br />
Pin-Priority: -1</p>
<p>Package: wordpress<br />
Pin: release a=testing<br />
Pin-Priority: 800</p>
<p>Package: libphp-phpmailer<br />
Pin: release a=testing<br />
Pin-Priority: 800</p></blockquote>
<p>The magic part of this is the preference of &#8220;-1&#8243; for the testing distribution, which removes its packages from the available list.  If you put a positive preference such as 500 (which is lower than the stable preference of 700), stable will still &#8220;win&#8221; for most packages but you&#8217;ll see some that aren&#8217;t in stable.  The preference of 800 is assigned to the two packages we *do* want, and this makes them preferred over stable.</p>
<p>Now install wordpress 2.2:</p>
<blockquote><p>apt-get update<br />
apt-get install wordpress</p></blockquote>
<p>If you already have wordpress 2.0 installed, &#8220;apt-get update; apt-get upgrade&#8221; will upgrade your 2.0 copy instead.</p>
<p>This technique can be used to cherry pick other packages from testing into a stable base system, but only if they don&#8217;t have significant dependencies (such as a newer c library version).  In this case, <a href="http://backports.org">backports.org</a> is your friend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveglendinning.com/2007/10/01/etch-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
