Article 595V0 Detection of readonly or readwrite modes of NVMe devices in Linux

Detection of readonly or readwrite modes of NVMe devices in Linux

by
smashit
from LinuxQuestions.org on (#595V0)
I am using NVMe devices on SLES15 sp1 and sp2 both. These NVMe devices are exposed through SAN. Because they exported from SAN, these devices can go readonly or back to readwrite due to some changes by host or internally. I am trying to find out a way in sales host if the device is readonly without doing any IOs to it. 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 want to know how I can 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.
Thankslatest?d=yIl2AUoC8zA latest?i=5KRt8dtzat8:PzPuSM-J25o:F7zBnMy latest?i=5KRt8dtzat8:PzPuSM-J25o:V_sGLiP latest?d=qj6IDK7rITs latest?i=5KRt8dtzat8:PzPuSM-J25o:gIN9vFw5KRt8dtzat8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments