IBM Cloud Docs
Unmap volume from a host

Unmap volume from a host

Unmap one or more volumes from host by using the UI, CLI, API or Terraform.

Unmap volume from a host from the UI

To remove all mapping of a volume that is mapped to a host, complete the following steps.

  1. Log in to the IBM Cloud console External link icon and Click Deployments > deployment Name link and then go to Block storage > Hosts.

  2. Click the Host Name from which you want to unmap the volume.

  3. On the Host details page, in the Mapped volumes list, locate the volume Name and click the kebab menu at the end of the row.

  4. Click Unmap. A confirmation popup is displayed.

  5. Click Unmap to confirm the unmapping of the selected volume from the host.

You can also unmap the host from a volume from Volume details page.

Unmap a single volume for a host from the CLI

Use the host-mapping-delete command and specify the HOST-ID, the Volume-Mapping-ID, and the endpoint url and the volume ID that is associated with the host to unmap it.

The Volume-Mapping-ID can be found in the output of a get host or a get volume command

Run the following command to delete a single volume mapping from a host.

ibmcloud software-defined-storage host-mapping-delete --host-id HOST-ID --volume-mapping-id VOLUME-MAPPING-ID

See the following example.

ibmcloud software-defined-storage host-mapping-delete \
  --host-id r134-69d5c3e2-8229-45f1-89c8-e4dXXb2e126e \
  --volume-mapping-id r134-f24710c4-d5f4-4881-ab78-7bfXX6281f39 \
  --url $sds_endpoint

The $sds_endpoint is an environment variable that points to the endpoint provided to you when IBM CephaaS was configured. It is in the URL form. For example, https://sds-cephaas.<cephaas-instance-id>.software-defined-storage.appdomain.cloud:{port number}/v1. You can set the URL once and then not have to add it for every command. For guidance on how to set the URL, see Config commands.

You can also use the alias sds as an alternative to software-defined-storage and hstmd as an alternative to host-mapping-delete for the CLI actions.

Unmap all volumes for a host from the CLI

Use the host-mapping-delete-all command and specify the HOST-ID along with the endpoint url to unmap all volumes that are associated with the host.

Run the following command to delete all volume mappings from a host.

ibmcloud software-defined-storage host-mapping-delete-all --host-id HOST-ID

See the following example.

ibmcloud software-defined-storage host-mapping-delete-all \
  --host-id r134-69d5c3e2-8229-45f1-89c8-e4dXXb2e126e \
  --url $sds_endpoint

The $sds_endpoint is an environment variable that points to the endpoint provided to you when IBM CephaaS was configured. It is in the URL form. For example, https://sds-cephaas.<cephaas-instance-id>.software-defined-storage.appdomain.cloud:{port number}/v1. You can set the URL once and then not have to add it for every command. For guidance on how to set the URL, see Config commands.

You can also use the alias sds as an alternative to software-defined-storage and hstmda as an alternative to host-mapping-delete-all for the CLI actions.

Unmap a volume for a host with the API

Make a DELETE /hosts/{id}/volumes/{vol_id} request to delete a specific volume that is mapped to a host.

curl -X DELETE $sds_endpoint/hosts/r134-0dcd5d2d-07db-4457-ab0b-1fc3eef28c66/volume_mappings/r134-152a73a9-dee8-4475-ad7c-fe73494140dd \
 -H "Authorization: $IAM_TOKEN" \
 -H 'IBM-API-Version: 2025-02-01'

The $sds_endpoint is an environment variable that points to the endpoint provided to you when IBM CephaaS was configured. It is in the URL form. For example, https://sds-cephaas.<cephaas-instance-id>.software-defined-storage.appdomain.cloud:{port number}/v1. You can set the URL once and then not have to add it for every command. For guidance on how to set the URL, see Config commands.

The command unmaps a volume from a host. There is no response that is returned if the request is successful.

To verify that the volume mapping for a host is deleted, list the host details by making a GET /hosts/{id} request.

Unmap all volumes for a host with the API

Make a DELETE /hosts/{id}/volumes request to delete all volumes that are mapped for a host.

curl -X DELETE '$sds_endpoint/hosts/r134-0dcd5d2d-07db-4457-ab0b-1fc3eef28c66/volume_mappings' \
 -H "Authorization: $IAM_TOKEN" \
 -H 'IBM-API-Version: 2025-02-01'

The $sds_endpoint is an environment variable that points to the endpoint provided to you when IBM CephaaS was configured. It is in the URL form. For example, https://sds-cephaas.<cephaas-instance-id>.software-defined-storage.appdomain.cloud:{port number}/v1. You can set the URL once and then not have to add it for every command. For guidance on how to set the URL, see Config commands.

The command unmaps all volumes from a host. There is no response that is returned if the request is successful.

To verify that all volumes mappings for a host are deleted, list the hosts by making a GET /hosts/{id} request.

Unmapping a volume for a host using Terraform

To unmap a volume from a host, do the following steps:

  1. Open your main.tf file and comment out/remove the ibm_sds_volume_mapping resource.

  2. After editing and saving the file, run commands terraform plan and terraform apply to apply your changes.