9

I searched and found 2 options, none of which I'm confident provided me the answer.

1: cat /sys/block/sda/queue/rotational

This output '1' to stdout. What does this mean?

2: lshw -class disc

but couldn't find anything that answers my question.

6
  • Is this a VPS or bare metal? Nov 7, 2013 at 19:06
  • its VPS and i have root access
    – Amir Bar
    Nov 7, 2013 at 19:07
  • 5
    The honor system.
    – MDMoore313
    Nov 7, 2013 at 19:16
  • 3
    @MDMoore313: Exactly. Quite frankly, if I had reason to even suspect my hoster would try to fool me like that, I would switch away immediately.
    – Sven
    Nov 7, 2013 at 19:36
  • This is not a technical problem...
    – ewwhite
    Dec 25, 2013 at 13:23

2 Answers 2

18

Let's try to read 1000 random 4k blocks from first 16GB of a disk:

time for i in `seq 1 1000`; do
    dd bs=4k if=/dev/sda count=1 skip=$(( $RANDOM * 128 )) >/dev/null 2>&1;
done

This is something that should be very slow on rotating drive in comparison with SSD. On my desktop class SSD it ends in about a second. On desktop class 7200rpm rotating drive it ends in 10 seconds.

5
  • thank I got these respone: real 0m1.632s user 0m0.336s sys 0m0.939s it mean i am on ssd?
    – Amir Bar
    Nov 8, 2013 at 8:37
  • 1
    I'm pretty sure you are.
    – Tometzky
    Nov 8, 2013 at 12:44
  • on my VM whose virtual disk is placed on an HDD it takes only ~1.5s to complete this so it's not correct
    – phuclv
    Dec 6, 2016 at 2:27
  • 1
    You might need to make sure that you have data there. Unused space on a VM volume might be using sparse files or equivalent technology - that would fool this check. Also if there are like 10+ drives in RAID behind this, which would share load, then it's not that easy to distinguish it from single SSD.
    – Tometzky
    Dec 7, 2016 at 17:16
  • That hides all errors :D So you can measure error reporting time: dd: failed to open ‘/dev/sdb’: Permission denied
    – filimonov
    Apr 20, 2020 at 7:13
4

In a physical machine (not a VPS), you can get the type with smartctl:

smartctl -a /dev/sda

and grep for Rotation:

smartctl -a /dev/sda | grep Rotation
Rotation Rate:    Solid State Device

smartctl -a /dev/sdb | grep Rotation
Rotation Rate:    5400 rpm

It's quite likely you have no chance to identify the disk type inside a VPS, as the hypervisor abstracts the real hardware away from the guest machines.

3
  • there is nothing i can install for exmaple that will check the write speed or something? becuose i am afraid that he gave me normal hd when he promised for ssd
    – Amir Bar
    Nov 7, 2013 at 19:15
  • 2
    It's somewhat difficult inside a VPS because there are many factors affecting the disk speed, but at least the access times should be significantly better with a SSD as compared to normal disks. Try bonnie++ etc.
    – Sven
    Nov 7, 2013 at 19:29
  • 3
    @amirbar you have to remember also that your VPS could be distributed amongst several drives and/or CPUs, I wouldn't worry too much about physical hardware as I would actual performance of the service you're trying to run on the VPS. SSDs are nice but not necessarily a requirement for most services.
    – MDMoore313
    Nov 7, 2013 at 19:33

You must log in to answer this question.

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