Get mod2patch at SourceForge.net. Fast, secure and Free Open Source software downloads

mod2patch

Quick links

SourceForge project page Download files Get support

Description

mod2patch provides a Linux/Unix utility that can patch MOD02 Record 27 Offset 2 on Western Digital Hard Disks

It may be used in conjunction with mod32patch
that clears the Reallocated Sector Count and Current Pending Sector.
A power off/on cycle to the hard disk is required for the new settings to take effect.

mod2patch is an independent project, unrelated in any way to Western Digital Corp. or Christophe Bothamy.

WARNING : THIS SOFTWARE IS EXPERIMENTAL AND NOT WELL TESTED. IT MIGHT VOID YOUR WARRANTY WITH WESTERN DIGITAL. USE AT YOUR OWN RISK!

IF YOU ARE UNSURE, GET HELP FROM FRANC OR ANY OF THE GURUS IN HDDGURU.COM.

IMPORTANT : You should always note down the original value of this entry (mod2patch -g /dev/device) before making any changes so that you can undo the changes in the future.

Origin

Based on my discussion with Franc, it appears that MOD02 Record 27 Offset 2 needs to be patched to 0 to speed up data recovery from a Western Digital Hard Disk that is failing.

Syntax

mod2patch [options] /dev/device

Examples

Get Mod 02h Record 27 Offset 2 value

# mod2patch -g /dev/sda

Set Mod 02h Record 27 Offset 2 value to 0

# mod2patch -s 0 /dev/sda

Compatibility

mod2patch should be compatible with all recent Western Digital HDD driven by a real SATA controller.

Compatibility with SATA-to-USB adapters has not been tested.

Since mod2patch uses SMART ATA commands to manipulate the record, it should work if SMART information can be read from your hard disk.

WARNING

The Mod 02h appears to be a power-on only setting. That means that the hard disk needs to be powered OFF and then ON to use the new default setting.

Download

Source code and releases can be found on the SourceForge project pages.

Compilation / Installation

After downloading the tarball, for example the 1.0 release (mod2patch-1.0.tar.gz), uncompress it :

$ tar zxvf mod2patch-1.0.tar.gz
Change to the source directory, and compile the code :
$ cd mod2patch-1.0
$ make
You should get the mod2patch executable :
$ ls mod2patch
mod2patch
$ ./mod2patch -V
mod2patch v1.0
And run it with root permissions to get or set the value :
$ sudo ./mod2patch -g /dev/sda
You can optionally install the mod2patch utility to the /sbin directory
$ sudo make install
Please note that you only need to run mod2patch once on each WD Hard Disk as the setting change is permanent.

Author

This utility is brought to you by KHONG How Yu.

It was modified from Christophe Bothamy's idle3-tools project.

Low level ATA I/O is done using the sgio.c file of the hdparm project.

License

The mod2patch project is released under the GNU GPL v3.

Thanks

This utility would not have been possible without Franc Zabkar (fzabkar).

Christophe Bothamy for developing the idle3-tools.