<?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>partitioning &#8211; Everything is Broken</title>
	<atom:link href="https://play.datalude.com/blog/tag/partitioning/feed/" rel="self" type="application/rss+xml" />
	<link>https://play.datalude.com/blog</link>
	<description>Efficiency vs. Inefficiency, in a no-holds barred fight.</description>
	<lastBuildDate>Fri, 18 Jul 2008 01:34:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Big Switch 7: Shake your Booty</title>
		<link>https://play.datalude.com/blog/2008/03/big-switch-7-shake-your-booty/</link>
					<comments>https://play.datalude.com/blog/2008/03/big-switch-7-shake-your-booty/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 26 Mar 2008 07:08:24 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[partitioning]]></category>
		<category><![CDATA[thinkpad]]></category>
		<guid isPermaLink="false">http://play.datalude.com/blog/?p=18</guid>

					<description><![CDATA[OK, in the last post, I had moved my partitions around substantially, so we were obviously in for a few problems booting. To recap, the new layout looks like this: /dev/hda1 &#8211; 20Gb &#8211; Linux main system (moved and enlarged) /dev/hda2 &#8211; 100Mb &#8211; /boot partition (moved) /dev/hda4 &#8211; 1 Gb &#8211; swap partition (moved) ... <a title="Big Switch 7: Shake your Booty" class="read-more" href="https://play.datalude.com/blog/2008/03/big-switch-7-shake-your-booty/" aria-label="Read more about Big Switch 7: Shake your Booty">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>OK, in the <a href="http://play.datalude.com/blog/?p=12">last post</a>, I had moved my partitions around substantially, so we were obviously in for a few problems booting. To recap, the new layout looks like this:</p>
<ul>
<li> /dev/hda1 &#8211; 20Gb &#8211; Linux main system (moved and enlarged)</li>
<li>/dev/hda2 &#8211; 100Mb &#8211; /boot partition (moved)</li>
<li>/dev/hda4 &#8211; 1 Gb &#8211; swap partition (moved)</li>
<li>/dev/hda3 &#8211; Extended partition containing
<ul>
<li>/dev/hda5 &#8211; 17 Gb Data partition (enlarged)</li>
<li>/dev/hda6 &#8211; 17Gb /home partition (newly created to house all the VMs)</li>
</ul>
</li>
</ul>
<p>The first problem was getting the thing to boot up. The MBR was still on the boot sector of the drive, but it was telling the computer to boot from the wrong sector. I pulled out the Mint / Ubuntu install CD and booted from that.<span id="more-18"></span></p>
<p>From the desktop (running on the live CD), I opened a terminal and did this:</p>
<blockquote><p>sudo grub<br />
find /boot/grub/stage1<br />
find /grub/stage1</p></blockquote>
<p>This asks grub to locate its files on all available partitions: the first find command didn't work but the second one did. It returned hd(0,1), which is the first hard disk, second partition. Grub starts from zero, while linux hard disk enumeration starts from a and 1, so hd(0,1) equals hda2. So, armed with this information we do:</p>
<blockquote><p>root (hd0,1)<br />
setup (hd0)<br />
quit</p></blockquote>
<p>This tells grub that it should boot partition (hd0,1) and that it should reinstall itself on the MBR of hd0 (=hda).</p>
<p>Now we can reboot from the MBR on the hard disk, and grub will be able to find its files. But we have a separate boot partition, so when we boot, it still won't be able to find the root file system. So now, when we boot the first time, we can interrupt the boot process and hit 'e' to edit the boot command. Grub is in the boot sector on hd(0,1) and the rest of the filesystem is on hd(0,0), so we need to tell grub where the filesystem is. The boot command reads:<br />
/boot/vmlinuz-2.6.22-14-generic root=/dev/hda2 ro quiet splash<br />
so we change it to<br />
/boot/vmlinuz-2.6.22-14-generic root=/dev/hda1 ro quiet splash<br />
And also, I know that I need some extra options to boot this darn Thinkpad R51e, so actually I changed it to<br />
/boot/vmlinuz-2.6.22-14-generic root=/dev/hda1 ro quiet noapic ec_intr=0 splash</p>
<p>You can actually try this a few times until the thing boots correctly. Once you hit the magic combination, remember what it was, and then when you've booted successfully, you just edit /boot/grub/menu.lst to make the changes permanent.</p>
<p>All of this is a bit of a heart-stopping few minutes, but at the end of the day, all your data is backed up and if the worst comes to the worst, you can restore it &#8230; right?</p>
<p>But I was in for a couple of surprises. The first surprise comes from the fact that Ubuntu doesn't mount its disk partitions with /hda1, hda2, etc, but it uses a UUID. There are some good reasons for this &#8212; it makes it easy to move partitions around. However as I'd cloned the partitions when I moved them, there were two partitions with the  same UUID.</p>
<p>Here are the basic steps as I recall them, although this was some time ago now:</p>
<ul>
<li>Find out the UUIDs of each partition with eg <code> sudo vol_id -u /dev/hda1</code></li>
<li> Create a new UUID for the hda1 if necessary with eg <code>sudo tune2fs -U random /dev/hda1</code></li>
<li>Edit /etc/fstab and enter the correct UUIDs against the correct partitions.</li>
</ul>
<p>There is more information on this to be had in the Ubuntu forums. A search on UUID will get you a bunch.</p>
<p>Final surprise. When I run gparted to check the partitions, I can see  that the root partition, hda1 is mounted as / and /dev/.static/dev</p>
<p>Although this hasn't caused me any problems, it still unnerves me. Let me know if you have a solution to this.</p>
<p>So there we have it. A Windows to Linux migration in only a few weeks! Actually next time I could do it in a day or so, but I wanted to test everything out and take it slowly. Possibly a smarter way of doing it would be to buy a new hard disk, but I was too cheap for that. 🙂</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2008/03/big-switch-7-shake-your-booty/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Big Switch 6: Virtually there.</title>
		<link>https://play.datalude.com/blog/2008/02/the-big-switch-part-6/</link>
					<comments>https://play.datalude.com/blog/2008/02/the-big-switch-part-6/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 23 Feb 2008 06:14:38 +0000</pubDate>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[partitioning]]></category>
		<category><![CDATA[thinkpad]]></category>
		<category><![CDATA[virtualisation]]></category>
		<category><![CDATA[vmware]]></category>
		<guid isPermaLink="false">http://play.datalude.com/blog/?p=12</guid>

					<description><![CDATA[OK a quick recap from my last post, where I realised that then next step was going to take some explaining &#8230; A week or so went by without incident and it was time to consider the final stage: moving Windows to a virtual machine and getting rid of the old Windows partition. Here are ... <a title="Big Switch 6: Virtually there." class="read-more" href="https://play.datalude.com/blog/2008/02/the-big-switch-part-6/" aria-label="Read more about Big Switch 6: Virtually there.">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>OK a quick recap from my <a href="http://play.datalude.com/blog/?p=9">last post</a>, where I realised that then next step was going to take some explaining &#8230; A week or so went by without incident and it was time to consider the final stage: moving Windows to a virtual machine and getting rid of the old Windows partition. Here are the main stages.</p>
<ol>
<li>Make a windows install CD from the install files on the windows partition (Thinkpads don’t have an install CD, they use an Install partition)</li>
<li>Install vmware on Ubuntu and make a Windows Virtual Machine.</li>
<li>Delete the old Windows and IBM Install partitions</li>
<li>Re-arrange the remaining partitions to suit the new arrangement.<span id="more-12"></span></li>
</ol>
<p><strong>Making the Windows Install CD.</strong></p>
<p>This is a little bit complex because I have an IBM Thinkpad. The OS on these comes as a 4Gb rescue partition which you can boot into and restore your Thinkpad to factory condition. I made the DVDs and CDs to complete this, but actually I didn't want to use these, as it a) reformats the hard disk into a single partition + recovery partition, and b) installs a whole raft of IBM drivers widgets and bloatware that I don't want. Nevertheless I have an OEM license for Windows XP home which I'm entitled to use on this machine, so the question is how to get it installed in a Virtual machine.</p>
<p>The answer I found in several blog posts and howto articles, which I've subsequently lost. You can get most of the info here http://www.howtohaven.com/system/createwindowssetupdisk.shtml</p>
<p>Here is how I modified that info and the main steps I took:.</p>
<ol>
<li>Start with the files installed in c:\i386. Copy these to another location so you can work on them without breaking anything (despite the fact you're going to vape your windows install in a couple of hours anyway)</li>
<li>With the files in the new location (say d:\xpinstall) you need to add some plain text files to tell it that the install is an OEM install (see reference article above)</li>
<li>Slipstream in Service Pack 2.</li>
<li>Use nLite to slim down the installation to the essentials, (we don't need no stinkin' helpfiles!) and then build you a boot CD iso image.</li>
</ol>
<p><strong>VMware Install and setup</strong></p>
<p>Meanwhile, back in Linux Mint / Ubuntu, we have to install vmware server. This is done pretty easily through Synaptic. If you don't see it in there, you'll have to enable the third party software repositories. I chose VMware server as opposed to Workstation or Player because it was freer than Workstation, and it had more functionality than the Player.</p>
<p>Once vmware Server is set up, you need to start it from the item it put in your Start Menu, and connect to localhost. From here you can create a new machine. I opted to use a dynamic container with a max size of 8Gb, although I could have got away with less. I set the CD Drive to point to the .iso image I created above (brilliant feature!), and then booted it up. Windows installed like a charm, and using the OEM licence key on the bottom of my Thinkpad, it was all legal. I also set up the Network connection to NAT to my network so that the Windows machine is never directly exposed to the Network / Internet and the Ubuntu install effectively acts as a router. VMware takes care of all this for you, so you don't have to think about it too much. However if you want to run a server in VMware, you'd probably use the direct, non-NAT connection.</p>
<p>The final setting you may want to play with is the memory allocation. I have 1Gb of RAM, and I allocated half of that to the virtual machine. Windows runs fine in that, and this is a very low spec machine.</p>
<p>Once Windows is installed, obviously you have to do all that updating, and installing of AntiVirus. I also installed a couple of tools I use and my accounting software. Within the virtual machine, I set up a Truecrypt container for my accounts data, and then wrote a quick script to sync this back up to my Ubuntu installation using scp. This means once I've finished doing my monthly accounts I can just hit the button and it backs it up for me.</p>
<p>Having set all this up, I took a snapshot, and backed up the entire VM to an external hard disk, so if I ever need to recover it, I can do so in minutes. Very cool.</p>
<p><strong>Deleting the old partitions</strong></p>
<p>Once again, I left this for a week or so until I was sure things were working smoothly. During that time I also experimented with a couple of other VM images &#8211; I built one of Centos 5 server so I could prototype some development, and tried out Zimbra mail server. Unfortunately the Zimbra server comes as an rPath device, so you don't really get to play with it properlly. Anyway, this virtualization stuff is great. I wish I'd done it properly sooner.</p>
<p>The trouble with having all these virtual images is they take up a lot of space, so I was now beginning to run out of disk space. Time to get rid of those unused partitions.</p>
<p>The tool for the job is the gparted live CD, which I hadn't used for about a year. I was pleased to see that the latest version, despite a modest increment in its version number, is streets ahead of the last one I used. Great job guys!</p>
<p>So here's what we do.</p>
<ol>
<li>Plug in an external USB drive to back up onto.</li>
<li>Boot from the gparted Live CD, and make sure the USB drive is mounted. eg.
<ul>
<li>mount -t vfat /mnt/sda1 /mount/usb</li>
</ul>
</li>
<li>Start partimage from the menu, and use it to back up the partitions we're going to delete. Hack them into 2Gb chunks as suggested by partimage, as we're backing up to a VFAT drive. A 20Gb partition took about 20 mins. That's fast if you've ever used something like Encase &#8230;</li>
<li>Back up any live data partitions you've got as well, just for good measure. You can delete them if all goes well</li>
<li>Use Gparted to delete the partitions on the disk that you don't want.</li>
<li>Reboot the computer and check you got rid of the correct ones &#8230;</li>
<li>OK now to organise them</li>
</ol>
<p><strong>Rearranging the partitions on the disk</strong></p>
<p>Reboot into the Gparted CD. In my case what I now have is</p>
<ul>
<li>a 10 Gb root Linux partition (/) on /dev/hda5</li>
<li>a 1 Gb swap partition on /dev/hda6</li>
<li>a 100Mb /boot partition on /dev/hda7</li>
<li>a 15Gb vfat data partition on /dev/hda3 which is in an extended partition, /dev/hda4</li>
<li>Two chunks of free space.</li>
</ul>
<p>Moving partitions around in gparted is just a case of copying and pasting. Really. The potential for disaster is high, but if you're all backed up, then there's nothing to lose right? I cut and pasted, and re-sized and re-organized, until I was left with this:</p>
<ul>
<li> /dev/hda1 &#8211; 20Gb &#8211; Linux main system (moved and enlarged)</li>
<li>/dev/hda2 &#8211; 100Mb &#8211; /boot partition (moved)</li>
<li>/dev/hda4 &#8211; 1 Gb &#8211; swap partition (moved)</li>
<li>/dev/hda3 &#8211; Extended partition containing
<ul>
<li>/dev/hda5 &#8211; 17 Gb Data partition (enlarged)</li>
<li>/dev/hda6 &#8211; 17Gb /home partition (newly created to house all the VMs)</li>
</ul>
</li>
</ul>
<p>Having done such major reconstructive surgery I knew I was in for a few glitches on boot up, but I knew I could get around them eventually.</p>
<p>This post has got a bit long &#8230; its continued <a href="http://play.datalude.com/blog/?p=18">here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://play.datalude.com/blog/2008/02/the-big-switch-part-6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
