Making Block Devices Read Only

From Jeremy Bryan Smith
Jump to navigation Jump to search

Making block devices read-only (and read+write):

To make /dev/XXX read-only using the blockdev command:

blockdev --setro /dev/XXX

To make /dev/XXX read-write using the blockdev command:

blockdev --setrw /dev/XXX

To make /dev/XXX read-only using the hdparm command:

hdparm -r0 /dev/XXX

To make /dev/XXX read-write using the hdparm command:

hdparm -r1 /dev/XXX

Changes will only be temporary. The device will revert to read-write mode upon a reboot.