Skip to main content
If a virtual machine (VM) does not start or you cannot connect to it, you can attach its boot disk to another VM as a secondary disk and inspect the boot disk from there. To do this:
  1. Create a VM for debugging in the same project as the boot disk you want to inspect. Set up the SSH connection to your new VM.
  2. Stop the original VM that you want to inspect. Otherwise, you can’t attach its boot disk to another VM.
  3. Get the ID of the original VM’s boot disk:
    nebius compute instance get --id <original_VM_ID> \
      --format jsonpath='.spec.boot_disk.existing_disk.id'
    
  4. Attach the boot disk to the debug VM as a secondary disk:
    nebius compute instance update <debug_VM_ID> \
      --patch \
      --secondary-disks '[{"existing_disk": {"id": "<boot_disk_ID>"}, "attach_mode": "READ_WRITE", "device_id": "original-boot-disk"}]'
    
  5. Connect to the debug VM by using SSH.
  6. List the partitions and filesystems on the boot disk:
    lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS /dev/disk/by-id/virtio-original-boot-disk
    
  7. Mount the filesystem you need to inspect. The root filesystem is on the largest ext4 (or xfs) partition — usually -part1. To mount it:
    sudo mkdir -p /mnt/original-boot-disk
    sudo mount -o ro /dev/disk/by-id/virtio-original-boot-disk-part1 /mnt/original-boot-disk
    
    For safety, use the -o ro parameter to mount the filesystem in read-only mode. This prevents any accidental changes to the boot disk you are inspecting.
  8. (Optional) If you need to repair the filesystem by writing to it, remount it in read-write mode:
    sudo mount -o remount,rw /mnt/original-boot-disk
    
  9. When done inspecting, unmount the filesystem:
    sudo umount /mnt/original-boot-disk
    
  10. Detach the boot disk of the original VM from the debug VM.
  11. After the disk is detached, start the original VM. You can’t start the VM if its boot disk is attached to another running VM.

See also