How to tell if linux disk is READ ONLY

7,368

Solution 1

You can tell if the disk itself is set as read only by mounting it and using the mount command or by running cat /proc/mounts

It's difficult to tell whether or not the hardware switch is on without knowing who manufactures the disk.

Your best bet would be to look that information up and see if there is a way to do so. A good starting point would be the manufacturer's website.

Solution 2

try with hdparm (https://linux.die.net/man/8/hdparm ) it should show this, I assume.

Share:
7,368

Related videos on Youtube

Abuzer Kadayif
Author by

Abuzer Kadayif

Updated on September 18, 2022

Comments

  • Abuzer Kadayif
    Abuzer Kadayif over 1 year

    I have a sata disk on module which has a hardware switch which can lock the disk from being written in a READ ONLY MODE. Is there a way to tell in software whether or not that switch has been switched to the READ ONLY mode?

    I've already examined:

    lsblk

    smartctrl

    parted

    I wonder if there is an endpoint in : /sys/class/scsi_disk/ perhaps?