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 ?

  • as far as I know the kernel recognizes such changes and you should see a message in dmesg, informing about a read-only filesystem. I don't know if it does that if the filesystem becomes rw again, never had such a case. – eblock Nov 26 '20 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.