We can select pre-reading some files during use, which can speed up our work efficiency. However, sometimes encountering some large files will lead to incomplete reading, so how to solve this problem? Today Xiaobian and everyone share the method of setting the file read-ahead size using the blockdev command.
Solution:
command line calling the device's ioctl function. In Linux systems, it seems that the direct operation of the device is only the ioctl function. The parameters he accepts are not too many, and they all correspond one-to-one.
blockdev - Calling block device control programs from the command line
blockdev [options] commands devices
The blockdev tool allows you to call block device control programs from the command line.
–setro Set the device to read-only
–getro Read whether the device is read-only (success is 1,0 is readable and writable)
– Setrw setting is set to read and write
– getss the sector size of the printing device, usually 512
–getsize prints the capacity of the device, according to a sector of 512 bytes Compute
–setra N Set the read-ahead sector (512 bytes) to N. Set readahead to N 512-byte sectors.
–getra Print readahead (read-ahead sector) )
–flushbufs refresh buffer
–rereadpt Reread partition table.
I think & ndash; setro, setrw is more useful, this mount -o ro (rw) is different, mount is mounted on a partition at the file system level is read-only or readable and writable. The blockdev is set to read-only and readable and writable at the level of the setting.
See the output of the following command 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, Mount 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: Unable to delete ‘/misc/one’: read-only filesystem
The above is the method of setting the size of the Linux system read-ahead file using the blockdev command. It is necessary or interesting. Users can try the look on their computer.
In the process of using Linux, we sometimes encounter the exhaustion of swap memory
Some users may have a better understanding of Ubuntu 12.04 via VNC Remote Desktop, but this method o
Jenkins is a continuous integration tool based on Java development. In Ubuntu syste
Opencv is a cross-platform computer vision library that can be used for image proce
Linux installation g77 compiler skills
How to modify the network card DNS in Linux system?
How to solve Ubuntu 12.04 boot error Checking Battery State problem
How to use rsa password-free login in Linux
What should I do if ORA-12528 reports an error when building DataGuard in Linux?
Linux system error Fatal error, run database recovery how to solve
CentOS python version is too low How to manually upgrade?
Windows8 RP version of the crash solution
Solution for Excel file corruption in U disk
Win7 system customizes the width and position of the taskbar according to the idea
How to backup network settings in win7
Win8 background service batch setting skills
How does Win10 clear the icon of the uninstalled program on the taskbar notification area?
Upgrade Win10 update to 99% blue screen constantly restart solution