

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 為受損的 Amazon EBS 磁碟區自動啟用 I/O
<a name="volumeIO"></a>

當 Amazon EBS 判斷磁碟區的資料具有潛在不一致性時，預設會從任何連接的 EC2 執行個體停用對磁碟區的 I/O。這會導致磁碟區狀態檢查未通過，並建立磁碟區狀態事件以指出導致未通過的原因。如果您不關切特定磁碟區的一致性，並傾向在磁碟區**受損**時立即供使用者使用，您可以將磁碟區設為自動啟用 I/O，以覆寫預設行為。如果您啟用 **Auto-Enabled IO** (自動啟用 IO) 磁碟區屬性 (API 中的 `autoEnableIO`)，磁碟區和執行個體之間的 I/O 就會自動重新啟用，並且磁碟區的狀態檢查將通過。除此之外，還會顯示一則事件，通知您磁碟區的狀態具有潛在不一致性，但已自動啟用 I/O。發生此事件時，您應該檢查磁碟區的一致性並視需要將其取代。如需詳細資訊，請參閱[Amazon EBS 磁碟區事件](monitoring-vol-events.md)。

------
#### [ Console ]

**檢視磁碟區的 Auto-Enabled IO (自動啟用 IO) 屬性**

1. 在 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在導覽窗格中，選擇 **Volumes** (磁碟區)。

1. 選取磁碟區，並選取 **Status checks** (狀態檢查) 索引標籤。

   **Auto-enabled IO** (自動啟用 IO) 欄位會顯示所選磁碟區的目前設定 **Enabled** (已啟用) 或 **Disabled** (已停用))。

**修改磁碟區的 Auto-Enabled IO (自動啟用 IO) 屬性**

1. 在 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 開啟 Amazon EC2 主控台。

1. 在導覽窗格中，選擇 **Volumes** (磁碟區)。

1. 選取磁碟區，並選取 **Actions** (動作)、**Manage Auto-enabled I/O** (管理自動啟用 I/O)。

1. 若要對受損磁碟區自動啟用 I/O，請選取 **Auto-enable I/O for impaired volumes** (對受損磁碟區自動啟用 IO) 核取方塊。若要停用這項功能，請清除核取方塊。

1. 選擇**更新**。

------
#### [ AWS CLI ]

**檢視磁碟區的 autoEnableIO 屬性**  
使用 [describe-volume-attribute](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volume-attribute.html) 命令。

```
aws ec2 describe-volume-attribute \
    --attribute autoEnableIO \
    --volume-id {{vol-01234567890abcdef}}
```

以下為範例輸出。

```
{
    "AutoEnableIO": {
        "Value": true
    },
    "VolumeId": "vol-01234567890abcdef"
}
```

**修改磁碟區的 autoEnableIO 屬性**  
使用 [modify-volume-attribute](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-volume-attribute.html) 命令。

```
aws ec2 modify-volume-attribute \
    --auto-enable-io \
    --volume-id {{vol-01234567890abcdef}}
```

------
#### [ PowerShell ]

**檢視磁碟區的 autoEnableIO 屬性**  
使用 [Get-EC2VolumeAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2VolumeAttribute.html) cmdlet。

```
(Get-EC2VolumeAttribute `
    -Attribute autoEnableIO `
    -VolumeId {{vol-01234567890abcdef}}).AutoEnableIO
```

以下為範例輸出。

```
True
```

**修改磁碟區的 autoEnableIO 屬性**  
使用 [Edit-EC2VolumeAttribute](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2VolumeAttribute.html) cmdlet。

```
Edit-EC2VolumeAttribute `
    -AutoEnableIO $true `
    -VolumeId {{vol-01234567890abcdef}}
```

------