Page 1 of 1

ATA Format Command depreciation

Posted: Tue Apr 19, 2022 11:23 am
by ylli122
Hey all, hope youre all doing well.

I was just reading through some ATA documentation and noticed that the Format command was depreciated some time ago. According to the wiki this occured sometime after the ATA-3 standard.

This surprised me as in my head, it means that for drives that are ATA-4+ compliant, one cannot depend on the existence of the format command to format a drive. In the case of such a drive, is it even possible to initiate a low-level format of the drive programmatically? Or do something similar to Int 13h, AH=05h (Format Cylinder)?

Of course, I suppose from an operating system level, there is seldom a need for such a feature as simply writing zero-bytes to sectors suffices to wipe file system data, but it did get me thinking about the feasibility of low-level formatting on modern drives.

Thanks in advance.

Re: ATA Format Command depreciation

Posted: Tue Apr 19, 2022 11:36 am
by Ethin
I don't recall this even being in the original ATA8 ACS standard, but an equivalent operation (that is fully supported) is drive sanitation. You just send the Sanitize Drive command with the given operation (crypto erase, overwrite, ...) and that'll get you a good format. Specifically, the major opcode your looking for is B4h. The relevant feature codes are 0012h (block erase ext), 0011h (crypto scramble ext), and 0014h (overwrite ext). Feature codes 0040h and 0020h are for controlling whether sanitation is possible. Feature code 0000h is for determining current sanitize status. You can find relevant documentation about how each command works in section 7.34 of the specification (INCITS 529-2018). I would quote the relevant sections but I don't know if that'd violate copyright or not. For NVMe-based disks, there are several routes: sanitize and format namespace. You can find these in section 5 of the NVMe base specification (not the transport ones).

Re: ATA Format Command depreciation

Posted: Tue Apr 19, 2022 11:44 am
by ylli122
Ethin wrote:I don't recall this even being in the original ATA8 ACS standard, but an equivalent operation (that is fully supported) is drive sanitation. You just send the Sanitize Drive command with the given operation (crypto erase, overwrite, ...) and that'll get you a good format.
Ah cool. I hadn't noticed that; I was searching for format but to no avail. Thanks.

Any ideas as to why the depreciation occured?

Re: ATA Format Command depreciation

Posted: Tue Apr 19, 2022 11:55 am
by Ethin
ylli122 wrote:
Ethin wrote:I don't recall this even being in the original ATA8 ACS standard, but an equivalent operation (that is fully supported) is drive sanitation. You just send the Sanitize Drive command with the given operation (crypto erase, overwrite, ...) and that'll get you a good format.
Ah cool. I hadn't noticed that; I was searching for format but to no avail. Thanks.

Any ideas as to why the depreciation occured?
I edited my post to give you more clearly oriented documentation as to where you could find descriptions for the commands. But I'm not honestly sure; I believe it was because sanitation supports zoned devices, whereas format probably didn't. It might've also been because drives don't use tracks and cylinders anymore; they just use sectors. I'm also pretty sure sanitize is more efficient; it doesn't allow you to specify the sectors to format, only that you want to sanitize the entire disk.
Edit: for better references, in the NVM express base spec v. 2.0, the Format NVM command is in section 5.14 (page 168) and the Sanitize command is in section 5.24 (page 282). According to section 8.21 and reading of section 5.14 of that specification, the difference between Format NVM and Sanitize is that Format NVM does a low-level media format on a particular NVM (and supports namespace precision), whereas the Sanitize command acts on the entire NVM subsystem. Both support multi-domain NVM setups.

Re: ATA Format Command depreciation

Posted: Tue Apr 19, 2022 12:02 pm
by Octocontrabass
ylli122 wrote:I was just reading through some ATA documentation and noticed that the Format command was depreciated some time ago. According to the wiki this occured sometime after the ATA-3 standard.
While it's true that FORMAT TRACK was removed from ATA after ATA-3, it was always depreciated. ATA-1 says drives are free to ignore the command. It exists purely for backwards compatibility with software that expects a MFM, RLL, or ESDI drive.
ylli122 wrote:In the case of such a drive, is it even possible to initiate a low-level format of the drive programmatically?
Generally, no. There are some pre-ATA IDE drives that can be low-level formatted, but you really need model-specific commands to do it right. Incorrectly performing a low-level format on a drive can permanently damage it.
Ethin wrote:the original ATA8 ACS standard
Er, I wouldn't call ATA-8 original when it's the eighth version of ATA. (And ATA itself evolved from several different Western Digital drive controllers.)

Re: ATA Format Command depreciation

Posted: Tue Apr 19, 2022 12:04 pm
by Ethin
Octocontrabass wrote:
ylli122 wrote:I was just reading through some ATA documentation and noticed that the Format command was depreciated some time ago. According to the wiki this occured sometime after the ATA-3 standard.
While it's true that FORMAT TRACK was removed from ATA after ATA-3, it was always depreciated. ATA-1 says drives are free to ignore the command. It exists purely for backwards compatibility with software that expects a MFM, RLL, or ESDI drive.
ylli122 wrote:In the case of such a drive, is it even possible to initiate a low-level format of the drive programmatically?
Generally, no. There are some pre-ATA IDE drives that can be low-level formatted, but you really need model-specific commands to do it right. Incorrectly performing a low-level format on a drive can permanently damage it.
Ethin wrote:the original ATA8 ACS standard
Er, I wouldn't call ATA-8 original when it's the eighth version of ATA. (And ATA itself evolved from several different Western Digital drive controllers.)
Fair enough, but ATA-8 is the baseline I have -- I don't have any older standards, and my copies only go back to ATA8 ACS-1 -- so I've never seen format track in them.

Re: ATA Format Command depreciation

Posted: Tue Apr 19, 2022 12:40 pm
by Octocontrabass
Ethin wrote:I don't have any older standards
Here's an archive that includes several drafts of ATA 1 through 7.

Here's another archive containing some drafts of ATA from 2004. You can find more drafts from a few other years by changing the URL.