Ruben Laguna’s blog

Hard Disk Odyssey!

Wow! Today is a great day I thought I missed my iTunes library and outlook email but I managed to recover it.

I’m not really sure how it happened. All began when I moved my old 60GB hard disk to another PC as an extra disk (not boot disk). The other PC had Windows XP installed in its main 250Gb hard disk. I didn’t notice at first but the BIOS didn’t recognized the 60GB disk correctly (wrong size, wrong id) and when I started the Disk Administrator in Windows, it warned me that the disk had’nt a signature and asked me to write a new one. I clicked OK and I think that screwed up the whole disk. As I found later, it ended up with a corrupted MBR and NTFS bootsector. I decided to reboot to see BIOS messages about the disk and now I noticed that size was wrong, etc. I changed the IDE cable (weird cabling problem), rebooted and now the size was ok but I couldn’t mount it in Windows, it didn’t recognized it as a NTFS volume.

The disk administrator did see the disk but the volume information was wrong. It recognized the PhysicalDisk 1 as a dynamic disk instead of basic with errors no format. I started to sweat, valuable assets are held in that disk : my iTunes library (with song ratings and purchased audiobooks). Well I decided to google a little bit about it and I found the following web references:

I will detail the procedure I followed to recover the disk from a state of Dynamic disk with no format to Basic disk with NTFS format.

  1. Use DiskProbe (download link) to read MBR.
    • Start DiskProbe.
    • Choose DRIVES → Physical Drive.
    • Double click on the PhysicalDriveX where X = the ordinal of the disk. Use Disk Administrator to find the ordinal of the disk. When you double click at the PhisicalDriveX it will appear in the Handle 0 area below
    • Uncheck the Read Only checkbox
    • Click on Set Active
    • Click OK
    • diskprobe1.png
    • Select Sectors → Read in the menu. Write 0 as Starting sector and 1 as Number of sectors. Then click Read.
  2. Now you should see something similar to the following
    diskprobe2.png
  3. You can tell that it the MBR because of the the ascii string “Invalid partition table” and because of the end of sector mark 0×55AA at offset 0×1FE.
  4. The disk signature (red) is located at 0×1B8 and the first entry of the partition table (yellow) is located at x1BE
    diskprobe3.png
  5. Examine the first entry in the partition table
    • System ID → 42. This means Dynamic disk .
    • Relative sectors → 3F 00 00 00. The value is little endian so it translated to 00 00 00 3F → **63*+
    • Total sectors → 51 B7 FC 06. Also little endian, translation: 06 FC B7 51 → 117225297
  6. The System ID is wrong so I change it to 07 (NTFS). Sectors → Write
  7. The other values are OK,
    • I checked sector 63 and there is a NTFS bootsector there so I seems ok.
    • 117225297 + 63 = 117225360 which match the value stated in Drives → Volume Information in DiskProbe
  8. I restarted windows. And still nothing the same thing happens, Disk Administrator still shows the same information.
  9. I suspected that Disk Administrator was showing old information and I decided to reset the disk signature present in the MBR to zeroes to force Disk Administrator to reread disk information. In my case the disk signature was 81 7A 7C 4E (located at 0×1b8). As I read later, there are several entries in the Windows registry linked to the current value of the disk signature that hold information about the disk so I to make sure that those registry items get rewritten the best option is to reset the disk signature and let Disk Administrator to recreate those.
  10. Restarted Windows again. Now windows recognizes the drive and assigns it a drive letter but as an unformatted disk, no NTFS, no FAT, nothing.
  11. Using DiskProbe again I read the contents of sector 63, the NTFS bootsector of the partition.
    diskprobe4.png
  12. I review the values there using View → NTFS bootsector
    diskprobe5.png
  13. The total sectors figure 117226241 is obviously wrong. The disk has only 117225360 sectors and the partition couldn’t be 881 sectors larger than the disk.
  14. I changed the value to 117225297 just the same value as in the MBR.
  15. Sectors → Write to make changes permanent.
  16. Restart windows again. And WoW windows recognizes the drive and the files in it.
  17. Chkdsk /f to show some errors but nothing irrecoverable.

You can read more on using Disk Probe here

Very Bad Driver

Someone emailed me this funny video

Wordpress: Search Queries That Point to Your Site

I’ve been using Google Analytics for a while in my site but haven’t look at the reports very closely. One thing is clear when took a look at the reports: most of the traffic come out of google searches.

trafficsources.png

Then I tried to find what exact search queries the users performs to find my site. The google analytics reports for this “search terms” is in my humble opinion a little bit difficult to find. But I found via this post that the report is located at All Reports → Marketing Optimization → Search Engine marketing → Overall keyword Conversion.

searchqueries.png

Note that 80% of the searches are marked as “Other”. Only the top ten searches is shown.

If you don’t want to rely on Google Analytics to obtain this kind of stats. I recommend you either
Counterize II or BDP Referral Tracker.

Diskeeper vs. PerfectDisk

Diskeeper and PerfectDisk are main leading Windows defragmenting tools in the market. The hard disk in my Windows XP machine is heavily fragmented and the MS built-in defragmenter doesn’t help very much so I decide to take a look into the commercial defragmenter tools out there.

First I tried Diskeeper because I found that the Windows built-in defragmentation tool contains code licensed from Executive Software (the makers of Diskeeper). I thought that being licensed by Microsoft was a good sign but… Diskeeper like the built-in tool is a multi-pass defragmenter. That means that if you run it one time (or two or three for that matter) the hard drive will not end fully defragmented. You need to execute it periodically over a long term to end up with a fully defragmented drive. And it doesn’t consolidates free space. Diskeeper says that those two things are not important because drive performance is not affected. Doing it that way they consume less resources which is good but I found very frustrating to execute a defragmenter and end up with a slightly less fragmented disk I want a full defragmentation now!.

Then I tried PerfectDisk, for me it’s better. One pass defragmentation and free space consolidation that’s what I want. Now the disk map looks much better. Everything is defragmented and all the free space is grouped at the end of the disk.

The only thing I miss from Diskeeper is the background defragmentation. Diskeeper runs a service that continuously search fragmented files and defrag them. I found that interesting but at the end I prefer the PerfectDisk way of working: you schedule the defragmentation once a week or once a month and PerfectDisk will start automatically.

Add Bookmark Here 2 Firefox Extension

Very useful extension that add an “Add Bookmark Here” item to every bookmark folder so you can place your bookmark more easily.

addbookmarkhere2.png

Download it here

Cygwin: Cannot Read C: Drive

If you are getting

ls: reading directory /cygdrive/c: No such file or directory

it’s probably because you installed Altiris Sofware Virtualization (SVS). The solution is to uninstall Altiris or use ProgramIgnoreList feature of Altiris. Read the following messages to the cygwin mailist list to know more.

original message

solution

Take a look to this altiris forum post also if you need more information about the issue