Making Block Devices Read Only

From Jeremy Bryan Smith
Revision as of 20:13, 11 February 2021 by Jeremy (talk | contribs) (Created page with " Making block devices read-only (and read+write): To make '''<tt>/dev/XXX</tt>''' read-only using the '''<tt>blockdev</tt>''' command: blockdev --setro /dev/XXX To make '''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.