Friday, February 13, 2015

ubuntu - 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.


Answer



To erase an NVMe device using nvme-cli, run nvme format -s1 .



nvme-cli package was suggested, but I don't understand how that helps.



hdparm works exclusively with ATA devices, and your SSD is an NVMe device. That doesn't mean just a new connection type (like SATA) or the same 'disk' concepts in different terms (like SCSI/SAS) – instead it's a whole different kind of storage device entirely.


None of the ATA commands apply to NVMe (the general idea of "secure erase" is present, but it's implemented differently), and so nvme-cli was suggested to you because hdparm is simply the wrong tool for the job.


(At some point Linux used to support basic SCSI-NVMe command translation, but eventually removed it as the systems are just too different (unlike SCSI-ATA translation which is successfully used). Not that it would have helped you either way, as the features accessed by hdparm are very ATA-specific and aren't covered by the translation anyway. Even basic hdparm -i doesn't work on SCSI disks.)


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...