-
Notifications
You must be signed in to change notification settings - Fork 88
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
Fix hidden sector detection for logical 4096 sector size #543
Fix hidden sector detection for logical 4096 sector size #543
Conversation
This fixes an issue where nwipe detects a discrepancy between the number of sectors reported by hdparm and nwipe's own HPA/DCO functions that were reporting the same values, using number of sectors based on 512 byte sectors but disagreed with the number of sectors generated from libata which was reporting the number of sectors based on 4096 byte sectors. This has been fixed by always calculating the number of sectors returned by libata using 512 bytes per sector so a direct comparison can be made to data from hdparm & nwipe's HPA/DCO functions.
HELP NEEDED to test hidden sector detection on 4096/4096 sector drives @Firminator @ggruber @mdcato or anybody else that may have such a drive. This patch needs testing on 4096 logical sector drives. All my drives are 512/512 or 512/4096 logical/physical so no good for this test. I've tried setting the sector size but none of my drives seem to support that feature of hdparm. The logical/physical sectors as reported by fdisk -l Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors To test: Locate a disk that reports a logical sector size as 4096/4096, possibly enterprise ? Unfortunately my 12TB EXOS drives are 512/4096 so no good. Create a hidden sector in the disk with hdparm, i.e Example
Confirm nwipe v0.35.6 reports a hidden sector and in the nwipe logs it's the expected size Reset the HPA so there is no hidden sector
Check nwipe v0.35.6 reports no hidden sector Thanks ! |
Also see #542 that describes the false positive on a 4096/4096 encrypted drive. |
Once I get confirmation this patch #543 works correctly for detecting hidden sectors on 4096/4096 logical/physical disk drives I'll release nwipe v0.36 |
unfortunately I'm struggling with a new nwipe test box with 3,5" drive bays. Hope the get around this in the next two days. But afaik I have no 4kn drive on my shelfs, only 512n and 512e. Even a ST16000NM001G I've my hands on as borrowed offers 512e mode. |
@ggruber thanks for checking, 4096/4096 drives seem to be a very rare drive, I read somewhere that the PS3 drive was formatted this way. Unfortunately I don't have any of those either. |
my 3,5" Testbox is running now, but no 4kn disk, sry |
No problem, these |
Western Digital UltraStar has a bunch of 4Kn drives. DC HC530 (14TB) Model number is important. Only the ones ending with 42XX (SAS) or N6XX (SATA) are 4Kn. source: research on a new power saving feature (PWDIS - Power Disable) that effectively prevents newer gen enterprise drives to not power when using different SAS or SATA power connectors than what came with the server. We came across this the other day trying to wipe a retired SAN. See https://documents.westerndigital.com/content/dam/doc-library/en_us/assets/public/western-digital/collateral/tech-brief/tech-brief-western-digital-power-disable-pin.pdf Other vendors are aslo affected: https://global.icydock.com/product/faq/Power_Disable_Feature_25_35_SATA_SAS_HDD_SSD_list.pdf Video Fix: https://invidious.fdn.fr/watch?v=fnISM_LMuss |
@Firminator So like this one They are not cheap! I did think about buying one but that's too expensive for me for just a occasional test drive. Thanks for the info re PWDIS, interesting. |
Sorry for the delay responding, and also sorry all drives I have available are 512/4096.
…________________________________
From: PartialVolume ***@***.***>
Sent: Saturday, February 3, 2024 16:34
To: martijnvanbrummelen/nwipe ***@***.***>
Cc: Mike Cato / Hays Technical Services ***@***.***>; Mention ***@***.***>
Subject: Re: [martijnvanbrummelen/nwipe] Fix hidden sector detection for logical 4096 size (PR #543)
HELP NEEDED to test hidden sector detection on 4096/4096 sector drives @Firminator<https://github.com/Firminator> @ggruber<https://github.com/ggruber> @mdcato<https://github.com/mdcato> or anybody else that may have such a drive.
This patch needs testing on 4096 logical sector drives. All my drives are 512/512 or 512/4096 logical/physical as reported by fdisk -l
To test:
Locate a disk, possibly enterprise ? although my 12TB EXOS drives are 512/4096 that has 4096/4096 logical/physical sector sizes.
Create a hidden sector in the disk with hdparm, i.e
Example
# Determine sectors and whether there is already hidden sectors
hdparm -N /dev/sdc
# where xxxxxxxxxxx is the number of sectors reported above -1
hdparm -N xxxxxxxxxxxx /dev/sdc
# IMPORTANT, send system to sleep or power cycle drive
Confirm nwipe v0.35.6 reports a hidden sector and in the nwipe logs it's the expected size
Reset the HPA so there is no hidden sector
# xxxxxxxxxx is the original (real) number of sectors
hdparm -N xxxxxxxxxxxx /dev/sdc
# IMPORTANT, send system to sleep or power cycle drive
Check nwipe v0.35.6 reports no hidden sector
Thanks !
—
Reply to this email directly, view it on GitHub<#543 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANGK2PSMKIF6SGK67WQOG7LYR23QJAVCNFSM6AAAAABCYKRLJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVGQ3TGMBRG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
No problem, I'm sure somebody will turn up with one eventually. |
This fixes an issue where nwipe detects a discrepancy between the number of sectors reported by hdparm and nwipe's own HPA/DCO functions that were reporting the same values, using number of sectors based on 512 byte sectors but disagreed with the number of sectors
generated from libata which was reporting the number of sectors based on 4096 byte sectors.
This has been fixed by always calculating the number of sectors returned by libata using 512 bytes per sector so a direct comparison can be made to data from hdparm & nwipe's HPA/DCO functions.