diff --git a/cmd/disk_wipe.go b/cmd/disk_wipe.go index faaa460..accc2b3 100644 --- a/cmd/disk_wipe.go +++ b/cmd/disk_wipe.go @@ -80,16 +80,26 @@ func init() { case "nvme": wiper = utils.NewNvmeCmd(verbose) case "sata": - // Lets figure out if the drive supports TRIM + // Lets figure out the drive capabilities in an easier format + var sanitize bool + var esee bool var trim bool for _, cap := range drive.Capabilities { - if strings.HasPrefix(cap.Description, "Data Set Management TRIM supported") { + switch { + case cap.Description == "encryption supports enhanced erase": + esee = cap.Enabled + case cap.Description == "SANITIZE feature": + sanitize = cap.Enabled + case strings.HasPrefix(cap.Description, "Data Set Management TRIM supported"): trim = cap.Enabled - break } } - if trim { + switch { + case sanitize || esee: + // Drive supports Sanitize or Enhanced Erase, so we use hdparm + wiper = utils.NewHdparmCmd(verbose) + case trim: // Drive supports TRIM, so we use blkdiscard wiper = utils.NewBlkdiscardCmd(verbose) } @@ -102,6 +112,8 @@ func init() { }).Fatal("failed find appropriate drive wiper") } + logger = logrus.New() + logger.SetLevel(logrus.DebugLevel) err = wiper.WipeDrive(ctx, logger, drive) if err != nil { l.Fatal("failed to wipe drive")