OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:41 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 11:23 am 
Offline

Joined: Sun Apr 12, 2020 1:34 pm
Posts: 9
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.


Top
 Profile  
 
 Post subject: Re: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 11:36 am 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
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).


Last edited by Ethin on Tue Apr 19, 2022 11:48 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 11:44 am 
Offline

Joined: Sun Apr 12, 2020 1:34 pm
Posts: 9
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?


Top
 Profile  
 
 Post subject: Re: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 11:55 am 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
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.


Top
 Profile  
 
 Post subject: Re: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 12:02 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.)


Top
 Profile  
 
 Post subject: Re: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 12:04 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
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.


Top
 Profile  
 
 Post subject: Re: ATA Format Command depreciation
PostPosted: Tue Apr 19, 2022 12:40 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, DotBot [Bot], SemrushBot [Bot] and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group