Monday, April 21, 2008

Finding and Verifying MD5 Hash of PS3 Firmware Update

If you are like me and living in a low bandwidth country, you will face the issue of having to download the PS3 Update file using a PC and then updating via the USB method. This means there is a risk of the update file (PS3UPDAT.PUP) getting corrupted during the download and you have no protection against it destroying your PS3.

To mitigate the risk in this, the MD5 sum for the PS3 Update file can be checked. To do this in Windows XP, download MD5 Sum checker (md5sum.exe) from here. Then look at the URL of the update file:

http://dsa01.ps3.update.playstation.net/update/ps3/image/sa/2008_0415_dd2e675fce5d2eb28ca93bc32edb3de6/PS3UPDAT.PUP

The last part of the URL, from the final _ to the last / (in red) is the MD5 sum.

In this case (for 2.30) the MD5 sum is : dd2e675fce5d2eb28ca93bc32edb3de6

Now place the md5sum.exe in the same folder as your PS3UPDAT.PUP. Open a command prompt, cd to the update folder.

Then run: md5sum.exe PS3UPDAT.PUP

If the output is same as the code you found as above, you are all set! You should get something like:

dd2e675fce5d2eb28ca93bc32edb3de6 *PS3UPDAT.PUP

Else, re download...

Sunday, April 6, 2008

DVD/CD/Hard Drive Mirroring and Data Recovery using Linux (Kubuntu/Ubuntu)

So one of the Y-Cables in my computer failed. This caused (I think) random voltages to pass into my hard disk, which too started failing. Soon I found myself minus a hard disk and a lot of data. I had another hard disk of the exact same model, so I decided to use a Kubuntu/Ubuntu live disk to restore my failing hard disk to the other one.

My first attempt was to use dd.

dd if =/dev/hdX of=/dev/hdY

Now this would work but only because both hard disks were the exact same model. If they weren't I would have had to create a hard disk image and then copy data from that manually... not very useful. Unfortunately, the above doesn't work - dd stops at the first error. So a little research on the net showed the way:

dd bs=4k if=/dev/hdX of=/dev/hdY conv=noerror,sync

to mirror, or for an image

dd bs=4k if=/dev/hdX of=/path/to/image conv=noerror,sync

What do each of these options do? bs=4k makes dd copy in blocks of 4KB to ensure that it doesnt miss any good sectors, noerror means dont stop for errors, and sync means in case of an error output empty bytes so that the output image is not corrupted.

This unfortunately has a problem: bs=4k is miniscule. Telling dd to work like this will take days to recover data. Ideally we need something that moves extremely fast over a hard disk, scanning and copying good sectors with a large block size and then going back to reattempt the erroneous sectors with a smaller block size. There used to be a convoluted way to do this, using a program called dd_rescue and a batch file called dd_rhelp. However, this is not very efficient - the use of a batch file by definition slows things down. So the guys at GNU have come up with a very efficient program which does this automatically, called (guess?) ddrescue.

First you need to install ddrescue to your Live CD.

sudo apt-get install gddrescue

Note you need the gddrescue package not ddrescue. If you are unable to access the internet from your Live CD, you can download gddrescue*.deb (for your version of (K)Ubuntu) from here, copy it to a flash drive and then install it inside of the Live CD using

sudo dpkg -i gddrescue_1.2-1_i386.deb

There's a lot of advanced stuff you can do with ddrescue (see the man page, or the information here, here and here) However, in most normal use cases, you can jest get the data out using this command:

ddrescue /dev/hdX /dev/hdY /path/to/save/recovery.log

or, for an image

ddrescue /dev/hdX /path/to/image /path/to/save/recovery.log

The third option is non-compulsory. What it does is read and save a recovery log, so that if you have to shut down your machine or it crashes in the middle or recovery (recovery can take a LONG time for hard disks), ddrescue can resume seamlessly from where it left off (aint it cool)

Once you have the data out, if you mirrored your hard disk, you can just start using the new hard disk as normal (first making it a master etc). If you made an image, you can get the data from it out using

mkdir imagemout
sudo mount -o loop /path/to/image imagemount

For CD/DVDs, the output of dd/ddrescue is an ISO, which can be read or burned using any standard tool. Note that for DVD/CDs all the above applies, just for dd you have to use bs=2k not bs=4k

Of course, none of the above was useful for me... just putting in a new Y-Cable stopped any errors from showing up... I actually tossed a hard disk into the trash can, realized it wasnt the hard disk which was faulty and pulled it out. (And now it is running my Windows XP)

Long time no see

Whew! Been a LONG time since my last update :) Not that I haven't been doing stuff, just didn't get time to blog about it. I have had a lot happen - I bought a PS3, a HDTV and a Wireless Router for my house, expect updates on that soon. In fact, I have a ton of stuff to write, I just need to collect my thoughts and start writing ... So here goes...