The Seagate EXOS family of drives don't support the ATA
drive configuration overlay (DCO) command, however they do
support host protected area (HPA). Therefore these drives
can have hidden sectors.
The code was changed to accommodate the slightly different
way these drives respond to a hdparm -N, that is, the
response is accessible max address enabled or
accessible max address disabled. The new code correctly
determines a the status of a drive in regards to
whether it has hidden sectors or not and what it's
apparent and real size is.
Changed the way percentage is calculated. As we
are dealing with large numbers and for some reason
printf prints a double that is 99.99999999999 as
100.00 when a precision of two is specified I wrote
a function that creates a percentage string such that
99.99999999999 is displayed as 99.99%. This is important
in the report as a disc with one hidden sector will now
correctly show as 99.99% erased and not 100.00% erased.
Many changes related to DCO real max sectors and HPA set and real
sectors and how they are processed and used in the PDF creation
function. More testing is required until I'm happy this works
correctly with lots of different hardware including USB adapters
that don't support DCO/HPA and also drives that don't support
DCO/HPA such as the Seagate Enterprise EXOS drives.
This bug only applies to ones wipe and one or zero's
verification.
A very rare occurrence of a incorrect percentage on
completion. The actual wipe was completed correctly it
was just that the percentage calculation was wrong.
This was due to a variable that was initialised for
all methods except ones, & ones & zeros verification.
For those three method's the uninitialised variable
would have had to have the value 1 or 6 for the
incorrect percentage to be calculated, this is why
it was so rare.
Corrected by initialising the variable with a -1 so
that if no method was found in the array then no
extra calculations as regards the percentage are
performed.
1. Started constructing the code we will use to access
and write to /etc/nwipe/nwipe.conf. The initial use of
the nwipe.conf file will be to hold information such
as organisation and technician details that will be used
on the PDF report certificate. We are using the libconfig
library enable us to read and write the conf file. libconfig
is very well documented so editing the conf file manually
should be pretty straight forward. Nwipe will build a basic
conf file to give the user an idea how it should be edited.
2. Updated the README.md, showing the libconfig-dev, libconfig++-dev
needs to be installed.
3. Added some information about the use of hdparm to detect hidden
sectors and also noted that as from v0.35 nwipe will detect hidden
sectors, and may well have an extra method to expose those hidden#
sectors by restoring the DCO.
1. Fix issue in PDF certificate where a drive that doesn't
support device configuration overlay, shows 512 bytes as the
disc size in the "Size(Real)" area on the certificate.
2. Fix a comment in the log that suggests you might be using a USB
adapter or memory stick and those device can cause an indeterminate
HPA/DCO status. This is now corrected so that we check the bus
is USB before we issue that message.
3. Changes to some GUI text, replaced 'area' with 'sectors'.
4. Aligned "HPA/DCO No hidden sectors detected" to the drive
model/serial text that it alternates with. One character left.
5. Nwipe's version and operating system information that is always
printed to the console on exit, was not appearing in the optional
log file, as optionally specified on the command line. This was
caused because those nwipe_log() calls were happening before the
command line options had been parsed. Essentially there was no log file.
Comments were made in the nwipe.c as a reminder to use nwipe_log()
calls with caution, prior to the options parser.
6. Made changes to the logic in the HPA_dco functions such that
a device that does not appear to support device configuration
overlay and host protected area is classified as HPA_NOT APPLICABLE
in regards to the hpa_status which is important for the PDF
certificate code so that the fields in the certificate are updated
appropriately.
Now validates temperatures rather than assuming the data
is valid.
1. Checks for 0 in high critical and max.
2. Copes with missing critical or max min data or
partially missing data.
3. Checks the high critical and max are the right way round
4. Checks the low critical and min are the right way round
5. Temperature is displayed in 5 different ways
i. white text on blue - temperature with spec. (or no spec available)
ii. red text on blue - max temperature reached.
iii. white text on red - critical high temperature reached.
iv. black text on blue - minimum temperature reached.
v. white text on black - critical low temperature reached.
Added the max and min drive temperatures to the nwipe
log. We now have upto six temperatures that may be reported
for each drive. Whether all these fields are populated is
down to each drive manufacturer.
Temperature text now changes red when it's exceeded
the high critical temperature and black when it's dropped below the low
critical temperature. See nwipes log for what those values actually are
as those critical temperature values are obtained from each drive.
When the drive temperature is within the drives specification the temperature
text will be white text on blue background.
The temperature text no longer flashes red or black.
1. For each drive we now show the following temperature
limits that are obtained directly from the drive. These are
shown in the log under the INFO category. For a given drive
all it's limits are shown on a single line near the start of
the log.
Example:
Temperature limits for /dev/nvme0n1, critical=84c, highest=N/A, lowest=N/A, low critical=N/A.
High critical
Highest
Lowest
Low critical
Whether all these values contain data various between
manufacturer, for instance the Seagate SN570 only shows
the high critical value of 84 deg.C
2. Changed some wording in the GUI for a on screen
message to do with HPA/DCO.
1. Added a new icon, a yellow exclamation in a red circle
with the words "erased with a warning" inside the circle.
This is used instead of the green tick icon or red cross icon
when a disk is successfully erase as requested but the user
chose not to expose the hidden sectors by removing the HPA and/or
restoring the drive configuration overlay (DCO).
2. Expanded the size of the "Disk Erasure Details" section on
the certificate by 20 points to provide better spacing for warnings
3. Removed remapped sectors label, as that information already
appears on page 2 in the smart data.
4. Improvements to the logic in regards to text colour changes.
5. Added a additional red warning message in the information section
when the exposed sectors of the disc are erased but the hidden sectors
are not.
6. Added the original images in .xcf (gimp) and jpg formats that are
used to generate the embedded .c and .h files using bin2c.
1. Added page 2 of the report which includes all
smart data as displayed by smartctl -a /dev/sdx
2. Did some more work on the logic, i.e. when certain
data on the certificate should be green and when it should be
red.
3. Made some changes to nwipe's log in regards to the way
it displays disc info right at the beginning of the log.
Separated the drive information by a blank line to make
each drive stand out from the rest.
4. Moved a string function from device.c to miscellaneous.c
more code to follow ..
1. If nwipe enumerates a USB bridge that does not support
ATA pass through or you are wiping a USB memory stick,
nwipe will show a message in the GUI that says
"HPA/DCO hidden area indeterminate". If you get this message
you know to either get yourself a better quality USB to SATA
adapter or in the case of a USB memory stick, i've never
come across one that supports HPA/DCO so either don't worry
about it and wipe it as normal or physically destroy it.
2.We now check for a nonsense "real max sectors" as produced
by the bug in hdparm. We use our own low level function to
issue a DCO identify command and retrieve the correct value.
3. Changed the dmidecode info at the start of the log from
a 'notice' classification to 'info'.
4. Made changes to the nwipe_log function so that any messages
logged that are classified as 'debug' will not be logged unless
the --verbose flag has been set on the command line options. I
send the hex data structures and hex sense data to the logs as debug
information and as they can take up a lot of space and make the
log look untidy they will only appear in --verbose mode.
5. I also extended the nwipe's log message length from 512 to 1024
as some of the sense data was being truncated in the log.
1. Created the function nwipe_read_dco_real_max_sectors()
which directly accesses the disk drive sending a 0xB1
device configuration overlay identify command to the drive.
We read the returned data structure extracting the real max
sectors value. We do this if hdparm returns nonsense for the
real max sector (as it does in hdparm v9.60) for some larger
drives. This value is automatically sent to the nwipe log FYI.
2. Added a stdout & stderr pipe to the hdparm commands as verbose
data appears to be sent to stderr, as we are interested in that
data this pipe captures stderr as well as stdout.
3. Added headers "scsi/sg.h" and "scsi/scsi_ioctl.h" as we
are now sending low level commands to the drives.
1. In the GUI I switched the HPA/DCO status position
from overlaying the [drive size][temp] and instead
positioning the HPA/DCO status over the drive model
and serial number. HPA/DCO information and drive details
alternating every couple of seconds. This allowed me to
extend the length of the HPA message and make it more
meaningful to somebody that doesn't know the HPA/DCO
terminology. Therefore "HPA Enabled" is replaced with
"HPA/DCO Warning, hidden area detected"
2. Started adding bad/missing sense data detection ..
more code to follow ..
1. Changes to colour on some items under certain
conditions.
2. Changed the HPA labels to include DCO, and changed
the text from HPA enabled/disabled to something more
meaningful to a user, i.e Hidden area found, no hidden
area.
3. Added a new define "HPA_NOT_SUPPORTED_BY_DRIVE" for
recent SATA drives that no longer support HPA/DCO.
Further work needs to be done determining whether a drive
supports HPA/DCO or not in the hpa_dco.c functions.
more code to follow ..
1. Reduced font size for data info.
2. Used a define for text point size to make it easier
to change size.
3. Started work on function to parse sense data for older
versions of hdparm (9.60) that fail to parse the real max
sectors correctly. (fixed in 9.65).
4. Miscellaneous changes.
More changes to follow ..
1. For devices that support HPA/DCO (not NVMe) nwipe
displays the HPA status, it toggles every two seconds
the size and the temperature i.e "[ 1TB][ 35C]" with
the HPA status such as [HPA disabled], [HPA ENABLED!],
[HPA unknown]. The HPA ENABLED is highlighted with red
text and a white background. HPA_disabled is standard
white text on blue background.
More code to follow, a new option to be added, HPA, disable/enable
which will disable the HPA and shut down the system. On manually
powering back up the HPA should be reported as disabled.
Then lots of testing.
1. Further work was completed, putting the HPA status and HPA size into
the report/certificate.
2. Moved some general functions that may be used throughout nwipe
into miscellaneous.c These tend to be string processing functions.
3. Tested certificate HPA status. There are three possible states of the HPA
i. Enabled and HPA size is displayed on the certificate
ii. Disabled, the drive reports it's real size to the O.S.
iii. Unknown. Nwipe could not determine whether there is a HPA or not.
This may be caused by the use of a USB adapter or could be a bad drive,
or finally a change in hdparms format when displaying HPA information.
More code to follow, next on the list is to add the HPA status into the
drive selection screen in the GUI, so when you select the drive you can see
the status of HPA and choose to disable it.
1. nwipe now reads the HPA set and real number of
sectors and the DSO real max sectors. It determines
from these values whether the HPA is enabled, disabled
or in a unknown state. The values are logged to nwipes
log and flags are set in the drives context.
More code will follow that adds this information to the PDF
certificate and to the drive selection window in the GUI.