

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Auto-enable I/O 适用于受损的 Amazon EBS 卷
<a name="volumeIO"></a>

当 Amazon EBS 确定某个卷的数据可能不一致时，它会默认禁 I/O 用任何连接的 EC2 实例访问该卷。这将导致卷状态检查故障，并新建一个卷状态事件来指明故障的原因。如果不考虑特定卷的一致性，并且您希望该卷在**受损**时立即可用，则可以通过将该卷配置为自动启用来覆盖默认行为 I/O。如果您启用 **Auto-Enabled IO** 卷属性（`autoEnableIO`在 API 中），则卷和实例 I/O 之间将自动重新启用，并且卷的状态检查将通过。此外，您还会看到一个事件，告知您该卷处于可能不一致的状态，但它 I/O 已自动启用。如果发生此事件，您应该检查该卷的一致性，如有必要，可对其进行更换。有关更多信息，请参阅 [Amazon EBS 卷事件](monitoring-vol-events.md)。

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

**查看卷的 Auto-Enabled IO 属性**

1. 打开位于 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 的 Amazon EC2 控制台。

1. 在导航窗格中，选择 **Volumes**。

1. 选择卷，然后选择 **Status checks**（状态检查）选项卡。

   该**Auto-enabled I/O**字段显示所选音量的当前设置（**启用**或**禁用**）。

**修改卷的 Auto-Enabled IO 属性**

1. 打开位于 [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/) 的 Amazon EC2 控制台。

1. 在导航窗格中，选择 **Volumes**。

1. 选择音量并选择 “**操作**”、“**管理自动启用” I/O**。

1. 要自动 I/O 为受损的音量启用，请选中**Auto-enable I/O 针对受损音量**复选框。想要禁用该功能，请清除复选框。

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}}
```

------