hdparm doesn't read SSD? HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
I'm trying to use hdparm
to do secure erase of my 512GB SSD SK Hynix.
SSD has Windows 10 installed in it.
I boot Ubuntu from a usb flash drive.
sudo fdisk -l
I get a lot of different disks, turns out /dev/sda
is my 8gb flash drive, not SSD.
SSD is listed as:
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt
Now when I try to run hdparm -I /dev/nvme0n1
, terminal gives me error:
/dev/nvme0n1: HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
how do I use hdparm
secure erase option on my SSD? From suggestion in another page on the internet, nvme-cli package was suggested, but I don't understand how that helps.
using shred command isn't recommended for SSD because SSD has limited read/write cycles, and it works very differently than HDD.
Update: my SSD is an NVMe device, not ATA, therefore hdparm
command isn't suitable, use nvme -format
instead.
To erase an NVMe device using nvme-cli, run nvme format -s1 <device>
.
nvme-cli package was suggested, but I don't understand how that helps.
hdparm works exclusively with devices which speak the ATA protocol, but your SSD is built to speak the NVMe protocol.
That difference is not limited to just physical connection (like IDE/SATA) – instead the OS has to use an entirely different set of commands when communicating with the device. None of the ATA commands apply to NVMe (the general idea of "secure erase" is present, but it's implemented differently).
Therefore nvme-cli was suggested to you because hdparm is the wrong tool for the job from the very beginning.
In theory, it would be possible for an OS to translate between the command sets (intercept ATA commands and issue equivalent NVMe commands), and indeed the Linux kernel internally does this to some extent for SCSI-to-ATA. At some point, Linux even used to support basic SCSI-to-NVMe translation, but this was eventually removed as the systems are just too different.
However, it wouldn't have helped you because Linux doesn't do it the other way around: you already can't use the ATA-specific hdparm against SCSI disks, and likewise you wouldn't have been able to use hdparm against NVMe disks.