Call block device ioctls from the command line.
The blockdev command calls ioctl functions from the command line to achieve control over devices.
blockdev [options] [parameters]
-V: Print version number and exit.
-q: Quiet mode.
-v: Verbose mode.
--setro: Set read-only.
--setrw: Set read-write.
--getro: Print read-only status. "1" means read-only, "0" means not read-only.
--getss: Print sector size. Usually 512.
--flushbufs: Flush buffers.
--rereadpt: Reread partition table.
Device Filename: Specify the device filename of the disk to be operated on.
Set a device to read-only:
blockdev --setro /dev/hda4
Check if a device is read-only:
blockdev --getro /dev/hda4
Set a device to read-write:
blockdev --setrw /dev/hda4