In fact 255 is not a legal value for APM. The ATA/ATAPI spec states clearly that 255 is reserved. The APM parameter only accepts values up to 254, so hdparm will never read out 255 as a value for APM. However hdparm accepts -B 255, and in such case, it will send a "disable APM" command to the harddisk. So you may perfectly have "APM=254" while APM is disabled. The APM setting is just kept in the drive, but will have no effect, as APM is generally disabled.
Now hdparm is not completely right : the ATA/ATAPI spec also states that the "disable APM" command may not be supported on all drives.
To sum up, there are mainly two sorts of harddrives:
- those accepting the "disable APM" command. For these drives, you may still read out APM=254 (or whatever you set previously) after applying -B 255 (look at hdparm's output, it will tell you that APM is disabled).
- those not accepting the "disable APM" command. These drives will most likely use 254 as "no APM" setting.
You are right by saying that we did not really fix anything with this workaround.
I made some investigations on my brand new laptop, which had Windows Vista preinstalled. Using the win32 port of hdparm I compared the data returned by the "identify" ATAPI command, which is more or less what hdparm -I returns. I just did this in "raw" format to avoid hdparm's interpretations messing around. The harddisk settings (APM, and so on) are the same under Vista and Ubuntu, but under Vista, there is no clicking. So either Windows sends additional commands to the drive, or Linux does it, but I don't think it is just a matter of "default settings". At least the APM settings are the same (APM active, value = 128).
There is an ATAPI command which could produce the same effects ("idle immediate with unload"). I wonder whether this is used in the kernel, or whether the harddisk's firmware could interpret a simple "idle" command as "idle immediate with unload" under certains circumstances.
Mathieu:
In fact 255 is not a legal value for APM. The ATA/ATAPI spec states clearly that 255 is reserved. The APM parameter only accepts values up to 254, so hdparm will never read out 255 as a value for APM. However hdparm accepts -B 255, and in such case, it will send a "disable APM" command to the harddisk. So you may perfectly have "APM=254" while APM is disabled. The APM setting is just kept in the drive, but will have no effect, as APM is generally disabled.
Now hdparm is not completely right : the ATA/ATAPI spec also states that the "disable APM" command may not be supported on all drives.
To sum up, there are mainly two sorts of harddrives:
- those accepting the "disable APM" command. For these drives, you may still read out APM=254 (or whatever you set previously) after applying -B 255 (look at hdparm's output, it will tell you that APM is disabled).
- those not accepting the "disable APM" command. These drives will most likely use 254 as "no APM" setting.
You are right by saying that we did not really fix anything with this workaround.
I made some investigations on my brand new laptop, which had Windows Vista preinstalled. Using the win32 port of hdparm I compared the data returned by the "identify" ATAPI command, which is more or less what hdparm -I returns. I just did this in "raw" format to avoid hdparm's interpretations messing around. The harddisk settings (APM, and so on) are the same under Vista and Ubuntu, but under Vista, there is no clicking. So either Windows sends additional commands to the drive, or Linux does it, but I don't think it is just a matter of "default settings". At least the APM settings are the same (APM active, value = 128).
There is an ATAPI command which could produce the same effects ("idle immediate with unload"). I wonder whether this is used in the kernel, or whether the harddisk's firmware could interpret a simple "idle" command as "idle immediate with unload" under certains circumstances.
Matthias