<button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">Version 1.16 </button>

- [Latest](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/latest/vm-runtime/manage-power-state)
- [Version 1.16](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/vm-runtime/manage-power-state.md.txt)
- [Earlier versions (unsupported)](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/getting-support.md.txt#version-support)

<br />

This document is intended for application owners that run Google Distributed Cloud.
This document shows you how to manage the power state of virtual machines (VMs)
that use VM Runtime on GDC.

You can stop, start, and restart VMs as needed to support the lifecycle of your
applications. For example, you may want to change the number of assigned vCPUs
or amount of memory. After you edit the configuration of your VM, you must
cycle the power state to apply the changes.

## Before you begin

To complete this document, you need access to the following resources:

- A VM that runs in one of your clusters. If needed, [create a VM in Distributed Cloud](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/vm-runtime/quickstart.md.txt).
- The `virtctl` client tool installed as a plugin for `kubectl`. If needed, [install the virtctl client tool](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/vm-runtime/quickstart.md.txt#install_the_virtctl_client_tool).

## Stop a VM

When you stop a VM, compute resources such as CPU and memory are freed from the
underlying host. The VM is shut down.

To stop a VM that's in a running state, use the following steps.

1. Use `kubectl` to stop a VM:

   ```bash
     kubectl virt stop VM_NAME
   ```

   Replace `VM_NAME` with the name of the VM that you want to
   stop.
2. Check the `STATUS` of your VM:

   ```bash
     kubectl get gvm VM_NAME
   ```

   The following example output shows the VM in a `Stopped` state:

   ```bash
     NAME   STATUS    AGE   IP
     vm1    Stopped   1m    192.168.2.72
   ```

## Start a VM

To start a VM that's in a stopped state, use the following steps.

1. Use `kubectl` to start a VM:

   ```bash
     kubectl virt start VM_NAME
   ```

   Replace `VM_NAME` with the name of the VM that you want
   to start.
2. Check the `STATUS` of your VM:

   ```bash
     kubectl get gvm VM_NAME
   ```

   The following example output shows the VM in a `Running` state:

   ```bash
     NAME   STATUS    AGE   IP
     vm1    Running   1m    192.168.2.72
   ```

## Restart a VM

To restart a VM that's in a running state, use the following steps.

1. Use `kubectl` to restart a VM:

   ```bash
     kubectl virt restart VM_NAME
   ```

   Replace `VM_NAME` with the name of the VM that you want to
   restart.
2. Check the `STATUS` of your VM:

   ```bash
     kubectl get gvm VM_NAME
   ```

   The following example output shows the VM in a `Stopping` state:

   ```bash
     NAME   STATUS    AGE   IP
     vm1    Stopping  7s    192.168.2.72
   ```
3. Check the `STATUS` of your VM again after a minute or two:

   ```bash
     kubectl get gvm VM_NAME
   ```

   After the VM has successfully restarted, the following example output shows
   the VM in a `Running` state again:

   ```bash
     NAME   STATUS    AGE   IP
     vm1    Running   1m    192.168.2.73
   ```

   This example VM uses an ephemeral pod IP address, so the address changes
   when the VM restarts.

## What's next

- [Edit a VM in Distributed Cloud](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/vm-runtime/edit-vm.md.txt).
- When you no longer need VMs, [Delete a VM in Google Distributed Cloud](https://docs.cloud.google.com/anthos/clusters/docs/bare-metal/1.16/vm-runtime/delete.md.txt).