このコンテンツは選択した言語では利用できません。

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# blockdev --getro /dev/sdXYZ
Copy to Clipboard Toggle word wrap
The following command is also available for Red Hat Enterprise Linux 6:
# cat /sys/block/sdXYZ/ro 1 = read-only 0 = read-write# cat /sys/block/sdXYZ/ro 1 = read-only 0 = read-write# cat /sys/block/sdXYZ/ro 1 = read-only 0 = read-write
Copy to Clipboard Toggle word wrap
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]
Copy to Clipboard Toggle word wrap
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# blockdev -flushbufs /dev/device
    Copy to Clipboard Toggle word wrap
    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# echo 1 > /sys/block/sdX/device/rescan# echo 1 > /sys/block/sdX/device/rescan
Copy to Clipboard Toggle word wrap
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/sdax/device/rescan# echo 1 > /sys/block/sdax/device/rescan
# echo 1 > /sys/block/sday/device/rescan# echo 1 > /sys/block/sday/device/rescan# echo 1 > /sys/block/sday/device/rescan
# echo 1 > /sys/block/sdaz/device/rescan# echo 1 > /sys/block/sdaz/device/rescan# echo 1 > /sys/block/sdaz/device/rescan
# echo 1 > /sys/block/sdba/device/rescan# echo 1 > /sys/block/sdba/device/rescan# echo 1 > /sys/block/sdba/device/rescan
Copy to Clipboard Toggle word wrap
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat