<?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>wally's blog &#187; Linux</title>
	<atom:link href="http://matt.matzi.org.uk/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://matt.matzi.org.uk</link>
	<description>Delving deep into the mind of me</description>
	<lastBuildDate>Mon, 30 Jan 2012 21:20:07 +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>NIC teaming on Debian Etch and Lenny</title>
		<link>http://matt.matzi.org.uk/2009/01/23/nic-teaming-on-debian-etch-and-lenny/</link>
		<comments>http://matt.matzi.org.uk/2009/01/23/nic-teaming-on-debian-etch-and-lenny/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:33:11 +0000</pubDate>
		<dc:creator>wally</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[bonding]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[ifenbond]]></category>

		<guid isPermaLink="false">http://matt.matzi.org.uk/?p=57</guid>
		<description><![CDATA[There are plenty of HOWTOs on so called NIC teaming or NIC bonding for Debian, but of the ones I&#8217;ve seen, they&#8217;ve all missed some rather important bits. Below is the method I personally found to work reliably: apt-get install ifenslave echo &#34;bonding&#34; &#38;gt;&#38;gt; /etc/modules modprobe bonding ifdown eth0 edit /etc/network/interfaces, changing &#8220;eth0&#8243; (or your [...]]]></description>
			<content:encoded><![CDATA[<p>There are plenty of HOWTOs on so called NIC teaming or NIC bonding for Debian, but of the ones I&#8217;ve seen, they&#8217;ve all missed some rather important bits.</p>
<p>Below is the method I personally found to work reliably:</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> ifenslave
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;bonding&quot;</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
modprobe bonding
<span style="color: #c20cb9; font-weight: bold;">ifdown</span> eth0</pre></div></div>

<p>edit /etc/network/interfaces, changing &#8220;eth0&#8243; (or your configured NIC) to &#8220;bond0&#8243;, and replacing &#8220;allow-hotplug&#8221; with &#8220;auto&#8221;.  The following <code>sed</code> line give you this automagically:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/eth0/bond0/;s/allow-hotplug bond0/auto bond0/'</span> <span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>network<span style="color: #000000; font-weight: bold;">/</span>interfaces</pre></div></div>

<p>Tell <code>ifup</code> and <code>ifdown</code> to add/remove devices to <code>bond0</code> lines:</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;">&quot; up /sbin/ifenslave      bond0 eth0 eth1&quot;</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>network<span style="color: #000000; font-weight: bold;">/</span>interfaces
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; down /sbin/ifenslave -d bond0 eth0 eth1&quot;</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>network<span style="color: #000000; font-weight: bold;">/</span>interfaces
<span style="color: #c20cb9; font-weight: bold;">ifup</span> bond0;</pre></div></div>

<p>And you&#8217;re done!</p>
<p>You can add all the options for the bonding module to the line in <code>/etc/modules</code>, like:</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;">&quot;bonding mode=1 miimon=250 primary=eth0&quot;</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>Details of all options available at <a href="http://linuxfoundation.org/en/Net:Bonding#Bonding_Driver_Options">linuxfoundation.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://matt.matzi.org.uk/2009/01/23/nic-teaming-on-debian-etch-and-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reconstructing heavily damaged hard drives</title>
		<link>http://matt.matzi.org.uk/2008/07/03/reconstructing-heavily-damaged-hard-drives/</link>
		<comments>http://matt.matzi.org.uk/2008/07/03/reconstructing-heavily-damaged-hard-drives/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 11:22:09 +0000</pubDate>
		<dc:creator>wally</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[forensics]]></category>
		<category><![CDATA[helix]]></category>
		<category><![CDATA[recovery]]></category>

		<guid isPermaLink="false">http://matt.matzi.org.uk/?p=46</guid>
		<description><![CDATA[Recover data even when an NTFS (or other) won&#8217;t mount due to partial hard drive failure. This was born when someone brought me a near dead hard drive (a serious number of read errors, so bad that nothing could mount or fix the filesystem), asking if I could recover any data. Now obviously (as almost [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Recover data even when an NTFS (or other) won&#8217;t mount due to partial hard drive failure.</strong></p>
<p>This was born when someone brought me a near dead hard drive (a serious number of read errors, so bad that nothing could mount or fix the filesystem), asking if I could recover any data.</p>
<p>Now obviously (as almost any geek would know), the answer of course is a very likely yes. There are many ways of recovering data. One such way (which I performed) is using <a href="http://linux.die.net/man/1/foremost">Foremost</a> to find files based on their headers and structures. While this technique works really quite well, it does miss a lot of files, fragment others up, leave bits out and generally not retrieve any metadata (such as filenames etc).</p>
<p>This makes Matt mad.  No filenames == days of renaming files.</p>
<p>So I booted up <a href="http://www.e-fense.com/helix/">Helix</a>, created a quick image of the drive to a 500GB external drive, and tried running <a href="http://www.sleuthkit.org/">Autopsy </a>(the GUI of Sleuthkit).  This is where things got interesting.</p>
<p>I say interesting, because Sleuthkit <em>couldn&#8217;t</em> read the filesystem.  But it <em>could</em> retrieve the inodes, and the metadata along with them.  And it could accordingly retrieve the data content of (some) files.</p>
<p>Observing this, I realized there was a high probability that I could somehow <em>use</em> Sleuthkit&#8217;s command line tools to retrieve the files which were not on bad clusters and recover the filenames from the inode. As it turns out, this wasn&#8217;t such a bad idea!</p>
<p>There are 3 tools which proved useful:</p>
<ul>
<li>ils</li>
<li>ffind</li>
<li>icat</li>
</ul>
<p><em>ils</em> &#8220;lists inode information&#8221; from the image, <em>ffind</em> &#8220;finds the name of the file or directory using the given inode&#8221; and <em>icat</em> &#8220;outputs the content of the file based on it&#8217;s inode number&#8221;. Using these three tools and a bit of bash, we can grab a list of inodes, get the filename from the metadata, create the directory structure beneath it, extract the file content, move on to the next.</p>
<p>So for this task I knocked up the following (really ugly, potentially unsafe) script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #000000; font-weight: bold;">for</span> inode <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>inodes<span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>KNOPPIX<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sleuthkit-<span style="color: #000000;">2.09</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ffind <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda1 <span style="color: #007800;">$inode</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;INODE: <span style="color: #007800;">$inode</span>&quot;</span>
	<span style="color: #007800;">INODEDIR</span>=<span style="color: #000000; font-weight: bold;">`/</span>KNOPPIX<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sleuthkit-<span style="color: #000000;">2.09</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ffind <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda1 <span style="color: #007800;">$inode</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
	<span style="color: #007800;">REALDIR</span>=<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>out<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$INODEDIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #007800;">FILENAME</span>=<span style="color: #ff0000;">&quot;/mnt/out<span style="color: #007800;">$INODEDIR</span>&quot;</span>
	<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$REALDIR</span>&quot;</span>
&nbsp;
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;FILENAME: <span style="color: #007800;">$FILENAME</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">/</span>KNOPPIX<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sleuthkit-<span style="color: #000000;">2.09</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>icat <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda1 <span style="color: #007800;">$inode</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FILENAME</span>&quot;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FILENAME</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #000000; font-weight: bold;">`</span> == <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
	<span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FILENAME</span>&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FILENAME</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Really, I do warn you, <strong>take serious care running this</strong>!</p>
<p>It needs a lot of work, but enough is there for it to function.  It reads a file of inode numbers (one per line) and uses <em>ffind</em> to get the filename.  We extract the path, attempt to create it, output the file content and (this is important), take a <em><strong>wild guess</strong></em> at if the inode was a directory. Please note this is wildly inaccurate and needs serious rethinking! Currently we look at the file size, and assume directories alone use 1 byte.</p>
<p>We can populate a file with inode numbers like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ils <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda1 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">'|'</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>inodes</pre></div></div>

<p>(Users of Helix will need to use the full pathname to <em>ils</em> as in the above script).</p>
<p>At some point (no garuntees when) I&#8217;ll tidy up the script and make it more bullet proof. In the meantime, I hope this saves some data!</p>
<p><strong>Remember</strong>: No matter how much data you have, it&#8217;s always better to have 2 hard drives of half the size, mirrored than it is to have one large expensive drive. They <strong><em>will</em></strong> die unexpectedly! When you next buy a bigger hard drive, consider this: 1x500GB drive will loose you 500GB of data. 2x250GB will 99.9% probability loose you nothing. So if you&#8217;re on a tight budget, buy twice smaller. If you&#8217;ve a lot of money, buy twice big.</p>
<p>Oh, and <em><strong>always</strong></em> make regular backups.  Cheap USB drives are good for this!</p>
]]></content:encoded>
			<wfw:commentRss>http://matt.matzi.org.uk/2008/07/03/reconstructing-heavily-damaged-hard-drives/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Full, recoverable, DVD server backups</title>
		<link>http://matt.matzi.org.uk/2008/06/20/full-recoverable-dvd-server-backups/</link>
		<comments>http://matt.matzi.org.uk/2008/06/20/full-recoverable-dvd-server-backups/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 09:07:36 +0000</pubDate>
		<dc:creator>wally</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[mondorescue]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://matt.matzi.org.uk/?p=38</guid>
		<description><![CDATA[If you&#8217;re responsible for one or more Linux servers, (they provide packages for Linux distributions only, but it may be easily ported to other Unixes) you may be interested in the lesser known tool MondoRescue. It&#8217;s essentially nothing more (but it is a lot!) than a front end to several other GPL&#8217;ed tools, including BZip, [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re responsible for one or more Linux servers, (they provide packages for Linux distributions <strong>only</strong>, but it may be easily ported to other Unixes) you may be interested in the lesser known tool <a title="MondoRescue" href="http://www.mondorescue.org/">MondoRescue</a>.</p>
<p>It&#8217;s essentially nothing more (but it is a lot!) than a front end to several other GPL&#8217;ed tools, including BZip, growisofs and busybox.  To cut a long story short, it builds a set of CDs, DVDs, USB sticks with a tiny bootable Linux distribution based on your server&#8217;s kernel, which can restore parts or all of your filesystem from tarballs on the media.  It can also backup to tape drives, NFS mounts or a local filesystem.</p>
<p>It has (imo) a nice, clean ncurses interface; and it&#8217;s quick to use.  On an AMD K6 clocked at 350MHz, with 60MB free memory, it took just under 6 hours to compress 8.5GB of data down to a single DVD (4.7GB).  Doing the backup with an &#8220;average&#8221; compression took far less time (around an hour), but would have eaten up several DVDs.</p>
<p>You&#8217;re presented with a wide variety of options when you boot up the produced rescue media.  You can &#8220;nuke&#8221; the system and start from scratch, or just restore the parts you want.  It can handle new disk geometry, and because the entire rescue system is burnt onto the media, (assuming you used CDs, DVDs or USB storage), it&#8217;ll work even if the target machine is clean.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt.matzi.org.uk/2008/06/20/full-recoverable-dvd-server-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving a Linux install</title>
		<link>http://matt.matzi.org.uk/2007/07/03/moving-a-linux-install/</link>
		<comments>http://matt.matzi.org.uk/2007/07/03/moving-a-linux-install/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 08:44:00 +0000</pubDate>
		<dc:creator>wally</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sys Admin]]></category>

		<guid isPermaLink="false">http://matzi.org.uk/matt/2007/07/03/moving-a-linux-install/</guid>
		<description><![CDATA[Continuing with the theme of broken backup servers (oh boy am I having fun this week) I decided it may be worth giving a short explanation of how to clone or move a Linux install from one hard drive to another (note I&#8217;m not talking about two completely identical machines. If this were the case, [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing with the theme of broken backup servers (oh boy am I having fun this week) I decided it may be worth giving a short explanation of how to clone or move a Linux install from one hard drive to another (note I&#8217;m not talking about two completely identical machines.  If this were the case, a simple disk image clone should do the trick).</p>
<p>So the situation is, you&#8217;ve got two hard drives, one was more or less written off by a mouse urinating on it, the other is slightly smaller but fully functional.  You want to move the Linux install (including all configuration etc) onto the better, smaller drive with minimal hassle.  Believe it or not, it&#8217;s not <span style="font-style: italic;">that</span> difficult.</p>
<p><span style="font-weight: bold;">Please note the instructions I give below worked for me.  I don&#8217;t and will not hold and responsibility for you trashing your own computer by following them, YMMV.</span></p>
<p>Ok.  Step one I figured was to copy the filesystem from the old HD to the new one.  The simplest was I could see of doing this was:</p>
<ul>
<li>Plug the new HD in via my removable caddy</li>
<li>Boot up the existing Linux install and mount the new HD</li>
</ul>
<p>So far so good.  Next I cleaned up the new HD (when I say new, it&#8217;s actually quite old, but it&#8217;s new relative to this project if you follow), so as root &#8220;<span style="font-family:courier new;">fdisk /dev/hdc</span>&#8221; (in my case, obviously replace hdc with your second HD&#8217;s device)  and removed all the existing partitions.  I then created a new one for my root filesystem (and you will probably want one for your swap space).</p>
<ul>
<li><span style="font-family:courier new;">fdisk /dev/</span></li>
</ul>
<p>Next we generate a new filesystem.  In my case, an easy &#8220;<span style="font-family:courier new;">mke2fs -j /dev/hdc1</span>&#8220;.  Don&#8217;t forget to write down the locations of those backup superblocks!  Might just save your data some day.</p>
<ul style="font-family: courier new;">
<li>mke2fs -j /dev/</li>
</ul>
<p><span style="font-style: italic;">Side note 1: </span><span>I guess it&#8217;s entirely possible to copy your Linux install using this method to a mounted loop device (i.e. a disk <span style="font-style: italic;">image</span>), although quite why you&#8217;d <span style="font-style: italic;">want</span> to I can&#8217;t imagine&#8230; but the process would be exactly the same.</span></p>
<p><span style="font-style: italic;">Side note 2: </span>Personally I would always at this point perform a complete scan of the new HD just to be absolutely sure I&#8217;m not making things worse and wasting my time.  The command &#8220;<span style="font-family:courier new;">fsck.ext3 -cf</span>&#8221; (for ext3 anyway) will perform a bad block scan, logging anything found for future avoidance.  Even new HDs can come with bad blocks, if you notice a <span style="font-weight: bold;">lot</span> being reported, consider scapping that HD.</p>
<p>It&#8217;s important to take note at this point that you&#8217;re going to have problems if you&#8217;ve done one of the following things:  a. created a new partition smaller than the amount of data in your existing partition (<span style="font-family:courier new;">df -h</span> will tell you)  b. you&#8217;ve created a different filesystem type to what you&#8217;re currently using.  It&#8217;s outside the scope of this blog to discuss those.</p>
<p>Next copy everything you want over to the new partition.  In my case this was everything from <span style="font-family:courier new;">/bin</span> to <span style="font-family:courier new;">/var</span>, excluding <span style="font-family:courier new;">/mnt</span> and a few other mounted directories.  <span style="font-style: italic;">Don&#8217;t </span>copy mounted directories (that includes <span style="font-family:courier new;">/proc</span> and <span style="font-family:courier new;">/mnt</span> etc), rather just create them on the new partition with &#8220;<span style="font-family:courier new;">mkdir /mnt/proc</span>&#8221; etc).  This can be easily achieved using &#8220;<span style="font-family:courier new;">cp /bin /mnt/ -R</span>&#8221; (and so on).  Make sure you <span style="font-style: italic;">do</span> copy <span style="font-family:courier new;">/dev</span>, I made that mistake first time and it produces some weird results.</p>
<ul style="font-family: courier new;">
<li>cp /everythingyouwant /mnt/ -R</li>
</ul>
<p>OK!  Nearly there.  Shutdown, swap the two HD&#8217;s around and boot back up.  Don&#8217;t forget to tell the BIOS of the changes and to check those jumper settings.  Make sure your BIOS boots the <span style="font-style: italic;">old</span> HD, at the moment GrUB doesn&#8217;t exist on the new one.  Boot it, pass through GrUB as normal and you&#8217;ll <span style="font-style: italic;">hopefully</span> be brought into Linux, from your <span style="font-style: italic;">new</span> HD.  If something goes wrong, post a comment and myself or someone else will try to help.</p>
<p>So assuming you&#8217;ve logged in all OK, you&#8217;re ready to install GrUB on your new HD.  Once this is done, you&#8217;re ready to shutdown, remove the old HD, tell the BIOS to boot the new one and continue your normal work!</p>
<p>Run &#8220;<span style="font-family:courier new;">grub-install</span>&#8221; as root, let it figure out what exists and if all goes well, it&#8217;ll pick up your existing (copied from the old HD) <span style="font-family:courier new;">/boot/grub/ </span>directory and place it&#8217;s stage1 onto the new HD&#8217;s boot sector.  If Grub <span style="font-style: italic;">doesn&#8217;t </span>output any errors, you&#8217;re ready to try shutting down and rebooting.  If Grub <span style="font-style: italic;">does </span>complain, it might be something simple, it might be something complex.  Again, feel free to leave a comment.</p>
<ul>
<li><span style="font-family:courier new;">grub-install</span></li>
</ul>
<p>OK, reboot, set the BIOS to boot the new HD and see if it works.  If it doesn&#8217;t, you&#8217;ve probably just mis-configured GrUB.  A boot disk or booting the old HD will give you an environment to play in, the GrUB website has a lot of details on configuring GrUB correctly.  Remember to keep the <span style="font-family:courier new;">menu.lst </span>the same as before, nothing in there should need changing (unless you&#8217;ve moved other HDs around or partitioned the new drive differently).</p>
<p>You should now be back, booted up and working!  Congratulations!  Told you it wasn&#8217;t <span style="font-style: italic;">too</span> hard <img src='http://matt.matzi.org.uk/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><span style="font-style: italic;">Important note: </span>If you&#8217;ve had serious problems with the old HD, it might be worth you reinstalling all packages (or reemerging if you&#8217;re a Gentoo user) to make sure none of your binaries are corrupt.  On on Gentoo it&#8217;s something like &#8220;<span style="font-family:courier new;">emerge &#8211;reemerge world</span>&#8221; iirc, as for other distros I don&#8217;t know, look up the manuals.  Also make sure none of your configurations or home brewed scripts need modifying now the HD has changed, I think particularly of SMART tools and software RAID.  I also had a lot of problems getting Cron to run, so just watch your back and check everything extensively works before relying on it.</p>
<p>As always, any constructive comments would be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt.matzi.org.uk/2007/07/03/moving-a-linux-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux and large hard drives</title>
		<link>http://matt.matzi.org.uk/2007/06/30/linux-and-large-hard-drives/</link>
		<comments>http://matt.matzi.org.uk/2007/06/30/linux-and-large-hard-drives/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 12:20:00 +0000</pubDate>
		<dc:creator>wally</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://matzi.org.uk/matt/2007/06/30/linux-and-large-hard-drives/</guid>
		<description><![CDATA[I just finished rebuilding the backup server, and I discovered something new about Linux which I didn&#8217;t know (although I did assume it was possible). I&#8217;d tried googling for the answer to this question without avail, so I&#8217;ve blogged it here to hopefully answer the question for someone else in my same situation. The problem [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished rebuilding the backup server, and I discovered something new about Linux which I didn&#8217;t know (although I did assume it was possible).</p>
<p>I&#8217;d tried googling for the answer to this question without avail, so I&#8217;ve blogged it here to <span style="font-style: italic;">hopefully</span> answer the question for someone else in my same situation.</p>
<p>The problem is you have a large hard disk, let&#8217;s say 80GB.  The computer&#8217;s BIOS is old and can&#8217;t detect it properly.  The question is, can Linux access / mount / detect a hard disk larger than the BIOS supports and can detect?</p>
<p>Well the answer it would seem is proved to be yes, in at least <span style="font-style: italic;">some </span>circumstances.</p>
<p>I&#8217;m not saying this will work for everyone, because I&#8217;m not a Linux expert.  But it <span style="font-style: italic;">did</span> work for me, and I&#8217;ll give my educated <span style="font-style: italic;">guess</span> at why.</p>
<p>When Linux boots (well actually just <span style="font-style: italic;">before </span>it boots) the computer moves from 16bit to 32bit mode (&#8220;protected mode&#8221;, a 386 feature which stuck and exists even in the latest x86 AMD and Intel processors).  When this happens, the BIOS is rendered fairly uesless (as I recall, it was a long time ago I was interested in writing my own 32bit OS!) and so the Operating System starts accessing hardware through &#8220;IO&#8221; ports, special registers (again, as I recall) in the processor.  Through these, it can access all the hardware without going near the BIOS, so even if your HD is <span style="font-weight: bold;">not</span> supported by the BIOS, it may well be accessible by Linux, or any other 32bit Operating System.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt.matzi.org.uk/2007/06/30/linux-and-large-hard-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

