Calling the block device control program from the command line
blockdev command Call the "ioxtls" function in the command to control the device.
blockdev(options)(parameters)Options
-V: Print version number and exit;
-q: Quiet mode;
-v: detailed information mode;
--setro: read-only;
--setrw: write only;
--getro: Print read-only status, "1" means read-only, "0" means non-read-only;
--getss: Print sector size. Usually 521;
--flushbufs: Flush buffer;
--rereadpt: Reread the partition table.Device file name: Specify the device file name of the disk to be operated.
Set the device as read-only:
blockdev --setro /dev/hda4Read whether the device is read-only:
blockdev --getro /dev/hda4Set the identifier to be readable and writable:
blockdev --setrw /dev/hda4