Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Compute Cloud
    • All guides
      • Stopping and starting a VM
      • Resetting a Windows Server VM user password
      • Attaching a disk to a VM
      • Detaching a disk from a VM
      • Moving a VM to a different availability zone
      • Moving a VM to a different folder
      • Moving a VM to a different cloud
      • Adding another network interface to a VM
      • Deleting a network interface from a VM
      • Assigning a public IP address to a VM
      • Unassigning a public IP address from a VM
      • Making a VM public IP address static
      • Reassigning a public IP address from one VM to another
      • Updating the VM internal IP address
      • Updating a VM
      • Changing VM computing resources
      • Changing VM security groups
      • VM maintenance policy management
      • Configuring VM access permissions
      • Linking a service account to a VM
      • Deleting a VM
    • Viewing operations with resources
  • Yandex Container Solution
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Managing a VM
  3. Detaching a disk from a VM

Detaching a disk from a VM

Written by
Yandex Cloud
Updated at May 5, 2025

You can detach a disk from either a running or a stopped VM.

Note

You cannot detach a boot disk from a VM. You cannot detach a local disk from a VM running on a dedicated host.

To successfully detach a disk from a running VM, the operating system must be ready to handle detach disk commands. Before detaching a disk, make sure the OS is booted up or stop the VM; otherwise the operation will fail. If an error occurs, stop the VM and try again.

To detach a disk from a VM:

Management console
CLI
API
  1. In the management console, select the folder this VM belongs to.
  2. Select Compute Cloud.
  3. In the left-hand panel, select Disks.
  4. Next to the disk in question, click and select Detach.
  5. Click Detach.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for detaching disks:

    yc compute instance detach-disk --help
    
  2. Get a list of VMs in the default folder:

    yc compute instance list
    

    Result:

    +----------------------+-----------------+---------------+---------+----------------------+
    |          ID          |       NAME      |    ZONE ID    | STATUS  |     DESCRIPTION      |
    +----------------------+-----------------+---------------+---------+----------------------+
    | fhm0b28lgfp4******** | first-instance  | ru-central1-a | RUNNING | my first vm via CLI  |
    | fhm9gk85nj7g******** | second-instance | ru-central1-a | RUNNING | my second vm via CLI |
    +----------------------+-----------------+---------------+---------+----------------------+
    
  3. Select the ID or NAME of the VM, e.g., first-instance.

  4. Get a list of disks attached to the VM:

    yc compute instance get --full first-instance
    
  5. Select disk_id of the disk, e.g., fhm4aq4hvq5g********.

  6. Detach the disk:

    yc compute instance detach-disk first-instance \
      --disk-id fhm4aq4hvq5g********
    

    If an error occurs, stop the VM:

    yc compute instance stop first-instance
    

    Then, try to detach the disk once again.

  7. If the VM was stopped, restart it:

    yc compute instance start first-instance
    

Use the detachDisk REST API method for the Instance resource or the InstanceService/DetachDisk gRPC API call.

Was the article helpful?

Previous
Attaching a disk to a VM
Next
Moving a VM to a different availability zone
© 2025 Direct Cursus Technology L.L.C.