• Bare Metal Server

bms
  1. Help Center
  2. Bare Metal Server
  3. Developer Guide
  4. Detaching an EVS Disk from a BMS

Detaching an EVS Disk from a BMS

Scenario

A disk attached to a BMS can be detached.

  • Disks mounted to /dev/sda function as system disks. You can only detach system disks offline. Before detaching a system disk from a BMS, you must stop the BMS.
  • The disk attached at non-/dev/sda functions as a data disk, which can be detached both offline and online. Specifically, you can detach a data disk from a running BMS.

Restrictions and Limitations

If a BMS is stopped, disks can be detached from it without any limitation on the OS. If a BMS is in running state, the constraints are as follows:

  • Before detaching an EVS disk from a Linux BMS, log in to the BMS, run the unmount command to disassociate the disk to be detached from the file system, and ensure that no program is reading data from or writing data to the disk. Otherwise, the disk will fail to be detached.
  • Before detaching an EVS disk from a running Windows BMS, ensure that no program is reading data from or writing data to the disk. Otherwise, data will be lost.

Involved APIs

The following APIs are required:

  • Querying EVS disks attached to a BMS
  • Detaching an EVS disk from a BMS

Procedure

  1. Query EVS disks attached to a BMS.
    • API information

      URI format: GET /v2/{project_id}/servers/{server_id}/os-volume_attachments

      For details, see section "Querying Information About the Disks Attached to a BMS (Native OpenStack API)" in the Bare Metal Server API Reference.

    • Example request

      GET /v2/000efdc5f9064584b718b181df137bd7servers/9ab74d89-61e7-4259-8546-465fdebe4944/os-volume_attachments

    • Example response
      {
          "volumeAttachment": {
              "device": "/dev/vdb",
              "serverId": "820abbd0-2d8e-4bc5-ae46-69cacfd4fbaa",
              "id": "b53f23bd-ee8f-49ec-9420-d1acfeaf91d6",
              "volumeId": "b53f23bd-ee8f-49ec-9420-d1acfeaf91d6"
          }
      }
  2. Detach an EVS disk from a BMS.
    • API information

      URI format: DELETE /v2.1/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

      For details, see section "Detaching an EVS Disk from a BMS (Native OpenStack API)" in the Bare Metal Server API Reference.

    • Example request

      DELETE /v2.1/000efdc5f9064584b718b181df137bd7/servers/5850a7e7-88dd-4d99-8439-347de8cc0dd7/os-volume_attachments/50ef9435-ca68-4b9b-a837-73377b9fdaa3

    • Example response

      None