# Identify type of disk



## srchi (Mar 2, 2021)

I'm trying to create zpool based on type of hard disk(HDD,SSD and NVMRAM).
But how to identify the disk type?
Preferred: command or any logic to identify but no additional package need to install to check disk type. But still welcome for package installation if we don't have any option.


----------



## SirDice (Mar 2, 2021)

`camcontrol devlist`? There are probably also a few sysctls that could provide some information. You're not going to be able to tell what it is just by looking at the device name as they'll probably all going to be da(4) devices (except the NVMe drives, they'll show up as nvd(4)/nda(4)).


----------



## ralphbsz (Mar 2, 2021)

For SCSI disks, the Inquiry command will return whether a device is a disk, tape, or other. And reading mode page 4 (which can be done with "camcontrol modepage) will tell you the RPM (rotations per minute) for spinning disks, and whether the disk is spinning at all.

The acronym "NVMRAM" you use is confusing. Do you mean NVRAM? That acronym is used in two ways, either for the whole class of semiconductor storage devices (which includes SSDs and NVMe storage devices), or more specifically for non-volative memory that has the speed of normal RAM (Intel's 3D Xpoint is the closest thing consumers will encounter). Or do you mean NVMe, which is a specific technology to connect solid-state disk drives with more parallel interfaces, and the ability to create networks? Or do you mean MRAM, which is a very specific (and unusual) technology for solid-state disks, which relies on magnetic technology? I bet you mean NVMe. The way to distinguish between traditional SSDs (which are connected via SCSI or SATA) and NVMe is the device name, as SirDice said: da... and ada... versus nvd... and nda...

But in reality: If you explain to us what you are really trying to accomplish, maybe we can help more. You are trying to create a ZFS pool? What difference does it make whether the underlying disk is rotating, SSD, and how connected?


----------



## srchi (Mar 3, 2021)

Im trying to create zpool configuration
condition: if i found HDD disk i need to create mirror/RAIDZ with HDD disks. 
if i found SSD/NVM then i need to create cache configuration


----------



## ralphbsz (Mar 3, 2021)

So all you want to know: "spinning rust" versus "silly con"? Easiest thing to do: "camcontrol identify" on /dev/adaX, then grep the result for "RPM", and check whether you see a number or "non-rotating". I don't have a SCSI disk handy, so I can't tell you what to look in the output of "camcontrol modepage /dev/xxx -m 4". No packages required, these are all built-in commands.


----------



## Snurg (Mar 3, 2021)

Is that RPM information actually available on older drives manufactured when SSD were not yet as common as today?
If this is not guaranteed, I don't think this would be reliable.
There are other tricks, some examples here, but they have all their uncertainties.
For my part, with my present little knowledge, I believe making a reasonably reliable recognition might be next to impossible.


----------



## Bobi B. (Mar 3, 2021)

diskinfo(8) can help: `diskinfo -v da0`

But lately to see what disks are available I use gstat(8), like `gstat -pb`, because some disks are not listed by `camcontrol devlist` (like mfi(4) or nvd(4)).


----------



## srchi (Mar 3, 2021)

disks are attached as below
left side(1st server):NVM disk attached | right side(2nd server):SSD disk attached
but i didnt see any diff with respect to the disks.

any way to check rate of speed of each disk? so that we can identify the disk type.





.


----------



## srchi (Mar 3, 2021)

ralphbsz said:


> So all you want to know: "spinning rust" versus "silly con"? Easiest thing to do: "camcontrol identify" on /dev/adaX, then grep the result for "RPM", and check whether you see a number or "non-rotating". I don't have a SCSI disk handy, so I can't tell you what to look in the output of "camcontrol modepage /dev/xxx -m 4". No packages required, these are all built-in commands.


I can see this on my digital ocean (I see same output on SSD and NVM disks). I don't have HDD disks to check the output. Can you please tell me what output I would get to identify disk type based on rotation rate

```
root@mfsbsd:~ # camcontrol modepage /dev/da0 -m 4
Number of Cylinders: 16383
Number of Heads: 16
Starting Cylinder-Write Precompensation: 16383
Starting Cylinder-Reduced Write Current: 16383
Drive Step Rate: 200
Landing Zone Cylinder: 16777215
RPL: 0
Rotational Offset: 0
Medium Rotation Rate: 5400
```
on virtualBox: I got this error as below (my mac with SSD configuration I added disk to virtual box as SATA (I'm not sure it will take SSD which my mac as SSD setup or will it take HDD disk for virtual box setup)

```
root@mfsbsd:~ # camcontrol modepage /dev/ada0 -m 4
camcontrol: mode sense command returned error
```


----------



## SirDice (Mar 3, 2021)

In both cases (Digital Ocean and VirtualBox) you're looking at a virtualized disk image.


----------



## srchi (Mar 3, 2021)

Ok, but how to identify its HDD or SSD. does HDD disk also give Medium Rotation Rate: 5400? if i run camcontrol modepage /dev/da0 -m 4. if HDD doesnt have rotation rate or any other property from camcontrol command as compared to SSD then my problem will be solved. so please tell me what i would get if i run camcontrol modepage /dev/da0 -m 4 for HDD disks?


----------



## SirDice (Mar 3, 2021)

I don't think there's an easy way to tell if a specific disk image is stored on SSD or harddisks. They're going to be presented to a virtual guest in exactly the same way regardless of the storage backend. Maybe with Digital Ocean they used a different naming scheme (look at the device model name) to indicate the difference, but maybe they don't.


----------



## ralphbsz (Mar 3, 2021)

srchi said:


> Ok, but how to identify its HDD or SSD. does HDD disk also give Medium Rotation Rate: 5400? if i run camcontrol modepage /dev/da0 -m 4. if HDD doesnt have rotation rate or any other property from camcontrol command as compared to SSD then my problem will be solved. so please tell me what i would get if i run camcontrol modepage /dev/da0 -m 4 for HDD disks?


That is sort of a silly question. What you are dealing with at a cloud or hosting provider is not a real disk. I don't know how these two companies implement their virtual disk, but guessing from how others do it, they probably use RAID technology underneath to guard against disk failure, then a file system (could be a lightweight one), probably with some snapshot support, and then a disk virtualization layer. The hardware is probably a mix of spinning disks (which still have the best $/capacity and $/throughput) plus SSD/flash/NVRAM for low-latency IOs.

You probably need to look at their sales literature. I know at other providers you can rent both high-capacity (mostly spinning disk) drives, and explicit SSDs that are for low latency.

But the real underlying question is this: Why do you care? You're trying to set up ZFS, with the main storage on disks (presumably for capacity) and SSDs as logs and caches. Have you actually benchmarked whether you need these logs and caches? It's quite possible that those virtual disks are so fast for small IOs, you don't need any of these accelerators.


----------



## aponomarenko (Mar 5, 2021)

`smartctl -x /dev/ada0 | grep Solid`


----------

