16

I have a machine with both SATA and PCIe SSDs attached. Is there a set of Linux commands (on Ubuntu or CentOS) that I can use to check if a given SSD is SATA or PCIe?

2 Answers 2

18
lsblk -io NAME,TYPE,SIZE,MOUNTPOINT,FSTYPE,MODEL

will identify all the block devices, i.e., drives. Then, run

sudo hdparm -I /dev/sd*X* | grep SATA 

where X is each drive letter found. If the result contains SATA, well, it's the SATA drive.

Alternatively,

lspci

will identify all the PCI devices, including PCIe.

Or, you can look for the NVMe logo on the drive.

2
  • 3
    I have a M2 drive that I'm pretty sure is using PCIe (it's in the M2 slot on the mobo), but it says SATA all over the place on the second command. I don't understand, I thought it was PCI. There's also a sata controller listed in the lspci Commented Nov 16, 2017 at 22:11
  • 3
    Many M.2 SSDs simply have a SATA interface. This is most probaby the reason why your M.2 drive is displayed as a SATA device. M.2 SSDs with SATA interface are BTW not faster than regular SATA SSDs (I found out the hard way after I had bought an M.2 and thought it would be much faster than my regular SSD).
    – zepp133
    Commented Sep 28, 2018 at 11:22
2

Use lshw. It'll show disk type in the description field

$ sudo lshw -class disk
  *-namespace
       description: NVMe namespace
       physical id: 1
       logical name: /dev/nvme0n1
       size: 1863GiB (2TB)
       capabilities: partitioned partitioned:luks
       configuration: logicalsectorsize=512 sectorsize=512
  *-disk
       description: ATA Disk
       product: Samsung SSD 870
       physical id: 0.0.0
       bus info: scsi@5:0.0.0
       logical name: /dev/sda
       version: 2B6Q
       serial: S6BANF0RC01234F
       size: 3726GiB (4TB)
       capabilities: gpt-1.00 partitioned partitioned:gpt
       configuration: ansiversion=5 guid=976d3e6c-1be0-a242-b576-9dba0d929aa4 logicalsectorsize=512 sectorsize=512

You must log in to answer this question.

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