2012-03-19

Disk Cloning (for Data Recovery) with GNU ddrescue

Disclaimer: This article is intended for those of you technically inclined enough to even attempt data recovery. This involves (minimally) being able to burn a CD, use command-line utilities, and some hardware knowledge.

Things to Know

If your hard drive is dying (i.e. making weird clicky noises, giving read errors, etc) MAKE A CLONE COPY OF IT ASAP. The more you use your dying drive, the greater the likelihood of more errors developing. Copy your data onto a different (not dying) drive and then stop using the bad drive. Always perform data recovery techniques on a copy of the original drive. If one of the data recovery techniques fails, it may further scramble your data. Work from a copy. I can't emphasize that enough.

Linux has a very handy tool called ddrescue which can make a clone copy of a disk. It also offers the option to keep retrying to read the bad areas after the first pass, in hopes that maybe it'll work on the 2nd, 3rd, 4th try, etc.

Things You Will Need
  • Your bad hard drive.
  • A working hard drive which has at least as much storage as your bad hard drive.
  • A way to burn yourself a copy of  System Rescue CD (or any other Linux Live CD which includes ddrescue)
  • A computer with both (bad and good) drives connected to it.
The Procedure
  1. Boot the computer with the System Rescue CD.
  2. At the root# prompt type fdisk -l to list all the attached drives.
  3. Assuming we're dealing with 2 modern SATA hard disks, likely one will be listed as /dev/sda and one will be listed as /dev/sdb (this may vary depending on your configuration)

    For the purpose of this article, we shall say /dev/sda is the bad drive and /dev/sdb is the working drive.
  4. Clone sda to sdb with ddrescue:

    root# ddrescue -r=1 -n -S -v /dev/sda /dev/sdb recovery.log
  5. Here's a breakdown of what the command actually does:
    1. -r=1 = retry the damaged areas infinite times
    2. -nSkip the splitting pass. Avoids spending a lot of time trying to rescue the most difficult parts of the file.
    3. -S = Sparse mode. May save a lot of disk space in some cases.
    4. -v = Verbose mode. Shows all the details about what's happening.
    5. /dev/sda = the source drive
    6. /dev/sdb = the destination drive
    7. recovery.log = The name of the log file. (can be whatever name you want.) In case you need to stop and restart the process, the log file will keep the spot of where the process left off.
  6. This process can be very slow. Depending on the size of your drive and how badly it's performing, it can take days. However, if your data is really that important, it's worth it. Patience is key.
  7. Once the drive finishes it's initial pass of copying the good parts of the drive, it will continue to retry the areas which had errors. Typically by about 4+ passes of the bad areas, it's pretty much certain you're not going to get any more information from those areas of the drive. Cancel the ddrescue process via CTRL-C. Store the damaged drive in a static bag. Don't do anything more with it in case you need to clone it again.
  8. Hook up the drive with the copy of the bad disk as a secondary drive on a working computer. See if you can access the data. There's a number of applications available which will attempt to repair the drive if it's still unreadable. (Perhaps the File Allocation Table needs to be rebuilt.)
Here is a pretty good list of data recovery software you may want to try on your cloned disk.
Just remember don't run data recovery software on the original drive. It may cause further damage to the disk and render your data completely unrecoverable. Always work from a copy.

2012-02-20

Filebot


Quickie article today, cuz well, there’s not much to say about this except it’s awesome.
Filebot is awesome.
If, like me, you find yourself renaming TV episode files and movie files all the time, you owe it to yourself to check it out.

It's Java based, so it's cross platform.

How to Create "Stationery" for your emails, using Gmail and Thunderbird


Gmail account settings required
  1. Assuming you're sending these emails from a gmail account, you'll need to configure Gmail to enable IMAP access.
    (IMAP is what Thunderbird uses to communicate with the Gmail servers.)
  2. In Gmail, click the gear in the upper right corner and go to "Mail Settings"
  3. In Mail Settings, click the "Forwarding and POP/IMAP" section.
  4. In IMAP settings, make sure the "enable IMAP" box is checked.
  5. Click the "Save Changes" button at the bottom.
Software Required
  1. First, install Thunderbird. Get it here -- http://www.mozilla.org/en-US/thunderbird/
  2. Once Thunderbird is installed, open it up.
  3. From the Tools menu, select Add-ons.
  4. In the "Get Add-ons" section, go to the "Search all add-ons" box in the upper right, and search for "stationery".
  5. Stationery version 0.7.6 should show up in the results. Click the "install" button on the right of it.
  6. Once the add-on is installed, Quit and Re-open Thunderbird.
  7. Next to the "Write" button there should now be a little dropdown arrow which lets you specify a type of stationery.
Configuring Thunderbird
  1. First we need to setup Thunderbird to be able to send/receive email using the Gmail servers.
  2. Fortunately, there's an entire page here which explains how to do it -- https://mail.google.com/support/bin/answer.py?hl=en&answer=180189
  3. Please note that while those instructions are written for Thunderbird 3.0 they should still work roughly the same for whatever the current version of Thunderbird is.
Creating Stationery(This is probably the trickiest bit)
  1. In Thunderbird, click the Write button to compose a new email.
  2. Click inside the main composition window.
  3. Using the "Format" option on the main menu bar, change how the email looks to be a template for your emails. (Background color, font color, background image, standard tables, signatures, links, etc.)  Basically everything except that actual text that will change with every email.
  4. Once it looks how you want the stationery to look, click the dropdown arrow next to the "Save" button and save it as an HTML file.
  5. Close the Write window once you've saved your stationery template.
  6. From the main window of Thunderbird, go to the "Tools" menu and select "Add-ons"
  7. In the Extensions section, you should see the Stationery add-on listed. Click the "Preferences" button to the right of it.
  8. In the Stationery options window which pops up, you should be looking at the Manage Templates section.
  9. Click the "add new" button and browse to the HTML file we just saved.
  10. The template should be added to the list.
  11. Close the Stationery Options window.
Assuming everything went okay up to this point, you should now be able to click the dropdown arrow next to the "Write" button in Thunderbird, and select to compose a new email using the stationery you just created.
Simple! ;)

How to reset your OS X Lion password


Ran into an issue today where a user had completely forgotten all passwords on the computer.
Turns out there's a way to reset it without even needing the OS X DVD.
  1. Boot into Single User Mode (hold down Command+S while booting)
  2. At the root prompt (# prompt), enter the following commands:
  3. /sbin/fsck -fy
    This performs a disk check before making any changes to the system.
  4. /sbin/mount -uw /
    This makes the root filesystem writable.
  5. launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
    This starts up the service allowing you to change the password.
  6. passwd username
    It should prompt you to change the password of username
  7. Assuming it went through, type reboot and you should be able to login with your new password.