Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi aumentare le dimensioni della partizione del disco della macchina virtuale (VM) quando l'istanza VM richiede spazio di archiviazione aggiuntivo o limiti di prestazioni maggiori.
Puoi solo aumentare, e non diminuire, le dimensioni di un disco. Per ridurre le dimensioni del disco, devi crearne uno nuovo con dimensioni inferiori. Finché non elimini il disco originale più grande, ti vengono addebitati entrambi i dischi.
Questa pagina fornisce istruzioni per aumentare le dimensioni dei dischi di avvio e non di avvio.
Prima di iniziare
Per ottenere le autorizzazioni necessarie per eseguire l'espansione del disco, chiedi all'amministratore IAM del progetto di concederti il ruolo Amministratore VirtualMachine del progetto (project-vm-admin) nello spazio dei nomi in cui si trova la VM. Segui i passaggi per
verificare
di disporre delle autorizzazioni necessarie.
Espansione del disco
Segui i passaggi di gcloud o dell'API per espandere le dimensioni del disco.
Il nome dell'immagine da utilizzare per il disco di avvio della nuova VM.
BOOT_DISK_SIZE
Le dimensioni del disco di avvio, ad esempio 20Gi.
Questo valore deve essere sempre maggiore o uguale a minimumDiskSize dell'immagine del disco di avvio.
Attendi che il campo .spec.size venga aggiornato con la nuova dimensione.
Espandi i file system e le partizioni
Dopo aver espanso il dispositivo a blocchi, devi espandere la partizione e il file system del guest in modo che le applicazioni possano utilizzare lo spazio aggiuntivo. Alcuni sistemi operativi lo fanno
automaticamente utilizzando cloud-init.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eYou can increase the size of a virtual machine (VM) disk partition to add more storage space or increase performance limits, but you cannot decrease the size of an existing disk.\u003c/p\u003e\n"],["\u003cp\u003eThis guide provides instructions on how to increase the size of both boot and non-boot disks for your VM.\u003c/p\u003e\n"],["\u003cp\u003eTo expand a disk using the \u003ccode\u003egdcloud\u003c/code\u003e command, use the syntax: \u003ccode\u003egdcloud compute disks resize DISK_NAME --project=PROJECT --size=NEW_SIZE\u003c/code\u003e, replacing the variables with your specific details.\u003c/p\u003e\n"],["\u003cp\u003eTo expand a disk using the API, update the \u003ccode\u003e.spec.size\u003c/code\u003e field of the \u003ccode\u003eVirtualMachineDisk\u003c/code\u003e resource using \u003ccode\u003ekubectl\u003c/code\u003e, making sure to update the necessary variables with the appropriate values.\u003c/p\u003e\n"],["\u003cp\u003eAfter expanding the block device, you must then expand the guest's partition and file system to make the additional space usable to applications, sometimes done automatically by the OS.\u003c/p\u003e\n"]]],[],null,["# Expand VM disks\n\nYou can increase the size of your virtual machine (VM) disk partition when your\nVM instance requires additional storage space or increased performance limits.\n\nYou can only increase, and not decrease, the size of a disk. To decrease the disk\nsize, you must create a new disk with a smaller size. Until you delete the\noriginal, larger disk, you are charged for both disks.\n\nThis page provides instructions to increase the size of both boot and non-boot\ndisks.\n\nBefore you begin\n----------------\n\nTo get the permissions you need to perform disk expansion, ask your Project IAM\nAdmin to grant you the Project VirtualMachine Admin (`project-vm-admin`) role in\nthe namespace where the VM resides. Follow the steps to\n[verify](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/vms/preparation#verify-user-access)\nthat you have the required permissions.\n\nDisk expansion\n--------------\n\nFollow the gdcloud or API steps to expand the disk size. \n\n### gdcloud\n\nExpand the VM disk: \n\n gdcloud compute disks resize \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e --size=\u003cvar translate=\"no\"\u003eNEW_SIZE\u003c/var\u003e\n\n- Replace \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e with the name of the disk.\n\n- Replace \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e with the name of the\n GDC project in which the VM lives.\n\n- Replace \u003cvar translate=\"no\"\u003eNEW_SIZE\u003c/var\u003e with the new size of the disk.\n\n### API\n\n1. Expand the `VirtualMachineDisk` by updating the `.spec.size` field:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eMANAGEMENT_API_SERVER\u003c/var\u003e \\\n apply -n \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e -f - \u003c\u003cEOF\n apiVersion: virtualmachine.gdc.goog/v1\n kind: VirtualMachineDisk\n metadata:\n name: \u003cvar translate=\"no\"\u003eVM_BOOT_DISK_NAME\u003c/var\u003e\n spec:\n source:\n image:\n name: \u003cvar translate=\"no\"\u003eBOOT_DISK_IMAGE_NAME\u003c/var\u003e\n namespace: vm-system\n size: \u003cvar translate=\"no\"\u003eBOOT_DISK_SIZE\u003c/var\u003e\n EOF\n\n Replace the following variables:\n\n2. Wait until the `.spec.size` field updates to the new size.\n\nExpand the file systems and partitions\n--------------------------------------\n\nAfter expanding the block device, you must expand the guest's partition and file\nsystem so that applications can consume the additional space. Some OS's do this\nautomatically using `cloud-init`."]]