IBM Cloud Docs
Managing Bare Metal Servers for VPC

Managing Bare Metal Servers for VPC

You can manage your IBM Cloud® Bare Metal Servers for VPC by performing tasks such as start, stop, update firmware, reboot, reinitialize and delete bare metal server.

You can perform the following actions by using the UI, CLI, and API.

Table 1. Actions available for bare metal servers
Action Description
Stop

Stop the server by using a soft stop or a hard stop.

  • Soft stop can take a few seconds to several minutes to shut down the server, depending on the state of the operating system. If the operating system is not responding and the soft stop can’t complete, a hard stop is required.
  • Hard stop shuts down the bare metal server immediately. This method prevents the operating system from shutting down gracefully.
Start Start a stopped server. This action is not available if the status is Running.
Update firmware If the server is stopped and a firmware update is available, this option is visible.

If you select to update the firmware, a prompt is displayed giving you extra details about the firmware update. You can start the server when the update completes. This option is selected by default.

You can select to either proceed with the firmware update or to cancel.
Important It is recommended to back up your server before any firmware update.

Reboot Immediately powers off a running server and then powers it back on.
Reinitialize You can reinitialize the server only if the server is stopped. Or, you can reinitialize if the server status is failed and the lifecycle state has a status reason of cannot_reinitialize. When the bare metal server is reinitialized, the contents of the boot disk are wiped and the specified operating system is installed. The server retains the same physical node, interfaces, IP addresses, and resource IDs. Data on secondary drives is preserved.
Delete To delete a server, the server must be powered off. If the server has a floating IP address, the floating IP address must be unassociated or released before the server is deleted. The delete action permanently removes a server and its connected vNIC, boot volume, and data from your account.

To manage your bare metal servers, you need an IAM role that includes the following actions. For more information, see Managing IAM access for VPC Infrastructure Services.

  • is.bare-metal-server.bare-metal-server.list
  • is.bare-metal-server.bare-metal-server.read
  • is.bare-metal-server.bare-metal-server.delete
  • is.bare-metal-server.bare-metal-server.update
  • is.bare-metal-server.bare-metal-server.operate
  • is.key.key.operate
  • is.image.image.operate
  • is.bare-metal-server.bare-metal-server-firmware.update (required to update firmware)
  • is.bare-metal-server.initialization.update (required to reinitialize server)

Managing bare metal servers by using the UI

You can view and manage a bare metal server from the Bare metal servers page in the IBM Cloud console.

To manage your servers, complete the following steps.

  1. In IBM Cloud dashboard, go to Navigation Menu iconmenu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers.
  2. On the Bare metal servers page, click the Actions icon More Actions icon for the server that you want to manage. You can perform the following actions:

Viewing your bare metal servers by using the UI

You can view the summary of all bare metal server on the bare metal server page, or you can click an individual server name to view details and make changes. From the details page, you can also view the associated network interface, access its subnet, change the network bandwidth on Sapphire Rapids servers, and reserve or delete a floating IP address.

Adjustable network bandwidth for Sapphire Rapids bare metal servers is only available in US South (Dallas).

  1. In the IBM Cloud console, go to Navigation Menu icon menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers
  2. Click the name of the bare metal server that you want to view.

Updating the firmware for a bare metal server by using the UI

This action is only displayed if the server is stopped and a firmware update is available. It is recommended to back up your server before any firmware update.

  1. In the IBM Cloud console, go to Navigation Menu icon menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers

  2. Click the name of the bare metal server that you want to reboot.

  3. Click Actions..., then click Update firmware.

    You receive the following message when you select to update the firmware.

    This option updates BIOS and BMC firmware on your server. Backup your server before proceeding. The server is stopped and unavailable during the process.

    Start server after the update completes is selected by default. Remove the check if you don't want the server to restart.

  4. Click Proceed to start the firmware update. Click Cancel to cancel the update.

Rebooting a bare metal server by using the UI

The reboot action immediately powers off and powers on the bare metal server.

  1. In the IBM Cloud dashboard External link icon, go to Navigation Menu icon Menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers
  2. Click the name of the bare metal server that you want to reboot.
  3. Click Actions..., then click Reboot.

Stopping and starting a bare metal server by using the UI

  1. In the IBM Cloud console, go to Navigation Menu icon menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers
  2. Click the name of the bare metal server that you want to start or stop.
  3. Click Actions..., then click Stop or Start. When you select Stop, select hard stop or soft stop. The instance soft-stops by default.

Billing continues after the bare metal server is stopped.

Reinitialize a bare metal server by using the UI

You can reinitialize the server only if the server is stopped and provisioned with local storage. Or, you can reinitialize if the server status is failed and the lifecycle state has a status reason of cannot_reinitialize. When the bare metal server is reinitialized, the contents of the boot disk are wiped and the specified operating system is installed. The server retains the same physical node, interfaces, IP addresses, and resource IDs. Data on secondary drives is preserved.

  1. In the IBM Cloud console, go to Navigation Menu icon menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers

  2. Click the name of the bare metal server that you want to reinitialize.

  3. Click Actions..., then click Reinitialize.

Deleting a bare metal server by using the UI

  1. In the IBM Cloud console, go to Navigation Menu icon menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers
  2. Click the name of the bare metal server that you want to delete.
  3. Click Actions..., then click Delete.

The delete action permanently removes a server and its connected vNIC, boot volume, and data from your account.

Managing your bare metal server by using the CLI

Viewing your bare metal servers by using the CLI

To list all the bare metal servers by using the CLI, use the ibmcloud is bare-metal-servers command. To retrieve a specific bare metal server, specify the ID or name of the bare metal server with the SERVER variable.

ibmcloud is bare-metal-server SERVER

For a full list of command options, see ibmcloud is bare-metal-server.

Rebooting a bare metal server by using the CLI

To reboot your bare metal server by using the CLI, use the ibmcloud is bare-metal-server-restart command. Specify the ID or name of the bare metal server with the SERVER variable.

ibmcloud is bare-metal-server-restart SERVER

The [-f, --force] flag forces the operation without confirmation.

Stopping and starting a bare metal server by using the CLI

To stop and start your bare metal server by using the CLI, use the ibmcloud is bare-metal-server-stop or ibmcloud is bare-metal-server-start command. Specify the ID or name of the bare metal server with the SERVER variable.

You must specify the type for the stop action in the data payload. soft tells the running operating system to stop and shut down cleanly. hard immediately stops the bare metal server.

To stop the bare metal server, use the following command.

ibmcloud is bare-metal-server-stop SERVER --type soft

To start the bare metal server, use the following command.

ibmcloud is bare-metal-server-start SERVER

Billing continues after the bare metal server stops.

For a full list of command options, see [ibmcloud is bare-metal-server-restart](/docs/vpc?topic=vpc-vpc-reference#bare-metal-server-restart

Reinitialize a bare metal server by using the CLI

You can reinitialize the server only if the server is stopped and provisioned with local storage. Or, you can reinitialize if the server status is failed and the lifecycle state has a status reason of cannot_reinitialize. When the bare metal server is reinitialized, the contents of the boot disk are wiped and the specified operating system is installed. The server retains the same physical node, interfaces, IP addresses, and resource IDs. Data on secondary drives is preserved.

To reinitialize a bare metal server by using the CLI, use the ibmcloud is bare-metal-server-initialization-replace command.

ibmcloud is bare-metal-server-initialization-replace SERVER --image IMAGE ---keys KEYS --user-data DATA

Specify the following variables to use when you reinitialize the bare metal server.

  • SERVER specifies the name of the bare metal server
  • IMAGE specifies the operating system image
  • KEYS specifies the SSH keys
  • DATA specifies any optional user data

For a full list of command options, see ibmcloud is bare-metal-server-initialization-replace.

Updating the firmware for a bare metal server by using the CLI

You can update the firmware for your bare metal servers by using the command-line interface (CLI). You can update the firmware on only a bare metal server that is stopped and has firmware updates available. It is recommended to back up your server before any firmware update.

To update the firmware for the bare metal server by using the CLI, use the ibmcloud is bare-metal-server-firmware-update command. Specify the ID or name of the bare metal server with theSERVER variable.

The default value for auto-start is true. If you don't want the bare metal server to start after the firmware is updated, you must change this value to false.

ibmcloud is bare-metal-server-firmware-update SERVER --auto-start true

After you issue this command, you receive a message to verify whether to proceed with the firmware update.

This option upgrades the BIOS and BMC firmware on your server. Back up your server before you proceed. The server is unavailable during the process. Proceed (y/n)?

For a full list of command options, see ibmcloud is bare-metal-server-firmware-update.

Deleting a bare metal server by using the CLI

To delete your bare metal server by using the CLI, use the ibmcloud is bare-metal-server-delete command. Specify the ID or name of the bare metal server with theSERVER variable.

ibmcloud is bare-metal-server-delete SERVER

The delete action permanently removes a server and its connected vNIC, boot volume, and data from your account.

For a full list of command options, see ibmcloud is bare-metal-server-delete.

Managing your bare metal server by using the API

Viewing your bare metal servers by using the API

To list all bare metal servers by using the API, use List all bare metal servers.

Specify a GET /bare_metal_servers request to list all the bare metal servers.

curl -X GET "$vpc_api_endpoint/v1/bare_metal_servers?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

Retrieve a bare metal server by using the API

To retrieve a bare metal server by using the API, use Retrieve a bare metal server.

Specify a GET /bare_metal_servers/{id} request retrieve a specific bare metal server where id is the identifer of the bare metal server you are retrieving.

curl -X GET "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

For more information of the API requests, see List all bare metal servers and Retrieve a bare metal server.

Rebooting the bare metal server by using the API

To reboot a bare metal server by using the API, use Restart a bare metal server.

Specify a POST /bare_metal_servers/{id}/restart request to restart a specific bare metal server where id is the identifer of the bare metal server you are restarting.

curl -X POST "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id/restart?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

For more information of the API request, see Restart a bare metal server.

Stopping and starting a bare metal server by using the API

To stop or start a bare metal server by using the API, use Stop a bare metal server and Start a bare metal server.

Use the following API requests to stop or start a bare metal server.

Stopping the bare metal server by using the API

Specify a POST /bare_metal_servers/{id}/stop request to stop a specific bare metal server where id is the identifer of the bare metal server you are stopping.

You must specify the type for the stop action in the data payload. soft tells the running operating system to stop and shut down cleanly. hard immediately stops the bare metal server.

curl -X POST "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id/stop?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"
-d '{
        "type": "soft"
}'

Billing continues after the bare metal server is stopped.

For more information about the API request, see Stop a bare metal server.

Starting the bare metal server by using the API

Specify a POST /bare_metal_servers/{id}/start request to start a specific bare metal server where id is the identifer of the bare metal server you are starting.

curl -X POST "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id/start?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

For more information about the API request, see Start a bare metal server.

Reinitialize a bare metal server by using the API

To reinitialize your bare metal server by using the API, use Bare metal servers initialization.

You can reinitialize the server only if the server is stopped and provisioned with local storage. Or, you can reinitialize if the server status is failed and the lifecycle state has a status reason of cannot_reinitialize. When the bare metal server is reinitialized, the contents of the boot disk are wiped and the specified operating system is installed. The server retains the same physical node, interfaces, IP addresses, and resource IDs. Data on secondary drives is preserved.

Specify a PUT /bare_metal_servers/{id}/initialization request to reinitialize the bare metal server.

curl -X PUT "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id/initialization?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

Specify the following properties values to use when you reinitialize the bare metal server.

  • name specifies the name of the bare metal server
  • image specifies the operating system image
  • keys specifies the SSH keys
  • user_data specifies any optional user data

Updating the firmware for a bare metal server by using the API

You can update the firmware on only a bare metal server that is stopped and has firmware updates available. It is recommended that you back up your server before you update the firmware. To update the firmware by using the API, use Update firmware for a bare metal server.

Specify a POST /bare_metal_servers/{id}/firmware/update request to update the firmware for a specific bare metal server where id is the identifer of the bare metal server that you are updating.

The default value for auto_start is true. If you don't want the bare metal server to start after the firmware update, you must change this value to false.

curl -X POST "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id/firmware/update?version=$tomorrow&generation=2&maturity=development" -H "Authorization: Bearer $iam_token" -d '{
  "auto_start": false
}'

Deleting a bare metal server by using the API

To delete a bare metal server by using the API, use Delete a bare metal server.

Specify a DELETE /bare_metal_servers/{id} request delete a specific bare metal server where id is the identifer of the bare metal server you are deleting.

curl -X DELETE "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

The delete action permanently removes a server and its connected vNIC, boot volume, and data from your account.

Managing bare metal servers by using Terraform

Make sure that you set up Terraform for VPC.

Viewing your bare metal servers by using Terraform

To view a bare metal server by using the Terraform, use the ibm_is_bare_metal_server resource.

data "ibm_is_bare_metal_server" "example" {
  identifier        = "9328-9849-9849-9849"
}

For more information, see ibm_is_bare_metal_server.

To view a list of all the bare metal servers, use the ibm_is_bare_metal_servers resource.

data "ibm_is_bare_metal_servers" "example" {
}

For more information, see ibm_is_bare_metal_servers.

Restarting a bare metal server by using Terraform

To restart a bare metal server by using the Terraform, you need to use the ibm_is_bare_metal_server_action resource.

resource "ibm_is_bare_metal_server_action" "bms_action" {
  bare_metal_server = SERVER
  action            = "restart"
}

Specify the following variables to use when you reinitialize the bare metal server.

  • SERVER specifies the name of the bare metal server
  • restart specifies the action for the server

For a full list of command options, see ibm_is_bare_metal_server_action.

Stopping and starting a bare metal server by using Terraform

To stop a bare metal server by using the Terraform, you need to use the ibm_is_bare_metal_server_action resource.

resource "ibm_is_bare_metal_server_action" "bms_action" {
  bare_metal_server = SERVER
  action            = "stop"
  stop_type         = "hard"
}

To start a bare metal server by using the Terraform, you need to use the ibm_is_bare_metal_server_action resource.

resource "ibm_is_bare_metal_server_action" "bms_action" {
  bare_metal_server = SERVER
  action            = "stop"
  delete_type       = "hard"
}

Specify the following variables to use when you reinitialize the bare metal server.

  • SERVER specifies the name of the bare metal server
  • stop or start specifies the action for the server
  • hard is specific to stopping the server and indicates the type of stop. Specifying hard immediately stops the server and soft shuts down the operating system.

For a full list of command options, see ibm_is_bare_metal_server_action.

Reinitializing a bare metal server by using Terraform

You can reinitialize the server only if the server is stopped and provisioned with local storage. Or, you can reinitialize if the server status is failed and the lifecycle state has a status reason of cannot_reinitialize. When the bare metal server is reinitialized, the contents of the boot disk are wiped and the specified operating system is installed. The server retains the same physical node, interfaces, IP addresses, and resource IDs. Data on secondary drives is preserved.

To reinitialize a bare metal server by using the Terraform, you need to use the resource command ibm_is_bare_metal_server_initialization.

resource "ibm_is_bare_metal_server_initialization" "reinitialize" {
  bare_metal_server = SERVER
  user_data         = DATA
  keys              = KEYS
  image             = "IMAGE"
}

Specify the following variables to use when you reinitialize the bare metal server.

  • SERVER specifies the name of the bare metal server
  • DATA specifies any optional user data
  • KEYS specifies the SSH keys
  • IMAGE specifies the operating system image

While you can retain the same physical node, interfaces, IP addresses, and resource IDs, you can also select to avoid these changes by using the lifecycle property.

For a full list of command options, see ibm_is_bare_metal_server_initialization.

resource "ibm_is_bare_metal_server_initialization" "reinitialize" {
  bare_metal_server = SERVER
  user_data         = DATA
  keys              = KEYS
  image             = "IMAGE"
}
## to avoid changes on the ibm_is_bare_metal_server resource, use lifecycle meta argument ignore_changes
resource "ibm_is_bare_metal_server" "bms" {
  ....
  lifecycle{
    ignore_changes = [ image, keys, user_data ]
  }
}

Deleting a bare metal server by using Terraform

To delete a bare metal server resource by using Terraform, you need to use the ibm_is_bare_metal_server resource.

resource "ibm_is_bare_metal" "server" {
  delete_type          = "hard"
}

Specify the following variables to use when you delete the bare metal server.

  • hard specifies a hard delete that immediately stops and deletes the server. The other option is soft delete which shutdowns the operating system.

For a full list of command options, see ibm_is_bare_metal_server.