I have recently started using NVMe devices for Linux which are exposed through SAN. I am trying to find out if the device is readonly without doing any IOs to it. The underlying device in Storage goes readonly mode, but I couldn't find a way to find the correct state in Linux environment . The small dd command that I did, succeeded but IO errors appeared in dmesg. At a later point when device turned rw, again I couldn't find if the device is rw now. dd command succeeded and no bad messages in dmesg. In summary, I would like to understand if there is a programmatic way to find out if device is read only. I do see a file called “/sys/block/nvmeXnY/ro” but that always remained 0 even when device is readonly. Moreover, when I try "blockdev –rereadpt /dev/nvmeXnY; blockdev -report /dev/nvmeXnY", the output is always RW. Any clues ?