<?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>Pario TechnoBlob &#187; dd</title>
	<atom:link href="http://pario.no/tag/dd/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 26 Apr 2012 08:18:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to corrupt a disk partition using dd</title>
		<link>http://pario.no/2011/11/14/how-to-corrupt-a-disk-partition-using-dd/</link>
		<comments>http://pario.no/2011/11/14/how-to-corrupt-a-disk-partition-using-dd/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 10:49:39 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[dd]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1628</guid>
		<description><![CDATA[I wanted to test corruption of a 41TB XFS filesystem and the dd command was the perfect tool for the job. I used a block size of 512 bytes and wrote 10 blocks of data from device /dev/urandom to the partition /dev/sdb1. The &#8220;Seek&#8221; option specifies how many blocks are skipped, counting 100 blocks from [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to test corruption of a 41TB XFS filesystem and the dd command was the perfect tool for the job.<br />
I used a block size of 512 bytes and wrote 10 blocks of data from device /dev/urandom to the partition /dev/sdb1.<br />
The &#8220;Seek&#8221; option specifies how many blocks are skipped, counting 100 blocks from the beginning of the partiton, before writing the random/corrupted data.</p>
<pre>
# dd bs=512 count=10 seek=100 if=/dev/urandom of=/dev/sdb1</pre>
<p><strong>Caution!</strong><br />
This procedure WILL most likely corrupt your disk partition or files on the partition. Use it ONLY on test systems and with a valid backup!</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMTEvMTEvMTQvaG93LXRvLWNvcnJ1cHQtYS1kaXNrLXBhcnRpdGlvbi11c2luZy1kZC88d3B0Yj5Ib3cgdG8gY29ycnVwdCBhIGRpc2sgcGFydGl0aW9uIHVzaW5nIGRkPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2011/11/14/how-to-corrupt-a-disk-partition-using-dd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup partition table</title>
		<link>http://pario.no/2009/03/19/backup-partition-table/</link>
		<comments>http://pario.no/2009/03/19/backup-partition-table/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 21:51:05 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[recovery]]></category>

		<guid isPermaLink="false">http://pario.no/?p=983</guid>
		<description><![CDATA[This post describes how you can backup your partition table for future recovery. Backup This example describes how you can backup the disk partition table on /dev/sda dd if=/dev/sda of=sda.mbr bs=512 count=1 It&#8217;s also useful to keep a human readable copy of the disk layout for future reference sudo fdisk -l > partitions.lst Restore This [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how you can backup your partition table for future recovery.</p>
<h2>Backup</h2>
<p>This example describes how you can backup the disk partition table on <strong>/dev/sda</strong></p>
<pre>
dd if=/dev/sda of=sda.mbr bs=512 count=1</pre>
<p>It&#8217;s also useful to keep a human readable copy of the disk layout for future reference</p>
<pre>
sudo fdisk -l > partitions.lst</pre>
<h2>Restore</h2>
<p>This example shows how you can recover your file system using your partition table backup.</p>
<pre>
dd if=sda.mbr of=/dev/sda bs=512 count=1</pre>
<p>This is a nice way to keep the information about your file system and will it help you in the future if you get disk corruption.<br />
This does not only apply to linux partitions but all types of partitions.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDMvMTkvYmFja3VwLXBhcnRpdGlvbi10YWJsZS88d3B0Yj5CYWNrdXAgcGFydGl0aW9uIHRhYmxlPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/03/19/backup-partition-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount a RAID Reconstructor disk image in linux</title>
		<link>http://pario.no/2009/01/19/mount-a-disk-image/</link>
		<comments>http://pario.no/2009/01/19/mount-a-disk-image/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 11:52:12 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[offset]]></category>
		<category><![CDATA[RAID Reconstructor]]></category>
		<category><![CDATA[testdisk]]></category>

		<guid isPermaLink="false">http://pario.no/?p=894</guid>
		<description><![CDATA[This post came to life because I had gotten a image file of a 120GB linux ext2 RAID partition that I couldn&#8217;t access using Windows software. The partition had been rescued by RAID Reconstructor, a Windows software that can rebuild RAID arrays by combining the disks from the RAID and store it as one image [...]]]></description>
			<content:encoded><![CDATA[<p>This post came to life because I had gotten a image file of a 120GB linux ext2 RAID partition that I couldn&#8217;t access using Windows software. The partition had been rescued by <a href="http://www.runtime.org/raid.htm">RAID Reconstructor</a>, a Windows software that can rebuild RAID arrays by combining the disks from the RAID and store it as one image file.</p>
<p>The solution was to use linux and try to mount it as a loop filesystem. My assumption was that the partition itself had an unknown offset, so I used this script to search and mount the partition. The script tries to mount the partition within the first 20000 blocks. I assume the block size is 512 bytes and I already know that the partition is formatted as ext2.</p>
<pre>
for ((i=0 ; $i < 20000 ; i=$i + 1)) ; do
    mount -t ext2 -o loop,offset=$(($i * 512)) diskimage.img /mnt/point &#038;&#038; break
done
</pre>
<p>If it succeeds you can issue the mount command to get the offset value to the mounted partition</p>
<pre>
# mount | grep diskimage

/dev/loop0 on /mnt/point type ext2 (rw,offset=32256)
</pre>
<p>In my case the offset was 32256.</p>
<p>This script can also be used to mount a partition from a backup of your filesystem.</p>
<p><strong>Example</strong><br />
This is my example disk I'm going to create an image of</p>
<pre>
# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          14      112423+  83  Linux
/dev/hda2              15          96      658665   83  Linux
/dev/hda3              97        3394    26491185   83  Linux
/dev/hda4            3395        9729    50885887+   f  W95 Ext'd (LBA)
/dev/hda5            3395        7218    30716248+  83  Linux
/dev/hda6            7219        8750    12305758+  83  Linux
/dev/hda7            8751        9533     6289416   83  Linux
/dev/hda8            9534        9729     1574338+  83  Linux
</pre>
<p>Create a backup image of your entire disk</p>
<pre>
# dd if=/dev/hda of=imagefile.img</pre>
<p>To mount one of these partitions as a loop filesystem you can issue a mount command and tell it the right offset. Use the script above if you don't know the offset, it will take the guesswork for you and mount the partition.</p>
<p>Example of mounting /dev/hda3 if the offset is known</p>
<pre>
# mount -t ext3 -o loop,offset=49664 /dev/hda3 /mnt/point</pre>
<p>Determining the offset is easy when you know the disk geometry have access to the file table.<br />
In this case the hda3 partition has an offset of 512 bytes * 96 blocks = 49664.</p>
<p><strong>EDIT</strong><br />
This post could have been avoided if I had known about the linux tool <a href="http://www.cgsecurity.org/wiki/TestDisk">TestDisk</a>. testDisk is a powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table). It could also be used as a forensic tool.</p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/www.runtime.org\/raid.htm","http:\/\/www.cgsecurity.org\/wiki\/TestDisk"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDEvMTkvbW91bnQtYS1kaXNrLWltYWdlLzx3cHRiPk1vdW50IGEgUkFJRCBSZWNvbnN0cnVjdG9yIGRpc2sgaW1hZ2UgaW4gbGludXg8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/01/19/mount-a-disk-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup harddisk to remote machine</title>
		<link>http://pario.no/2007/06/09/backup-harddisk-to-remote-machine/</link>
		<comments>http://pario.no/2007/06/09/backup-harddisk-to-remote-machine/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 23:30:06 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/06/09/backup-harddisk-to-remote-machine/</guid>
		<description><![CDATA[dd bs=1M if=/dev/hda &#124; gzip &#124; ssh user@remote 'dd of=hda.gz']]></description>
			<content:encoded><![CDATA[<pre>
dd bs=1M if=/dev/hda | gzip | ssh user@remote 'dd of=hda.gz'</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDYvMDkvYmFja3VwLWhhcmRkaXNrLXRvLXJlbW90ZS1tYWNoaW5lLzx3cHRiPkJhY2t1cCBoYXJkZGlzayB0byByZW1vdGUgbWFjaGluZTx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/06/09/backup-harddisk-to-remote-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dump/image CDROM to ISO file</title>
		<link>http://pario.no/2007/05/07/dumpimage-cdrom-to-iso-file-2/</link>
		<comments>http://pario.no/2007/05/07/dumpimage-cdrom-to-iso-file-2/#comments</comments>
		<pubDate>Mon, 07 May 2007 11:10:52 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[iso]]></category>
		<category><![CDATA[mkisofs]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/07/dumpimage-cdrom-til-iso-fil/</guid>
		<description><![CDATA[To create an ISO image from your CD/DVD, place the media in your drive but do not mount it. If it automounts, unmount it. # dd if=/dev/cdrom of=/path/til/ISO-fil To make an ISO image from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command # mkisofs [...]]]></description>
			<content:encoded><![CDATA[<p>To create an ISO image from your CD/DVD, place the media in your drive but do not mount it. If it automounts, unmount it. </p>
<pre>
# dd if=/dev/cdrom of=/path/til/ISO-fil</pre>
<p>To make an ISO image from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command</p>
<pre>
# mkisofs -o outputfile.iso /my/folder/</pre>
<p>The resultfile is called <b>outputfile.iso</b> witch contains all the files in the <b>/my/folder/</b> folder.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMDcvZHVtcGltYWdlLWNkcm9tLXRvLWlzby1maWxlLTIvPHdwdGI%2BRHVtcC9pbWFnZSBDRFJPTSB0byBJU08gZmlsZTx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/07/dumpimage-cdrom-to-iso-file-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

