Invokes the device's IOCTL function at the command line. In a Linux system, it seems that the direct operation of the device is only IOCTL function. The parameters he accepts are not too much, and they all correspond to one by one.
Blockdev-Call block Device control program from the command line
Blockdev [Options] Commands devices
The Blockdev tool allows the block device control program to be invoked from the command line.
–setro set device to read-only
–getro read whether the device is read-only (successful for 1,0 is writable)
–SETRW setting is read-only
–GETSS the sector size of the print device, usually 512
–getsize Print set other capacity, calculated in 512 bytes per sector
–setra N Sets the pre-read sector (512 bytes) to N. Set ReadAhead to n 512-byte sectors.
–getra Print ReadAhead (pre-read sector)
–flushbufs Refresh Buffer
–REREADPT reread the partition table.
Think –SETRO,SETRW is more useful, this mount-o ro (rw) is a difference, mount is at the file system at this level for a partition to mount as read-only or writable. The Blockdev is set to read-only and read-write at the setting level.
Look at the output of the command below at a glance.
The
code is as follows:
[root@lancy ~]# blockdev–setro/dev/hda4
[root@lancy ~]# blockdev–getro/dev/hda4
1
[root@lancy ~]# mount/dev/hda4/misc-o rw
Mount:block device/dev/hda4 is write-protected, mounting read-only
[root@lancy ~]# umount/dev/hda4
[Root@lancy ~]# blockdev–setrw/dev/hda4
[root@lancy ~]# blockdev–getro/dev/hda4
0
[root@lancy ~]# mount/dev/hda4/misc-o rw
[root@lancy ~]# touch/misc/one
[root@lancy ~]# umount/dev/hda4
[root@lancy ~]# mount/dev/hda4/misc-o ro
[root@lancy ~]# rm-f/misc/one
RM: Cannot delete '/misc/one ': read-only file system