Limpia las etiquetas después de restablecer los discos conectados a la VM
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, se explica cómo evitar la posible pérdida de datos o las fallas en la restauración cuando trabajas con discos que se restauraron a partir de copias de seguridad de discos conectados a máquinas virtuales (VMs).
Restablecer un disco individual que se adjuntó a una VM puede dejar etiquetas específicas en el recurso de disco restablecido y en su recurso PersistentVolumeClaim (PVC) subyacente. Si no quitas las etiquetas como se describe, puede ocurrir lo siguiente:
Errores durante las operaciones de restablecimiento completas posteriores de la VM
Modificación o reemplazo no intencional del PVC subyacente del disco restablecido durante un restablecimiento completo posterior de la VM, lo que podría provocar la pérdida de datos en el disco restablecido
Antes de comenzar
Para limpiar las etiquetas después de restablecer un disco conectado a una VM, debes tener lo siguiente:
El rol de identidad y acceso necesario. Pídele al administrador de IAM de tu organización que te otorgue el rol de depurador de DBS (dbs-debugger).
Acceso a los archivos kubeconfig adecuados para los clústeres que administran estos recursos
La herramienta de línea de comandos de kubectl instalada y configurada
Cómo limpiar etiquetas
Debes realizar la limpieza tanto para el recurso VirtualMachineDisk como para su recurso PersistentVolumeClaim (PVC) subyacente.
Limpia las etiquetas de los discos de VM
Para limpiar las etiquetas de un disco de VM restablecido, sigue estos pasos:
Obtén el archivo kubeconfig para el servidor de la API de administración y configura la variable de entorno KUBECONFIG:
RESTORED_VM_DISK_NAME: Es el nombre completo del disco restablecido con los valores recopilados en los requisitos previos. El valor de esta variable se puede derivar de RESTORED_PREFIX-VM_DISK_NAME.
Quita la etiqueta de alcance de la copia de seguridad del recurso VirtualMachineDisk. El guion final después de la clave de la etiqueta indica la eliminación:
Reemplaza VM_NAME por el nombre de la VM restaurada.
Opcional: Para verificar que la etiqueta bpvms/VM_NAME ya no esté presente, puedes volver a ejecutar el comando kubectl get correspondiente y ajustarlo para el tipo de recurso y el clúster específicos:
Reemplaza VM_NAME por el nombre de la VM restaurada.
Opcional: Para verificar que la etiqueta bpvms/VM_NAME ya no esté presente, puedes volver a ejecutar el comando kubectl get correspondiente y ajustarlo para el tipo de recurso y el clúster específicos:
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[],[],null,["# Clean up labels after restoring VM-attached disks\n\nThis page guides you through how to prevent potential data loss or restore\nfailures when working with disks that were restored from backups of disks\nattached to virtual machines (VMs).\n\nRestoring an individual disk that was attached to a VM can leave behind specific\nlabels on the restored disk resource and its underlying `PersistentVolumeClaim`\n(PVC) resource. Failure to remove the labels as described can lead to:\n\n- Failures during subsequent full VM restore operations.\n- Unintended modification or replacement of the restored disk's underlying PVC during a subsequent full VM restore, potentially leading to data loss on the restored disk.\n\n| **Important:** These steps are mandatory immediately after you restore an individual disk if that disk was originally attached to a VM, especially if you intend to perform full VM backups and restores involving the original VM at a later time.\n\nBefore you begin\n----------------\n\nTo clean up the labels after restoring a VM-attached disk, you must have the following:\n\n- The necessary identity and access role. Ask your Organization IAM Admin to grant you the DBS Debugger (`dbs-debugger`) role.\n- Access to the appropriate kubeconfig files for the clusters managing these resources.\n- The kubectl command-line tool installed and configured.\n\nClean up labels\n---------------\n\nYou must perform the cleanup for both the `VirtualMachineDisk` resource and its underlying `PersistentVolumeClaim` (PVC) resource.\n\n### Clean up the VM disk labels\n\nTo clean up the labels of a restored VM disk, follow these steps:\n\n1. Get the kubeconfig file for the management API server and set the\n `KUBECONFIG` environment variable:\n\n export KUBECONFIG=\u003cvar translate=\"no\"\u003ePATH_TO_MANAGEMENT_API_KUBECONFIG\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePATH_TO_MANAGEMENT_API_KUBECONFIG\u003c/var\u003e with the\n path to the kubeconfig file. For more information, see [Zonal Management API\n server\n resources](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/iam/sign-in#zonal-resources-kubeconfig).\n2. Check that the restored `VirtualMachineDisk` resource exists in the specified namespace:\n\n kubectl get virtualmachinedisks.virtualmachine.gdc.goog \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \u003cvar translate=\"no\"\u003eRESTORED_VM_DISK_NAME\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n - \u003cvar translate=\"no\"\u003eRESTORED_VM_DISK_NAME\u003c/var\u003e: the full name of the restored disk using the values gathered in the prerequisites. The value for this variable can be derived from \u003cvar translate=\"no\"\u003eRESTORED_PREFIX\u003c/var\u003e-\u003cvar translate=\"no\"\u003eVM_DISK_NAME\u003c/var\u003e.\n3. Remove the backup scope label from the `VirtualMachineDisk` resource. The trailing hyphen after the label key signifies removal:\n\n kubectl label virtualmachinedisks.virtualmachine.gdc.goog -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n \u003cvar translate=\"no\"\u003eRESTORED_VM_DISK_NAME\u003c/var\u003e bpvms/\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e-\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the restored VM.\n4. Optional: To verify that the `bpvms/`\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e label is no longer present, you can re-run the corresponding `kubectl get` command, adjusting for the specific resource type and cluster:\n\n kubectl get virtualmachinedisks.virtualmachine.gdc.goog \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\n### Clean up the PVC labels\n\nTo clean up the labels of the underlying PVC, follow these steps:\n\n1. Get the kubeconfig file for the org infrastructure cluster and set the `KUBECONFIG` environment variable:\n\n export KUBECONFIG=\u003cvar translate=\"no\"\u003ePATH_TO_ORG_INFRA_KUBECONFIG\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePATH_TO_ORG_INFRA_KUBECONFIG\u003c/var\u003e with the path\n to the kubeconfig file.\n2. Check that the underlying PVC for the restored disk exists in the specified namespace:\n\n kubectl get pvc -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n \u003cvar translate=\"no\"\u003eRESTORED_VM_DISK_NAME\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace.\n - \u003cvar translate=\"no\"\u003eRESTORED_VM_DISK_NAME\u003c/var\u003e: the name of the restored VM disk.\n3. Remove the backup scope label from the PVC. The trailing hyphen after the label key signifies removal:\n\n kubectl label pvc -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \u003cvar translate=\"no\"\u003eRESTORED_VM_DISK_NAME\u003c/var\u003e bpvms/\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e-\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the restored VM.\n4. Optional: To verify that the `bpvms/`\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e label is no longer present, you can re-run the corresponding `kubectl get` command, adjusting for the specific resource type and cluster:\n\n kubectl get pvc -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e"]]