Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the blockdev command to set the file pre-read size in Linux

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to use the blockdev command to set the file pre-read size in Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Blockdev-call the block device control program from the command line

Blockdev [options] commands devices

The blockdev tool allows you to call block device controllers from the command line.

-setro sets the device to read-only

-whether the getro reading device is read-only (if 1 is successful, it can be read / written)

-setrw is set to read / write

-sector size of the getss printing device, usually 512

-the capacity of the getsize print setting, calculated as 512 bytes in a sector

-setra N sets the read-ahead 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 different, mount is mounted to a partition as read-only or read-write at the file system level. Blockdev is set to read-only and read-write at the setting level.

The output result of the following command is clear at a glance.

The code is as follows:

[root@lancy ~] # blockdev-setro / dev/hda4

[root@lancy ~] # blockdev-getro / dev/hda4

one

[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

On how to use the blockdev command in Linux to set the file pre-read size is shared here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report