When I check whether one of my server’s storage device is an HDD or an SSD, I use the following commands:
Step 1. Get device major:minor numbers:
$ stat /path/to/some/file/on/device ... Device: fd00h/64768d ...
Step 2. Use the device numbers to find the device under
$ ls -l /sys/dev/block/7:26 lrwxrwxrwx 1 root root 0 Apr 15 07:25 /sys/dev/block/7:26 -> ../../devices/virtual/block/loop26
where 7 is the major device number and 26 is the minor. From the above numbers, you can compute these using:
$ expr 64768 / 256 # major 253 $ expr 64768 % 256 # minor 0
Step 3. Find the
Now, if I look at the
../../devices/virtual/block/loop26 folder, I can search and find a rotational file. But first I rebuild the path properly. This means I want a full path rather than a relative path. As we can see, there are two
.. which means we go up two directories. The result is:
Lets look inside that folder:
$ ls /sys/devices/virtual/block/loop26 ... queue ...
We see a queue sub-directory, let’s look inside:
$ ls /sys/devices/virtual/block/loop26/queue ... rotational ...
rotational file exists, let’s print the content:
$ cat /sys/devices/virtual/block/loop26/queue/rotational 1
The loop device is considered to be a rotational (HDD) device!
IMPORTANT NOTE: In some cases, the queue sub-directory is one or two directories up. So the first
ls command may not show it. Try again after removing one sub-directory in your path. Repeat until you find a
queue sub-directory or the path is only 3 segments (
/sys/devices/virtual in my example).
So now I have a way to check the rotational file. When I test against my SSD drives on my server at home, I get
0 as expected. The disk is not rotational.
When I check on DigitalOcean, I get a
1 as if the drive in my VPS was a rotational (HDD) file. It should return
0. Just in case, I tested in VirtualBox on my server, and I get the same effect. If I create a disk in my VirtualBox server which is on an SSD, it does not recognize it as an SSD within VirtualBox. So I am thinking that both systems are using the same driver to simulate hard drives within the VPS…
Are there plans to fix this issue at DigitalOcean? I would need to know whether drive A is SSD or HDD and drive B is SSD or HDD and I would prefer not to have to indicate that information manually since this is prone to mistakes over time.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
I received an email suggesting to post a suggestion on the “ideas” website. Here is a link to that post:
You’re correct that the method you’re using to check whether the storage device is an HDD or SSD might not work correctly in virtualized environments such as DigitalOcean or VirtualBox. Virtual machines are provided with virtual disks, which may not accurately report the underlying physical disk’s characteristics.
DigitalOcean uses SSDs for all its droplets, so you can be confident that your droplet is using SSD storage. You can find this information on the DigitalOcean product documentation.
In virtualized environments, it is generally not practical for the virtual machines to directly access information about the underlying hardware. The hypervisor abstracts the hardware, and virtual machines work with the virtualized resources provided by the hypervisor. This abstraction layer is necessary for features like live migration and hardware independence.
If you need to differentiate between SSD and HDD storage for specific application requirements, you can either hardcode this information in your application’s configuration or use environment variables or other configuration methods to provide this information to your application.
My guess would be that there might not be plans to fix this issue at DigitalOcean, but you can safely assume that all storage provided by DigitalOcean droplets is SSD-based.
In case this is a blocker for you, it might be best to reach out to the DigitalOcean support team who will be able to provide you with more information about it:
Hope that this helps!