Skip to content

Latest commit

 

History

History
526 lines (371 loc) · 25.9 KB

bare_metal_server_manage.md

File metadata and controls

526 lines (371 loc) · 25.9 KB
copyright lastupdated keywords subcollection
years
2021, 2024
2024-10-10
bare metal servers, managing, operation, manage bare metal server, manage bare metal, manage server, restart bare metal, stop bare metal, delete bare metal, reboot bare metal, restart server, stop server, delete server
vpc

{{site.data.keyword.attribute-definition-list}}

Managing Bare Metal Servers for VPC

{: #managing-bare-metal-servers}

You can manage your {{site.data.keyword.cloud}} Bare Metal Servers for VPC by performing tasks such as start, stop, update firmware, reboot, reinitialize and delete bare metal server. {: shortdesc}

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

Action Description
Stop Stop the server by using a soft stop or a hard stop. \n - 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. \n - 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. \n \n 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. \n \n You can select to either proceed with the firmware update or to cancel. \n 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.
{: caption="Actions available for bare metal servers" caption-side="bottom"}

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

{: #managing-bare-metal-servers-ui} {: ui}

You can view and manage a bare metal server from the Bare metal servers page in the {{site.data.keyword.cloud_notm}} console.

To manage your servers, complete the following steps.

  1. In {{site.data.keyword.cloud_notm}} dashboard{: external}, go to Navigation Menu iconmenu icon > 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

{: #viewing-bare-metal-server-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). {: preview}

  1. In the {{site.data.keyword.cloud_notm}} console{: external}, go to Navigation Menu icon menu icon > 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

{: #update-firmware-bare-metal-servers-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 {{site.data.keyword.cloud_notm}} console{: external}, go to Navigation Menu icon menu icon > 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

{: #reboot-bare-metal-servers-ui}

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

  1. In the {{site.data.keyword.cloud_notm}} dashboard External link icon, go to Navigation Menu icon Menu icon > 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

{: #stop-start-bare-metal-servers-ui}

  1. In the {{site.data.keyword.cloud_notm}} console{: external}, go to Navigation Menu icon menu icon > 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. {: note}

Reinitialize a bare metal server by using the UI

{: #reinitialize-bare-metal-servers-ui} {: 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 {{site.data.keyword.cloud_notm}} console{: external}, go to Navigation Menu icon menu icon > 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

{: #delete-bare-metal-servers-ui}

  1. In the {{site.data.keyword.cloud_notm}} console{: external}, go to Navigation Menu icon menu icon > 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. {: important}

Managing your bare metal server by using the CLI

{: #managing-bare-metal-servers-cli} {: cli}

Viewing your bare metal servers by using the CLI

{: #viewing-bare-metal-servers-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

{: pre}

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

Rebooting a bare metal server by using the CLI

{: #reboot-bare-metal-servers-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

{: pre}

The [-f, --force] flag forces the operation without confirmation. {: tip}

Stopping and starting a bare metal server by using the CLI

{: #stop-start-bare-metal-servers-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. {: important}

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

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

{: pre}

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

ibmcloud is bare-metal-server-start SERVER

{: pre}

Billing continues after the bare metal server stops. {: note}

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

{: #reinitialize-bare-metal-servers-cli} {: 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

{: pre}

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

{: #update-firmware-bare-metal-servers-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

{: pre}

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

{: #delete-bare-metal-servers-cli} {: 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

{: pre}

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

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

Managing your bare metal server by using the API

{: #managing-bare-metal-servers-api} {: api}

Viewing your bare metal servers by using the API

{: #viewing-bare-metal-servers-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"

{: pre}

Retrieve a bare metal server by using the API

{: #retrieve-bare-metal-servers-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"

{: pre}

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

{: #reboot-bare-metal-servers-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"

{: pre}

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

Stopping and starting a bare metal server by using the API

{: #stop-start-bare-metal-servers-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

{: #stop-bm-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. {: important}

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"
}'

{: pre}

Billing continues after the bare metal server is stopped. {: note}

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

Starting the bare metal server by using the API

{: #start-bm-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"

{: pre}

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

Reinitialize a bare metal server by using the API

{: #reinitialize-bare-metal-servers-api} {: 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"

{: pre}

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

{: #update-firmware-bare-metal-servers-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
}'

{: pre}

Deleting a bare metal server by using the API

{: #delete-bare-metal-servers-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"

{: pre}

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

Managing bare metal servers by using Terraform

{: #managing-bare-metal-servers-terraform} {: terraform}

Make sure that you set up Terraform for VPC.

Viewing your bare metal servers by using Terraform

{: #viewing-bare-metal-server-terraform} {: 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"
}

{: pre}

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" {
}

{: pre}

For more information, see ibm_is_bare_metal_servers.

Restarting a bare metal server by using Terraform

{: #reboot-bare-metal-servers-terraform} {: 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"
}

{: pre}

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

{: #stop-start-bare-metal-servers-terraform} {: 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"
}

{: pre}

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

{: pre}

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

{: #reinitialize-bare-metal-servers-terraform} {: 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"
}

{: codeblock}

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

{: codeblock}

Deleting a bare metal server by using Terraform

{: #delete-bare-metal-servers-terraform} {: 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"
}

{: pre}

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.