'Removing disks with gcloud
Trying to remove disks with the gcloud cli, I want to do something like this:
gcloud compute disks delete $(gcloud compute disks list --filter="labels=(some-label)")
The gcloud cli outputs:
The following disks will be deleted:
- [10] in [europe-west4-a]
- [30] in [europe-west4-a]
- [8] in [europe-west4-a]
- [LOCATION] in [europe-west4-a]
- [LOCATION_SCOPE] in [europe-west4-a]
- [NAME] in [europe-west4-a]
- [READY] in [europe-west4-a]
- [SIZE_GB] in [europe-west4-a]
- [STATUS] in [europe-west4-a]
- [TYPE] in [europe-west4-a]
- [europe-west4-a] in [europe-west4-a]
- [disk1] in [europe-west4-a]
- [disk2] in [europe-west4-a]
- [disk3] in [europe-west4-a]
- [disk4] in [europe-west4-a]
- [disk5] in [europe-west4-a]
- [disk6] in [europe-west4-a]
- [pd-standard] in [europe-west4-a]
- [zone] in [europe-west4-a] Do you want to continue (Y/n)?
The command gcloud compute disks list --filter="labels=(some-label)
yields:
disk1 europe-west4-a zone 10 pd-standard READY
disk2 europe-west4-a zone 30 pd-standard READY
disk3 europe-west4-a zone 8 pd-standard READY
disk4 europe-west4-a zone 8 pd-standard READY
disk5 europe-west4-a zone 8 pd-standard READY
disk6 europe-west4-a zone 8 pd-standard READY
My question is, what does all the other fields mean, in the first command? Will it only remove the disks thats intended?
Solution 1:[1]
the correct command to delete disk is gcloud compute disks delete my-disk --zone=us-east1-a replace value with your disk and zone.
If you want to just remove disk from VM instance and dont want to delete, use below command. gcloud compute instances detach-disk INSTANCE_NAME --disk=DISK_NAME
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Vishal Bulbule |