A quick way to check the type of the drive












9















Is there a quick way to understand a type of the "storage" on Linux? Is it a HDD or SSD (or NVMe)?
It's already known that the host is a physical machine and not a VM.
The first thing I though about was rotational flag under /sys/block/<device>/queue/ directory. But in my experience even for SSD devices it may contain "1" value.
The second way and more realistic and truthful was a latency. It's a bit harder to measure (some work with /proc/diskstats), but looks more preferable.



Is there any other ways? It's important to mention that I don't need to know exact model of the "storage", just its type.










share|improve this question


















  • 1





    Measuring latency is not a good answer as some rotational disks come with huge caches which may or may not be easy to distinguish from full capacity solid state devices.

    – anx
    Jan 21 at 11:03






  • 2





    Along with smartctl mentioned here, other utilities such as lshw and lsblk report the same information. See also askubuntu.com/q/792814/295286

    – Sergiy Kolodyazhnyy
    Jan 21 at 15:47






  • 1





    what would you use this info for? In other words, if I give you program called isHDDorSSD what will you do with it

    – aaaaaa
    Jan 21 at 18:18











  • Bonnie++ can show SSD vs HDD based on IOPS (as can dd)

    – warren
    Jan 21 at 18:19











  • @Sergiy Kolodyazhnyy, I've not found such info in lshw. Also lsblk relies on rotational flag in sysfs directory hence I can't trust it. smartctl uses ioctl call and asks inforamtion directly from device.

    – lesovsky
    Jan 21 at 19:32
















9















Is there a quick way to understand a type of the "storage" on Linux? Is it a HDD or SSD (or NVMe)?
It's already known that the host is a physical machine and not a VM.
The first thing I though about was rotational flag under /sys/block/<device>/queue/ directory. But in my experience even for SSD devices it may contain "1" value.
The second way and more realistic and truthful was a latency. It's a bit harder to measure (some work with /proc/diskstats), but looks more preferable.



Is there any other ways? It's important to mention that I don't need to know exact model of the "storage", just its type.










share|improve this question


















  • 1





    Measuring latency is not a good answer as some rotational disks come with huge caches which may or may not be easy to distinguish from full capacity solid state devices.

    – anx
    Jan 21 at 11:03






  • 2





    Along with smartctl mentioned here, other utilities such as lshw and lsblk report the same information. See also askubuntu.com/q/792814/295286

    – Sergiy Kolodyazhnyy
    Jan 21 at 15:47






  • 1





    what would you use this info for? In other words, if I give you program called isHDDorSSD what will you do with it

    – aaaaaa
    Jan 21 at 18:18











  • Bonnie++ can show SSD vs HDD based on IOPS (as can dd)

    – warren
    Jan 21 at 18:19











  • @Sergiy Kolodyazhnyy, I've not found such info in lshw. Also lsblk relies on rotational flag in sysfs directory hence I can't trust it. smartctl uses ioctl call and asks inforamtion directly from device.

    – lesovsky
    Jan 21 at 19:32














9












9








9


1






Is there a quick way to understand a type of the "storage" on Linux? Is it a HDD or SSD (or NVMe)?
It's already known that the host is a physical machine and not a VM.
The first thing I though about was rotational flag under /sys/block/<device>/queue/ directory. But in my experience even for SSD devices it may contain "1" value.
The second way and more realistic and truthful was a latency. It's a bit harder to measure (some work with /proc/diskstats), but looks more preferable.



Is there any other ways? It's important to mention that I don't need to know exact model of the "storage", just its type.










share|improve this question














Is there a quick way to understand a type of the "storage" on Linux? Is it a HDD or SSD (or NVMe)?
It's already known that the host is a physical machine and not a VM.
The first thing I though about was rotational flag under /sys/block/<device>/queue/ directory. But in my experience even for SSD devices it may contain "1" value.
The second way and more realistic and truthful was a latency. It's a bit harder to measure (some work with /proc/diskstats), but looks more preferable.



Is there any other ways? It's important to mention that I don't need to know exact model of the "storage", just its type.







linux storage proc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 21 at 5:16









lesovskylesovsky

585




585








  • 1





    Measuring latency is not a good answer as some rotational disks come with huge caches which may or may not be easy to distinguish from full capacity solid state devices.

    – anx
    Jan 21 at 11:03






  • 2





    Along with smartctl mentioned here, other utilities such as lshw and lsblk report the same information. See also askubuntu.com/q/792814/295286

    – Sergiy Kolodyazhnyy
    Jan 21 at 15:47






  • 1





    what would you use this info for? In other words, if I give you program called isHDDorSSD what will you do with it

    – aaaaaa
    Jan 21 at 18:18











  • Bonnie++ can show SSD vs HDD based on IOPS (as can dd)

    – warren
    Jan 21 at 18:19











  • @Sergiy Kolodyazhnyy, I've not found such info in lshw. Also lsblk relies on rotational flag in sysfs directory hence I can't trust it. smartctl uses ioctl call and asks inforamtion directly from device.

    – lesovsky
    Jan 21 at 19:32














  • 1





    Measuring latency is not a good answer as some rotational disks come with huge caches which may or may not be easy to distinguish from full capacity solid state devices.

    – anx
    Jan 21 at 11:03






  • 2





    Along with smartctl mentioned here, other utilities such as lshw and lsblk report the same information. See also askubuntu.com/q/792814/295286

    – Sergiy Kolodyazhnyy
    Jan 21 at 15:47






  • 1





    what would you use this info for? In other words, if I give you program called isHDDorSSD what will you do with it

    – aaaaaa
    Jan 21 at 18:18











  • Bonnie++ can show SSD vs HDD based on IOPS (as can dd)

    – warren
    Jan 21 at 18:19











  • @Sergiy Kolodyazhnyy, I've not found such info in lshw. Also lsblk relies on rotational flag in sysfs directory hence I can't trust it. smartctl uses ioctl call and asks inforamtion directly from device.

    – lesovsky
    Jan 21 at 19:32








1




1





Measuring latency is not a good answer as some rotational disks come with huge caches which may or may not be easy to distinguish from full capacity solid state devices.

– anx
Jan 21 at 11:03





Measuring latency is not a good answer as some rotational disks come with huge caches which may or may not be easy to distinguish from full capacity solid state devices.

– anx
Jan 21 at 11:03




2




2





Along with smartctl mentioned here, other utilities such as lshw and lsblk report the same information. See also askubuntu.com/q/792814/295286

– Sergiy Kolodyazhnyy
Jan 21 at 15:47





Along with smartctl mentioned here, other utilities such as lshw and lsblk report the same information. See also askubuntu.com/q/792814/295286

– Sergiy Kolodyazhnyy
Jan 21 at 15:47




1




1





what would you use this info for? In other words, if I give you program called isHDDorSSD what will you do with it

– aaaaaa
Jan 21 at 18:18





what would you use this info for? In other words, if I give you program called isHDDorSSD what will you do with it

– aaaaaa
Jan 21 at 18:18













Bonnie++ can show SSD vs HDD based on IOPS (as can dd)

– warren
Jan 21 at 18:19





Bonnie++ can show SSD vs HDD based on IOPS (as can dd)

– warren
Jan 21 at 18:19













@Sergiy Kolodyazhnyy, I've not found such info in lshw. Also lsblk relies on rotational flag in sysfs directory hence I can't trust it. smartctl uses ioctl call and asks inforamtion directly from device.

– lesovsky
Jan 21 at 19:32





@Sergiy Kolodyazhnyy, I've not found such info in lshw. Also lsblk relies on rotational flag in sysfs directory hence I can't trust it. smartctl uses ioctl call and asks inforamtion directly from device.

– lesovsky
Jan 21 at 19:32










1 Answer
1






active

oldest

votes


















12














How about something like sudo smartctl -a /dev/<device> | grep Rotation -- if this returns Rotation Rate: Solid State Device, then that's an SSD. Not sure if this bullet-proof method, either.






share|improve this answer



















  • 1





    Looks good, it works even with drives attached through RAID cards.

    – lesovsky
    Jan 21 at 6:56











  • @lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

    – Mark
    Jan 22 at 0:07











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f950004%2fa-quick-way-to-check-the-type-of-the-drive%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









12














How about something like sudo smartctl -a /dev/<device> | grep Rotation -- if this returns Rotation Rate: Solid State Device, then that's an SSD. Not sure if this bullet-proof method, either.






share|improve this answer



















  • 1





    Looks good, it works even with drives attached through RAID cards.

    – lesovsky
    Jan 21 at 6:56











  • @lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

    – Mark
    Jan 22 at 0:07
















12














How about something like sudo smartctl -a /dev/<device> | grep Rotation -- if this returns Rotation Rate: Solid State Device, then that's an SSD. Not sure if this bullet-proof method, either.






share|improve this answer



















  • 1





    Looks good, it works even with drives attached through RAID cards.

    – lesovsky
    Jan 21 at 6:56











  • @lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

    – Mark
    Jan 22 at 0:07














12












12








12







How about something like sudo smartctl -a /dev/<device> | grep Rotation -- if this returns Rotation Rate: Solid State Device, then that's an SSD. Not sure if this bullet-proof method, either.






share|improve this answer













How about something like sudo smartctl -a /dev/<device> | grep Rotation -- if this returns Rotation Rate: Solid State Device, then that's an SSD. Not sure if this bullet-proof method, either.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 21 at 5:31









Janne PikkarainenJanne Pikkarainen

28.2k34167




28.2k34167








  • 1





    Looks good, it works even with drives attached through RAID cards.

    – lesovsky
    Jan 21 at 6:56











  • @lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

    – Mark
    Jan 22 at 0:07














  • 1





    Looks good, it works even with drives attached through RAID cards.

    – lesovsky
    Jan 21 at 6:56











  • @lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

    – Mark
    Jan 22 at 0:07








1




1





Looks good, it works even with drives attached through RAID cards.

– lesovsky
Jan 21 at 6:56





Looks good, it works even with drives attached through RAID cards.

– lesovsky
Jan 21 at 6:56













@lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

– Mark
Jan 22 at 0:07





@lesovsky, I wouldn't count on it working through a RAID card. I don't have any SSDs attached to RAID that I can test with, but it shows incorrect rotational rates for the spinning disks (every disk in the array shows up as 10k, when they're all actually 7.2k).

– Mark
Jan 22 at 0:07


















draft saved

draft discarded




















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f950004%2fa-quick-way-to-check-the-type-of-the-drive%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]