<?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>Hack Admin &#187; Partimage</title>
	<atom:link href="http://www.hackadmin.com/tag/partimage/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Disk Imaging with Partimage</title>
		<link>http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/</link>
		<comments>http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/#comments</comments>
		<pubDate>Sun, 31 May 2009 21:35:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Disk Imaging]]></category>
		<category><![CDATA[master boot record]]></category>
		<category><![CDATA[mbr]]></category>
		<category><![CDATA[Partimage]]></category>
		<category><![CDATA[partition table]]></category>
		<category><![CDATA[recovery cd]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Ubuntu Imaging]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/</guid>
		<description><![CDATA[I&#8217;ve been looking for an easy way to do some imaging so I can swap back to a clean Ubuntu load that has a certain amount of prep done in a relatively quick fashion.  What I think I&#8217;m going to use is partimage .    Here&#8217;s the breakdown of how I&#8217;m doing it:
I have 2 machines.  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for an easy way to do some imaging so I can swap back to a clean Ubuntu load that has a certain amount of prep done in a relatively quick fashion.  What I think I&#8217;m going to use is <a href="http://www.partimage.org">partimage</a> .    Here&#8217;s the breakdown of how I&#8217;m doing it:</p>
<p>I have 2 machines.  My main Ubuntu box which has a ton of storage on it, and a crappy old gateway thats got about a 20GB disk.</p>
<p>I do a clean load of whichever Ubuntu version I want to image on the gateway.</p>
<p>Next, I add any custom packages, network keys, etc etc, to the newly loaded box.</p>
<p><span id="more-19"></span>Once I have it like I want, I reboot the system to a recovery cd that you can download from <a href="http://www.sysresccd.org">this site</a> .  This is a good image in that it has the tools we&#8217;ll need to make partimage work.</p>
<p>On my main server I create an NFS share to /mnt/images and export it.</p>
<p>Once booted to the recovery CD, I first add an ip address to eth0</p>
<p><em>root@sysresccd: ifconfig eth0 192.168.2.2</em></p>
<p>Then I mount the share on the main box</p>
<p><em>root@sysresccd: mount -t nfs 192.168.2.1:/mnt/images /tmp/images</em></p>
<p>Once this is complete, I first take a copy of my  MBR like so:</p>
<p><em>root@sysresccd: dd if=/dev/sda of=flash-sda.mbr count=1 bs=512</em></p>
<p>Next, I make a copy of the partition table:</p>
<p><em>root@sysresccd: sfdisk -d /dev/sda &gt; flash-sda.fs</em> (Note: sfdisk is a utility that comes by default on the resource disk refereced earlier)</p>
<p>At this point, we have the data we need to recreate our master boot record as well as our existing partition tables.  We now need to get images of the data.  This is where partimage does it&#8217;s thing.  To initiate the gui for partimage simply type partimage  at the recovery CD prompt.</p>
<p><a id="file-link-20" class="file-link image" title="Partimage Main Screen" href="http://www.hackadmin.com/wp-admin/upload.php?style=inline&amp;tab=browse&amp;post_id=19&amp;_wpnonce=283515e0f5&amp;ID=20&amp;action=view&amp;paged"> </a><a title="Partimage Main Screen" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-first.png"><img title="Partimage Main Screen" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-first.png" border="0" alt="Partimage Main Screen" width="450" height="350" /></a></p>
<p>Once you&#8217;re in the GUI, you should see the slices that are available on the disk.  In my case I have 3 sda1, sda2 and sda5.  This is the default configuration of an Ubuntu 9.04 install.  I  can see from the gui, that one slice is the majority of my disk, 18.25G, and is labeled as ext3fs.  This is the slice that is holding all of the data.  The second slice is labeled extended and has no file system info, and the third slice is labeled as swap.  All I need is an image of sda1 and I&#8217;m good to go.</p>
<p>In the GUI, I need to make sure that sda1 is highlighted, then tab to the &#8220;Image file to create/use&#8221; text box.</p>
<p><a title="Partimage File Name" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-2.png"><img title="Partimage File Name" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-2.png" border="0" alt="Partimage File Name" width="450" height="350" /></a></p>
<p>In this box I will put the name of the image that I will create of sda1.  I&#8217;ll use a path to the nfs mount so the image will be saved to my secondary machine, just as my mbr and fs information was.  Then hit F5 to continue</p>
<p>On the next screen I choose a compression level of &#8220;None&#8221;, because it&#8217;s the only happening on my LAN, and it&#8217;s fast.  Then hit F5 again to continue.</p>
<p><a title="Partimage 3" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-3.png"><img title="Partimage 3" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-3.png" border="0" alt="Partimage 3" width="450" height="350" /></a></p>
<p>The app then asks for a description of the image.  Add whatever you like here.</p>
<p>Depending on the size of your slice, this next step might take some time.  Once it completes, you will have all the info necessary to do a bare metal restore of the machine.</p>
<p>To test, all you need to do is use fdisk to destroy the existing partition table.</p>
<p>From the sysresccd command prompt type in: fdisk /dev/sda  (or whatever your disk is).</p>
<p>From here, you&#8217;ll see a prompt similar to the one below:</p>
<p><a title="fdisk-1" href="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-1.png"><img title="fdisk-1" src="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-1.png" border="0" alt="fdisk-1" width="450" height="350" /></a></p>
<p>From this interface you can use the &#8220;p&#8221; command to print the existing partition table:</p>
<p><a title="Fdisk-2" href="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-2.png"><img title="Fdisk-2" src="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-2.png" border="0" alt="Fdisk-2" width="450" height="350" /></a></p>
<p>Our goal here is to make it a blank disk, clear of partition information and then write our changes.</p>
<p>Step One is to delete what is there, the following screen shot shows this process, I delete all of the primary partitions, print to verify and then write the changes with the &#8220;w&#8221; command.</p>
<p><a title="Fdisk-3" href="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-3.png"><img title="Fdisk-3" src="http://www.hackadmin.com/wp-content/uploads/2009/05/fdisk-3.png" border="0" alt="Fdisk-3" width="450" height="350" /></a></p>
<p>Now we are going to use the previously created MBR and FS files to recreate the partition tables.  The following screen shot shows this process.</p>
<p>1.)  Use DD to rewrite the master boot record.</p>
<p>2.) Use sfdisk to import the partition data.</p>
<p><a title="restore-partitions.png" href="http://www.hackadmin.com/wp-content/uploads/2009/05/restore-partitions.png"><img title="restore-partitions.png" src="http://www.hackadmin.com/wp-content/uploads/2009/05/restore-partitions.png" border="0" alt="restore-partitions.png" width="450" height="429" /></a></p>
<p>At this point, you can check fdisk and see that the disk is back in the condition that it was after the Ubuntu load.</p>
<p><a title="Check Fdisk" href="http://www.hackadmin.com/wp-content/uploads/2009/05/check-fdisk.png"><img title="Check Fdisk" src="http://www.hackadmin.com/wp-content/uploads/2009/05/check-fdisk.png" border="0" alt="Check Fdisk" width="450" height="328" /></a></p>
<p>The last step here will be to reimage sda1 with the data from the partimage backup.  We&#8217;ll want to start partimage again from the recovery disk:</p>
<p>1.) Make sure your restore slice is highlighted, then tab to the file name textbox.</p>
<p>2.) Add the filename of the image that is on the NFS share.</p>
<p>3.) Make sure that you move the * to &#8220;Restore partition from an image file&#8221;.</p>
<p><a title="partimage restore 1" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore1.png"><img title="partimage restore 1" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore1.png" border="0" alt="partimage restore 1" width="450" height="350" /></a></p>
<p>Press F5 to continue.</p>
<p>In the following dialog, if you are confident in what we have done to this point, there is no need to change anything, just press F5 to continue and the image restore will begin.</p>
<p><a title="partimage restore 2" href="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore2.png"><img title="partimage restore 2" src="http://www.hackadmin.com/wp-content/uploads/2009/05/partimage-restore2.png" border="0" alt="partimage restore 2" width="450" height="350" /></a></p>
<p>Once the restore finishes, press enter on the &#8220;OK&#8221; and then reboot your box.  Try to hold back the excitment when it comes up exactly as you left it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2009/05/31/disk-imaging-with-partimage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

