Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FireCuda 530 unable to set 4k sector size but Seagate advertises 4k capable. #84

Open
jerrywoo96 opened this issue May 9, 2022 · 13 comments

Comments

@jerrywoo96
Copy link

Hi,

I would like to know what did i do wrong, the drive reports that it is 4k sector capable, but i'm unable to set it. Is Seagate doing a false advertising? Why arn't we allowed to change it? If we cant change it, why are they advertising it?

Capture1
Capture2
image

Thanks.
Jerry

@vonericsen
Copy link
Contributor

Hi @jerrywoo96,

The --setSectorSize option is only for SATA and SAS devices.

For reformatting an NVMe device, you need to use the --nvmFormat 4096 option.
Also, Microsoft does not allow the format command to be issued unless you are in PE mode: MSFT storNVMe command support
I would recommend doing this in Linux if you are interested in changing the sector size to 4096.

@jerrywoo96
Copy link
Author

Hi @vonericsen

I managed to run the command in ubuntu, what is the correct command to check the progress?

The command i used below prints the help text instead.
./nvme -d /dev/nvme0n1 --progress nvmformat

IMG_20220510_010208.jpg

Thanks,
Jerry

@jerrywoo96
Copy link
Author

Hi @vonericsen

I know seagate has its own method of changing sector sizes, speaking of changing sector sizes, sabrent was able to implement a one button press of changing sector size running on normal windows environment without going into pe or safe boot. Idk how they did that, but its cool knowing that they were able to pull it off.

Jerry

@vonericsen
Copy link
Contributor

Hi @jerrywoo96,

what is the correct command to check the progress?

That is the correct command, but it appears that is a bug in openSeaChest_NVMe. I just verified that it works in openSeaChest_Format.

I know seagate has its own method of changing sector sizes, speaking of changing sector sizes, sabrent was able to implement a one button press of changing sector size running on normal windows environment without going into pe or safe boot. Idk how they did that, but its cool knowing that they were able to pull it off.

The sector size changes are all done using standardized methods in these tools.
I will have to look into that and see if I can figure out how it was done. I have tried issuing the format command anyways and it still ended up blocked by Windows as expected, so it might be something else like a vendor unique command they had implemented to get around the restriction.
Microsoft has changed command restrictions over time as well, so it may be something has changed more recently or a new function was implemented to allow it from the original method I know of.

vonericsen pushed a commit that referenced this issue May 9, 2022
Fixing the progress check option. It was not being checked in one location leading the tool to think the user had not entered a valid option and dumped the help instead.

[#84]

Signed-off-by: Tyler Erickson <tyler.j.erickson@seagate.com>
@jerrywoo96
Copy link
Author

Hi @vonericsen

Ok so last night i managed to run the change sector command, is the command instantaneous? i checked using the format util's progress nvmformat, it says that no operation is running, and --showSupportedFormats states that its using 4k sectors now,

Thanks,
Jerry

@vonericsen
Copy link
Contributor

Hi @jerrywoo96,

On NVMe SSDs the format is pretty quick. Not quite instantaneous, but less than a few minutes typically.
You can run with the --poll option on the command line too to see progress indication until it is complete too.
Ex: openSeaChest_Format -d <handle> --nvmFormat 4096 --poll
Once it is done, checking with --progress will show that message that it is not in progress as it is no longer running.

Checking with the --showSupportedFormats and the -i options should both show using 4k sectors when it is done.
So it sounds like it is done to me!

@vonericsen
Copy link
Contributor

Just wanted to provide an update regarding the format command in Windows.
I did implement a way to issue the crypto erase using the SCSI sanitize command which is barely documented in MSDN. This is part of v23.03 and v23.03.01, so you can at least issue this to erase a drive.
I still have not found a way to issue the format with a sector size change. I have tried a few different methods that are SCSI-like but have not had success yet.

I have a sabrent drive in a personal system of mine so I was able to check for the NVMe commands-effects log, but the drive doesn't support that....so however Sabrent is doing this in their software, it is not using a Vendor unique command since this log is required for Microsoft to even issue the command (this is well documented by Microsoft).
I now suspect that Microsoft does have a way to specify a new sector size, but it's not clear to me what that is and it does not seem documented in MSDN. The list of supported SCSI translations would imply that you can do mode sense/select to change it before a format unit, but that does not work with anything I've tried so far.

I'm going to see if I can figure out how to get this working and I can attempt reaching out to Microsoft for help if I continue to be stuck on this after a few more experiments I have in mind.

@jerrywoo96
Copy link
Author

jerrywoo96 commented Mar 30, 2023

Hi @vonericsen

I found this, I'm not sure if it helps.

I was googling change sector size and came across this forum.
https://www.techpowerup.com/forums/threads/setting-4k-sector-size-on-nvme-ssds-does-performance-actually-change.289757/

The first post also mentions changing sector size for WD SSDs. and i came across the command used in linux to change it.
https://www.bjonnh.net/article/20210721_nvme4k/

So then i googled windows change lba format and came across this.
https://learn.microsoft.com/en-us/windows/win32/api/nvme/ns-nvme-nvme_lba_format
https://learn.microsoft.com/en-us/windows/win32/api/nvme/ns-nvme-nvme_cdw10_format_nvm

@PhamtomWolf
Copy link

Your able to use the SABRENT_SSC tool too change the sector size...

literally just did it 5 minutes before this post after i remembered it existed

@vonericsen
Copy link
Contributor

I am aware of that tool, but I have no idea what it is doing to perform the sector size change.

With windows, it's not as simple as issuing a raw command from the NVMe spec like openSeaChest supports in Linux and other OSs.
Microsoft only allows specific commands to the drive with specific IOCTLs to issue the commands they want to allow.
Unlike SAS and SATA, the "generic" NVMe passthrough is only allowed for vendor unique commands that are described in the NVMe commands and effects log and a couple others (Sanitize and DST) that were added in newer revisions of the NVMe spec.
Commands are also restricted depending on if it is the OS drive or not and whether or not you are running in Windows PE.

Navigating what NVMe commands Microsoft will allow is difficult as it is not clearly documented, but you need to use the following and understand the SCSI to NVMe translation spec as well since that is somewhat supported and required for certain commands:

What is most confusing about Microsoft's documentation is that it states the SCSI translation of the format unit command is available, however when trying to use it, it reports that the command is not supported.

The MSDN page for Microsoft's nvme.h header is not particularly useful as that headerfile really doesn't provide anything new to issue a command. Just a lot of predefined structures for commands you can and cannot issue. I think Microsoft just defined a bunch of stuff from the standards in here for their own internal use and to somewhat help with certain APIs if you don't otherwise have similar NVMe command strucutres in your own code (like openSeaChest does).

So the things I've tried and not had success with are:

  • Using the SCSI translation with the format unit command. When I attempt this, I get errors back from the driver saying the command sequence is not supported (whether keeping the sector size the same or changing it).
  • Trying to force the raw command with the "generic" NVMe passthrough. When I tried this, I get an error code stating "Incorrect parameter" which is Microsoft's way of saying, this is not supported.
  • The SCSI Sanitize CDB. This does start a format, but I have no idea how this is used to change sector size since SCSI does not use this command in this way. This is a Microsoft unique translation, and it is not really documented other than on the SCSI translation support page as something that exists.

I have a Sabrent drive in a system at home and I checked if it has the commands-effects log and it does not...so that also rules out a vendor unique command being used here.

@PhamtomWolf
Copy link

PhamtomWolf commented Nov 27, 2023

well the SABRENT_SSC tool worked just fine on my firecuda 530, had to swap a Sabrent 2TB for this thing as it refused to work in an enclosure due to what ever crud WD put in place

the tool works on SABRENT and WD drives and probably most over's and its not uncommon for windows to crap its pants and BSOD if you use it twice in a row, meaning its giving windows the middle finger and performing black-magic to get it done

@vonericsen
Copy link
Contributor

@PhamtomWolf,

I did not know that tool would work on other drives that are not Sabrent.

I did post a question on Microsoft's github documentation about the SCSI translation of the format command since that seems to be the most likely way it was implemented. That may provide more context on how it is implemented by the driver.
If that doesn't work, I'll see if I can find some other way to ask Microsoft how to do this.
Microsoft likely implemented this capability in some strange undocumented way.

I experimented with the SCSI Sanitize CDB and nothing I did with it would change the sector size, so I doubt they are using that in this case. That seems to complete data erasure though.

Whenever we finally figure this out, I will implement what I can and close this issue.

@cfelicio
Copy link

If anyone is still struggling, I was able to switch my Firecuda 530 to 4kn by using the Ubuntu nvme command with a live CD. Instructions here: https://carlosfelic.io/misc/how-to-switch-your-nvme-ssd-to-4kn-advanced-format/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants