1

As detailed here, the hdparm tool hasn't been actively maintained on Cygwin for some time. This results in a situation in which there is no current tool that can perform the firmware-level Secure Erase and Block Erase ATA commands that instruct a PATA or SATA drive's firmware to erase the drive.

These firmware-level erases are widely considered the most secure and reliable way to wipe modern drives - and on SSDs, the only secure way to do so because features like wear levelling make normal zero-filling unreliable. Essentially, this means that - on Cygwin at least - there is currently no way to securely wipe an SSD.

Amidst this state of affairs, I recently came across the openSeaChest set of utilities, developed at Seagate but open-sourced and designed to work with any SATA, SAS or NVMe drives. openSeaChest seems positioned to be able to replace tools like hdparm and sg3_utils, and can be used to run ATA firmware commands like Secure Erase and Block Erase in addition to a lot more.

How do I build the latest version of the suite so that I can use its binaries in Cygwin?

1 Answer 1

1

Compile the openSeaChest utilities for Cygwin and Windows

  • Install MSYS2 and run the MSYS2 MinGW 64-bit terminal

  • Run pacman -Syu and install any updates, ignoring any warnings about Cygwin.dll mismatches

  • Open the MSYS2 MinGW 64-bit terminal again and run pacman -Syu once more

  • Get the minGW-w64 toolchain for compiling minGW w64 programs:

    pacman -S --needed base-devel mingw-w64-x86_64-toolchain
    

    When asked which packages to install, enter all of the packages as a range. For example, if the highest package listed is 19, enter 1-19.

  • Add C:\msys64\usr\bin and C:\msys64\mingw64\bin to your Windows PATH (you may need to reboot)

  • Get git and its dependencies:

    pacman -S --needed git
    
  • Get a list of the project's current branches:

    git ls-remote --heads https://github.com/Seagate/openSeaChest.git | sed 's?.*refs/heads/??'
    
  • To clone the release/Release-20.11 branch and cd into it (replace with your chosen branch):

    git clone --recurse-submodules  --branch release/Release-20.11 --single-branch  https://github.com/Seagate/openSeaChest.git openSeaChest && cd openseaChest 
    
  • Fetch and update each submodule:

    git submodule foreach 'git config remote.origin.fetch refs/heads/*:refs/remotes/origin/*'
    git submodule foreach 'git fetch'
    git submodule foreach --recursive 'git checkout release/Release-20.11'
    
  • Finally, enter the Make/gccWin/ directory and start building the utilities:

    cd Make/gccWin/ && make -f Makefile.gccWin
    

The compiled executables will be located in the openseachest_exes directory. You can safely delete all of the files with numbers suffixed to the end of them - this is an outdated step of the build process created by the original developer and intended to be removed soon.

To use the remaining binaries, move them to somewhere in your Cygwin PATH such as /usr/local/bin. I also recommend renaming them from the long-winded openSeaChest_ to something like this:

$ ls     

openSeaChest_Basics.exe
openSeaChest_Configure.exe
openSeaChest_Erase.exe
openSeaChest_Firmware.exe
openSeaChest_Format.exe
openSeaChest_GenericTests.exe
openSeaChest_Info.exe
openSeaChest_Logs.exe
openSeaChest_NVMe.exe
openSeaChest_PassthroughTest.exe
openSeaChest_PowerControl.exe
openSeaChest_SMART.exe
openSeaChest_ZBD.exe

$ rename "openSeaChest" "osc" *.exe

osc_Basics.exe
osc_Configure.exe
osc_Erase.exe
osc_Firmware.exe
osc_Format.exe
osc_GenericTests.exe
osc_Info.exe
osc_Logs.exe
osc_NVMe.exe
osc_PassthroughTest.exe
osc_PowerControl.exe
osc_SMART.exe
osc_ZBD.exe

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .