I have been told (by “Moltke” at the HDD Oracle) that the checksum is automatically recomputed by the drive before the MOD is written to the platters. Therefore there is no need to bother with it. The only time you need to take it into account is when you are writing the module in CHS mode.
BTW, last night I confirmed that my understanding of the VSC was correct by retrieving a different section from MOD 02 in an earlier pre-ROYL model using an MHDD script.
The timer appears to be a 32 bit value from Offset 0x36 to 0x39. If a non-zero value is present in any of these locations, APM goes to 0x60. If we have a large value here, APM at 0x60 won’t be much different from 0x80. At 0xFFFFFFFF it’s going to be 13.5 years?
IIUC, the APM byte value is not actually stored anywhere. Instead it appears to be computed from the data in MOD 02.
As you say, the timer setting (?) at offset 0x36 appears to occupy 32 bits. There also appear to be 32-bit timers at offsets 0x4C (200), 0x50 (2000) and 0x54 (10).
00h Reserved
01h Minimum power consumption with Standby
02h-7Fh Intermediate power management levels with Standby
80h Minimum power consumption without Standby
81h-FDh Intermediate power management levels without Standby
FEh Maximum performance
FFh Reserved
“The APM levels may contain discrete bands (e.g., a device may implement one APM method from 80h to A0h and a higher performance, higher power consumption method from level A1h to FEh). APM levels 80h and higher do not permit the device to spin down to save power.”
I’m happy with APM 0x80 which has been the case with older 2.5" drives. I just have the phobia that excessive headparks could reduce the life of the hard disk, and don’t like the half a second delay whenever I access it after a headpark. I hate the latter more, in fact. Well offset 0x36 is similar to Idle3. The value there is the timer in 1/10th of a second. When the value is 0, the “improved APM” is effectively disabled, leaving it at 0x80.
I guess you’re right again to say that it’s computed from some variables, or hidden somewhere in Mod 02. There are simply too many 0x80 present, unless I have a stack of faulty drives to test with, I’m happy with 0x80. Gonna do some coding this weekend by modifying idle3-tools. That 32 bit value is going to be tricky since I’m not a programmer myself. Or to simplify things, just give 2 options - Disabled or 20 seconds.
I’ll checkout the timer you gave maybe in the evening. Could be meant for something, have to figure out what it is. Good day.
Changing Mod 02 Record 13 Offset 36 is trivial. This will enable/disable autopark at 20 seconds.
Reading and writing Offsets 36-39 looks to working fine now, but my code is rather amateurish. Took me quite a while to convert the char to array (since we’re dealing with 4 bytes now instead of 1 byte in idle3) and to get it to work with pointers, but finally I got it. Verified with Nazyura’s dump.
Next TODO is to read/convert/write Offsets 36-39 from/to desiseconds. I don’t see any point setting it beyond half an hour (might as well disable it), but what the heck.
User input : 2578103244 < For debugging purposes
atof tmptime : 2578103244 < For debugging purposes
After parsing to timer array : cc bb aa 99 < For debugging purposes
VSC_Set_Timer 1 : 204 187 170 153 < For debugging purposes
VSC_Set_Timer 2 : -52 -69 -86 -103 < For debugging purposes
APM timer set to 257810324.4s (0xccbbaa99)
Please power cycle your drive for the new setting to take effect. A reboot will not be enough!
[root@localhost apm]#./idle3ctl -g /dev/sdc
APM timer set to 257810324.4s (0xccbbaa99)
C:>mod2dump.exe 02_99aabbcc.MOD 13
ROYL header found
Update : The first 2 bytes are meant for the APM timer. The last 2 bytes are possibly meant for spindown or whatever that makes the drive goes to Standby. By setting it to 0x000000FF the drive starts and remains in permanent Standby mode and cannot be brought up by the OS. It’s totally not recognized by Linux. hdparm -C shows that it’s in Standby after several minutes. HDAT2 also shows that it’s in standby mode with APM at 0x60.
hdparm -C also shows Standby for 0x0000FF00 and APM at 0x60.
At 0x00FF0000, hdparm -C shows it’s Active.
This certainly makes more sense as no one would need a few years for a timer.
In fact the feedback that you provided in this thread proved to be very useful in formulating a procedure to facilitate the recovery of data from certain WD drives with the well known “slow issue”. The fix involves modifying a single byte in MOD 02, and clearing the contents of MOD 32. Unfortunately I’m not much of a programmer, so we had to apply the fix by way of an MHDD script (plus a FreeBasic program). So far, two users have been successful. If we had not modified the firmware, it would have taken several months at 24/7 to clone the drives, assuming they could have survived the ordeal. Instead it required only a matter of hours.
It would be nice if a real programmer could produce a simple “slow-fix” tool …
I think I read that article somewhere in HDDguru. If you could tell me which Record and offset of Mod 02 to patch, I can make one. Clearing Mod 32 will be a bit tricky since what we currently have is Record, Offset, and bytes. I can explore further though. I can see one of my Mod 32 has 0x00 from 0x84 onwards.
And I’m not a programmer, but I could explore editing a bit of codes here and there. I’ve tried compiling with Watcom to have it running in DOS but failed. So even if I could make the code for you, it’ll be in Unix. Are you ok with that?
The main part of the “slow fix” is to write a single byte (0x00) to section 0x1b at offset 0x02 in SA module 02.
The other part is to read MOD 32, clear certain data structures within it, and then write it back to the SA.
Perhaps a Linux tool that does the first part of the job could suffice. I could then use your proof-of-concept code to approach professional programmers to fill in the extras for us.
I compared the Before and After of Mod 32. Looks like I should not touch anything between 00-8F correct? And if I were to touch that portion, it’d only be the 4 bytes of checksum. Remaining part of the mod should be zeroed out.
Let me see what I can do.
Update : I checked my list of Mod 32 (all good hard disks from 80GB - 1TB) and it appears that everything is zero from 0x84 onwards.
From your code, the 10th byte is the length of the module.
Yes, that’s it. However, you need to first determine the size of MOD 32 and then write as many sectors back to the drive. It’s a completely different VSC. It may be best to stick with just MOD 02 and see how far we can get with it.
The other day I read your code and wanted to confirm if “the 10th byte is the length of the module”.
I can get Mod 02 for you in no time. It’s just a matter of altering a couple of lines in the code. We can speed things up if you could help test Mod 02 on your end. You just need to get idle3-tools and modify idle3ctl.c from :
My idle3ctl-modified code is able to read Mod 32’s length as well as correctly write the first 1024 bytes onto a file for backing up. For some reason, data beyond 1024 is not correctly read and thus written. Unsure if the disk is acting up since it’s a very old one. Need to solve this before I work on the write module.
Managed to read the whole file now. Since the 11th byte is the number of sectors, I’m curious how it handles Advanced Format drives. Do we multiply the value of byte 11 with 4096 for AF drives or still 512.
Trying to do some tests to understand “The checksum bytes are chosen so that the 32-bit little endian sum of all the 32-bit double words, including the checksum bytes, is 0x00000000”. If we have 4 bytes of 0xFFFFFFFF, does the checksum go at 0x01010101 or 0x01000000. Will try with chksum2.exe