此内容没有您所选择的语言版本。

1.14. Changing the Read/Write State of an Online Logical Unit


Certain storage devices provide the user with the ability to change the state of the device from Read/Write (R/W) to Read-Only (RO), and from RO to R/W. This is typically done through a management interface on the storage device. The operating system will not automatically update its view of the state of the device when a change is made. Follow the procedures described in this chapter to make the operating system aware of the change.
Run the following command, replacing XYZ with the desired device designator, to determine the operating system's current view of the R/W state of a device:
# blockdev --getro /dev/sdXYZ
The following command is also available for Red Hat Enterprise Linux 6:
# cat /sys/block/sdXYZ/ro 1 = read-only 0 = read-write
When using multipath, refer to the ro or rw field in the second line of output from the multipath -ll command. For example:
36001438005deb4710000500000640000 dm-8 GZ,GZ500
[size=20G][features=0][hwhandler=0][ro]
\_ round-robin 0 [prio=200][active]
 \_ 6:0:4:1  sdax 67:16  [active][ready]
 \_ 6:0:5:1  sday 67:32  [active][ready]
\_ round-robin 0 [prio=40][enabled]
 \_ 6:0:6:1  sdaz 67:48  [active][ready]
 \_ 6:0:7:1  sdba 67:64  [active][ready]
To change the R/W state, use the following procedure:

Procedure 1.5. Change the R/W state

  1. To move the device from RO to R/W, see step 2.
    To move the device from R/W to RO, ensure no further writes will be issued. Do this by stopping the application, or through the use of an appropriate, application-specific action.
    Ensure that all outstanding write I/Os are complete with the following command:
    # blockdev -flushbufs /dev/device
    Replace device with the desired designator; for a device mapper multipath, this is the entry for your device in dev/mapper. For example, /dev/mapper/mpath3.
  2. Use the management interface of the storage device to change the state of the logical unit from R/W to RO, or from RO to R/W. The procedure for this differs with each array. Consult applicable storage array vendor documentation for more information.
  3. Perform a re-scan of the device to update the operating system's view of the R/W state of the device. If using a device mapper multipath, perform this re-scan for each path to the device before issuing the command telling multipath to reload its device maps.
    This process is explained in further detail in Section 1.14.1, “Rescanning logical units”.

1.14.1. Rescanning logical units

After modifying the online logical unit Read/Write state, as described in Section 1.14, “Changing the Read/Write State of an Online Logical Unit”, re-scan the logical unit to ensure the system detects the updated state with the following command:
# echo 1 > /sys/block/sdX/device/rescan
To re-scan logical units on a system that uses multipathing, execute the above command for each sd device that represents a path for the multipathed logical unit. For example, run the command on sd1, sd2 and all other sd devices. To determine which devices are paths for a multipath unit, use multipath -11, then find the entry that matches the logical unit to be changed.

Example 1.1. Use of the multipath -11 command

For example, the multipath -11 above shows the path for the LUN with WWID 36001438005deb4710000500000640000. In this case, enter:
# echo 1 > /sys/block/sdax/device/rescan
# echo 1 > /sys/block/sday/device/rescan
# echo 1 > /sys/block/sdaz/device/rescan
# echo 1 > /sys/block/sdba/device/rescan
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.