This throws a warning immediatly after starting the install command if the target sdcard might actually be an HDD. I've chosen the sysfs method since all other methods require root access to get the disk size.
This is an example on the same disk that caused my data loss: