<?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>Yoooder.com &#187; Linux</title>
	<atom:link href="http://yoooder.com/wordpress/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://yoooder.com/wordpress</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 08 Jul 2011 14:13:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Recovery from a dead FAT32 Windows drive</title>
		<link>http://yoooder.com/wordpress/2007/10/recovery-from-a-dead-fat32-windows-drive/</link>
		<comments>http://yoooder.com/wordpress/2007/10/recovery-from-a-dead-fat32-windows-drive/#comments</comments>
		<pubDate>Sat, 06 Oct 2007 17:51:14 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Data Recovery]]></category>
		<category><![CDATA[Great Utilities]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://yoooder.com/wordpress/?p=18</guid>
		<description><![CDATA[My landlord's old PC has suffered several failures over the years, including several fans and power supplies and at least one hard drive. When I moved in a year ago they called me over to replace yet another PSU for them, and a few months later to figure out why the machine would not even [...]]]></description>
			<content:encoded><![CDATA[<p>My landlord's old PC has suffered several failures over the years, including several fans and power supplies and at least one hard drive.  When I moved in a year ago they called me over to replace yet another PSU for them, and a few months later to figure out why the machine would not even begin to boot.</p>
<p>The suspect was immediately either the IDE controller or both of its drive.  After transplanting the drives to a seperate machine and failing to find their partitions, and after trying a new drive in the machine it was looking as though possibly all were fried.</p>
<p>A couple months have passed and my landlord has had me build him a new computer and the day has come to try to recover his data...  Below is the process I've used to diagnose and recover his files.<span id="more-18"></span></p>
<p>1) Attempt to image the entirety of the drive</p>
<p>With the physical stability of the drives in question, the first order of business was to mitigate the amount of work done against the failed drives themselves. Windows claimed the drives were unformatted, and linux would not let me mount them (although their partition tables were visible).</p>
<p>The weapon of choice was dd, a data-copy utility that works at a low level and with a little bit of knowledge can be an invaluable tool. dd can be extremely dangerous if you aren't careful with it!!! dd is basically a data-copy tool which takes a couple arguments; "if" (input file) and "of" (output file). The device/file you set "if" to will be copied to the "of" device/file. You can add more parameters to control the amount of data copied, and the blocksize that the harddrive's partition uses.</p>
<p>Example: Backing up a drive's partition table</p>
<p>The drive partition table is stored in the first kilobyte (not certain this is always true, it may depend on the block size) of the partition. To make a backup:</p>
<p>dd if=/dev/[drive] of=$HOME/[drive]_part.bak bs=1k count=1</p>
<p>This will copy the first kilobyte (bs=1k count=1) from /dev/[drive] to a file called [drive]_part.img in the executing user's home directory.</p>
<p>Back to data recovery with dd... to make an image of the entire drive I used the following command, note that this creates a file equal to the physical size of the disk, so be sure you have enough room. i.e. if you have a 1GB partition on a 100GB drive (and 99GB unpartitioned) the resulting image will be 100GB.</p>
<p>dd if=/dev/[drive] of=$HOME/backups/[drive].dmg bs=512 (NOTE: bs varies depending on the filesystem settings, common sizes are 512, 1024, and 4096, although many others are possible. One way to determine the block size is to try copying one 512b block, one 1k block, and one 4k block (so on so forth). Wrong block sizes should result in an error, ruling out the selection.</p>
<p>dd does not work through errors by default, so if it finds bad sectors or other obstacles it will error out--providing evidence of the type of failure on your hands. I lucked out, and dd ran through the full 20GB drive without error which told me that the drive failure was likely with the partition or filesystem and not a hardware failure. If dd fails due to drive errors such as bad sectors you can use ddrescue or gddrescue, both of which use dd and will replace errors with null (nothing) values in the image, resulting in a backup image of as much data as possible. One other very cool feature is if you use these tools to copy from a device that is inconsistently reading it's contents then you can run the tool multiple times, and if a 2nd (or 3rd, 4th...) pass is able to successfully read what a previous pass failed at it will fill in the void left by the earlier passes due to the error. This proves wonderfully useful on scratched CDs, among other things.</p>
<p>Now for the real fun: With the disk image in place I shutdown and remove the physical drive from the machine (so that if it is a hardware issue, any further damage will be prevented. My landlord was considering having the drive professionally recovered if we were unsuccessful, so we wanted to make sure we did no further harm to it). Upon booting back up I set the drive image to a loopback device, which lets you mount a disk image like it were a regular drive (iso's work great with this)</p>
<p>2) Attempt to mount the image</p>
<p>After unplugging and removing the dead drive I tried to mount the image I'd just made:</p>
<p>mount /home/steve/[drive].dmg -o loop -t vfat /mnt/recovery</p>
<p>But it failed, barking about a bad superblock. This was starting to look more like a bad partition table than a fried drive--so back in went the drive.</p>
<p>3) A great utility</p>
<p>After some Googling I found multiple references to a utility called testdisk which is a free drive recovery tool. My only beef was that it only seems to work on physical drives, not loopback images (like what I made above). So with the drive back in I ran testdisk, and after selecting the appropriate drive and type from it's menus it immediately told me I had a bad partition table.</p>
<p>Using the restore and scan options of testdisk brought the drive totally back to life! I was very impressed by it, as it seems to have a lot of power under the hood but not a lot of difficulty in it's user-interface.</p>
<p>The drive lived! I saved it's updated partition tables back to the drive, rebooted as it recommened and was able to successfully mount the partition.</p>
<p>4) Get everything off the drive</p>
<p>There was no sense running the risk of letting the drive cause more problems, especially as there was over a Terabyte of free space on the new machine. So I rsync'd everything off of it immediately:</p>
<p>rsync -av /mnt/[mountpoint] /var/storage/recovered/</p>
<p>5) Shred the drive</p>
<p>The old 20GB drive was recovered, and my landlord wanted to recycle it (give it away). So first we wanted to shred any remnants of it's contents. There is a GNU utility aptly named "shred" that does specifically this.</p>
<p>shred /dev/[drive]</p>
<p>And many hours later (shred defaults to 25 passes, which is extreme but can be changed) the drive was wiped clean.</p>
]]></content:encoded>
			<wfw:commentRss>http://yoooder.com/wordpress/2007/10/recovery-from-a-dead-fat32-windows-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining / Recovering a Partition&#8217;s UUID (Univeral Unique Identifier)</title>
		<link>http://yoooder.com/wordpress/2007/10/determining-recovering-a-partitions-uuid-univeral-unique-identifier/</link>
		<comments>http://yoooder.com/wordpress/2007/10/determining-recovering-a-partitions-uuid-univeral-unique-identifier/#comments</comments>
		<pubDate>Sat, 06 Oct 2007 17:39:39 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Data Recovery]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://yoooder.com/wordpress/?p=17</guid>
		<description><![CDATA[I made a boo-boo after reinstalling my base Ubuntu system, and accidently copied over the entirety of the fresh installation's /etc/fstab file with my old /etc/fstab. The UUIDs of my new installation were lost, so after a little Googling I found that there's a helpful little utility called "vol_id" specifically for determining this type of [...]]]></description>
			<content:encoded><![CDATA[<p>I made a boo-boo after reinstalling my base Ubuntu system, and accidently copied over the entirety of the fresh installation's /etc/fstab file with my old /etc/fstab.</p>
<p>The UUIDs of my new installation were lost, so after a little Googling I found that there's a helpful little utility called "vol_id" specifically for determining this type of info...</p>
<p>vol_id [partition]</p>
<p>and voila, I've got my fstab back in fine shape <img src='http://yoooder.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://yoooder.com/wordpress/2007/10/determining-recovering-a-partitions-uuid-univeral-unique-identifier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an encrypted volume</title>
		<link>http://yoooder.com/wordpress/2007/03/backlog-03192007-2/</link>
		<comments>http://yoooder.com/wordpress/2007/03/backlog-03192007-2/#comments</comments>
		<pubDate>Tue, 20 Mar 2007 03:40:22 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://yoooder.com/wordpress/?p=11</guid>
		<description><![CDATA[I needed to meet my company's required security policy for taking source code offsite: 256bit AES encryption. Since the source code I had on my laptop was within a Virtual Machine, I thought it would be a good solution to make an encrypted filesystem big enough for the VM, and only mount it when I [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to meet my company's required security policy for taking source code offsite: 256bit AES encryption.</p>
<p>Since the source code I had on my laptop was within a Virtual Machine, I thought it would be a good solution to make an encrypted filesystem big enough for the VM, and only mount it when I wanted to work.</p>
<p>Here's my requirements:<br />
- Encrypted FS that is (un)mountable whenever need be<br />
- Passphrase to mount the filesystem<br />
- 30GB of storage within the filesystem, to accomodate the 30GB VM disk.<span id="more-11"></span></p>
<p>First, we create a file that will become the filesystem.  Using dd we make it the size we want:<br />
dd if=/dev/zero bs=1G count=30 of=/home/steve/devel_image</p>
<p>Here's what the attributes mean:<br />
if is the input file since we're making an empty file we'll set if to /dev/zero, which will give us an empty file of zeros<br />
of is the output file, or the file you want to create.  Here I'm telling it to make a file called devel_image in my /home/steve folder<br />
bs is the bytes, but I like to call it the bucket size, since the way it is used is to declare your unit size.  Here 1G means we wants 1GB chunks, or buckets.  You can give it different units, 1M, 5G, whatever.<br />
count is the number of buckets you wish to use.  Since we want a 30GB file, and are using 1G buckets, we'll need 30 of them to make 30GB.</p>
<p>This makes a 30GB file called devel_image in my home directory, and takes some time to complete (30 gigs is kinda big, y'know?)</p>
<p>Next we setup a loopback device (which will make the system see the file as a drive).  using losetup you can create the device, and you can even add encryption at this point--however it's becomming deprecated, and better to handle the encryption on it's own (as cryptoloop support will be removed from the kernel at some point</p>
]]></content:encoded>
			<wfw:commentRss>http://yoooder.com/wordpress/2007/03/backlog-03192007-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wiping a hard drive</title>
		<link>http://yoooder.com/wordpress/2007/03/backlog-03192007/</link>
		<comments>http://yoooder.com/wordpress/2007/03/backlog-03192007/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 22:40:05 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://yoooder.com/wordpress/?p=10</guid>
		<description><![CDATA[Wiping a HardDrive is a common task at the workplace or whenever you're getting ready to sell a PC. There is a utility to do just such a thing in almost all Linux Bootdisks called shred. Shred can be used to wipe files, or whole drives. To wipe a drive, the following parameters are good [...]]]></description>
			<content:encoded><![CDATA[<p>Wiping a HardDrive is a common task at the workplace or whenever you're getting ready to sell a PC.  There is a utility to do just such a thing in almost all Linux Bootdisks called shred.</p>
<p>Shred can be used to wipe files, or whole drives.  To wipe a drive, the following parameters are good to know<br />
-z     After shredding, one more pass will be made to write all zeros to the drive, not necessary, but it hides the fact that the disk has been shredded<br />
-v     Display messages about progress, which is handy since shredding a drive takes a fair deal of time<br />
-n x    x is the number of passes you wish to make.  3 is a good number, and if you use the -z option it will be 3 shredding passes followed by a 4th pass to zero out all the data</p>
<p>Put it together and pass it a drive to wipe:<br />
shred -zvn 3 /dev/sda</p>
<p>And voila, all your private data goes bye-bye</p>
]]></content:encoded>
			<wfw:commentRss>http://yoooder.com/wordpress/2007/03/backlog-03192007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restoring a lost RAID array</title>
		<link>http://yoooder.com/wordpress/2007/03/backlog-03182007/</link>
		<comments>http://yoooder.com/wordpress/2007/03/backlog-03182007/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 02:39:05 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://yoooder.com/wordpress/?p=9</guid>
		<description><![CDATA[After an upgrade from Edgy to Feisty my RAID array disappeared (aka, I shit my pants). Doing a 'cat /proc/mdstat' produced: Personalities : [raid6] [raid5] [raid4] &#60;none&#62; Thankfully I had backups of my mdadm.conf and lvm.conf files so I knew that as long as I didn't alter the data on the drives I could always [...]]]></description>
			<content:encoded><![CDATA[<p>After an upgrade from Edgy to Feisty my RAID array disappeared (aka, I shit my pants).</p>
<p>Doing a 'cat /proc/mdstat' produced:<br />
Personalities : [raid6] [raid5] [raid4]<br />
&lt;none&gt;</p>
<p>Thankfully I had backups of my mdadm.conf and lvm.conf files so I knew that as long as I didn't alter the data on the drives I could always fall back to Edgy and still have my files.</p>
<p>After trying a few things with mdadm, all unsuccessfully, I decided to uninstall it entirely.  So I made a (second) backup of my mdadm.conf and lvm.conf files, and did a:<br />
apt-get --purge remove mdadm lvm2</p>
<p>This uninstalls the packages and also removes the config files (that's what the --purge option is there for).</p>
<p>After uninstalling them I verified the configs were gone and reinstalled the packages through Synaptic inside of GNOME.  During the install it prompted which arrays were required to boot.  On my failed upgrade I had configured it with "all" but I really didn't need my array at boot time, my root partition is on a standalone IDE drive, so this time I told it "none".</p>
<p>I expected to have more tinkering to do, but after the install I again did a "cat /proc/mdstat" and to my surprise my array was back! *yay*</p>
<p>Now I just had to get my lvm partitions back.  I've found the Gentoo LVM2 installation guide very usefull, and a good resource for LVM, so I turned to it to see how to recover volumes.  The commands to restore my volumes were:<br />
vgscan<br />
vgchange -a y</p>
<p>And voila, my array and it's partitions were good as new.  A quick "mount -a" brought them all up without a glitch!</p>
]]></content:encoded>
			<wfw:commentRss>http://yoooder.com/wordpress/2007/03/backlog-03182007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Edgy to Feisty Upgrade</title>
		<link>http://yoooder.com/wordpress/2007/03/backlog-03182007-2/</link>
		<comments>http://yoooder.com/wordpress/2007/03/backlog-03182007-2/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 00:38:36 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://yoooder.com/wordpress/?p=8</guid>
		<description><![CDATA[I've been running Edgy as a deskop/mythTV box for several months, and have tried Feisty on a spare laptop at work. Feisty includes a large number of multimedia-integration improvements, so I thought I'd try it on my myth-machine. The process is easy-as-pie. Just run "update-manager -c -d" and it's a simple walk-through process. Obligatory Warning: [...]]]></description>
			<content:encoded><![CDATA[<p>I've been running Edgy as a deskop/mythTV box for several months, and have tried Feisty on a spare laptop at work.  Feisty includes a large number of multimedia-integration improvements, so I thought I'd try it on my myth-machine.</p>
<p>The process is easy-as-pie.  Just run "update-manager -c -d" and it's a simple walk-through process.</p>
<p>Obligatory Warning:  Feisty won't be officially released until April, and it's still labeled an Alpha release, so be warned it has lots of bugs and is not stable--personally I see my gnome-panel crash quite often, as well as a number of other oddities.  You've been warned</p>
]]></content:encoded>
			<wfw:commentRss>http://yoooder.com/wordpress/2007/03/backlog-03182007-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

