In python, can I see if a file lives on an HD or an SSD?
cat /sys/block/sda/queue/rotational is a good way of finding out if your hard drive is a SSD or a hard disk. You can also slightly change this command in order to get other useful information like cat /sys/block/sdb/queue/rotational.
I want to randomly access the elements of a large array (>7GB) that I load into Python as a either an HDF5 dataset (h5py.Dataset), or a memory-mapped array (numpy.memmap).
If this file lives on an spinning-platter HD, these random accesses take forever, for obvious reasons.
Is there a way to check (assert) that the file in question lives on an SSD, before attempting these random accesses?
I am running python in Linux (Ubuntu 14.04). I don't mind non-cross-platform solutions.