Back to Blog

How To Find and Delete Unattached GCP Disks

If you’re working within the Google Cloud Platform (GCP), locating and deleting unattached GCP disks is a critical to controlling costs and bolstering security. In this post, we'll walk through each step you can take to clean up wasteful resources.


Many organizations have embraced moving their IT infrastructure to the cloud to enjoy benefits like lower overhead costs, increased redundancy, and better scalability. The tradeoff is that these organizations now need to monitor the incremental costs for things like compute time, data transfers, and storage capacity. If you’re working within the Google Cloud Platform (GCP), locating and deleting unattached GCP disks is a critical practice for optimizing your cloud infrastructure spending.

How Do You End Up With Unattached Disks?

Unattached GCP disks are abandoned or orphaned resources that are detached from a service and rendered inoperable. You can end up with an unattached disk, for example, by deleting a Google Compute Engine instance and orphaning a persistent disk that was once attached to it. This is helpful if you want to keep that data, but as an abandoned disk, your IT team will soon forget about its existence.

Why Is It Important To Delete Unattached GCP Disks?

GCP disks change as developers add new items to the GCP environment. Unfortunately, that often leads to disks ending up orphaned, which ends up hurting your company's bottom line. In 2020, idle resources contributed to more than $11 billion in wasted spending.

How Often Should You Remove Unattached GCP Disks?

Ideally, your company should have a GCP resource management plan in place for regular scanning of your GCP. By establishing scheduled removals, you’re consistently locating and removing unattached disks and other orphan resources. The more frequently you conduct your search, the less your organization will have to pay for unused or forgotten GCP resources.

The Blink platform helps IT organizations create practical, cost-effective applications that monitor cloud environments like GCP. That way, you can locate and track any unmanaged resources like unattached GCP disks.

How Do You Find an Unattached GCP Disk?

You can find unattached GCP disks by connecting to Google Cloud and accessing Cloud Shell. You can also use tools like Blink to connect to Cloud Shell API using the service

Disks that are in use have a defined user. To locate disks that do not have an associated user, issue the following command:

gcloud compute disks list --filter="-users:*"

How Do You Delete Unattached GCP Disks?

To delete unattached GCP disks associated with a project, issue the following command in Cloud Shell:

gcloud compute disks delete $(gcloud compute disks list --filter="-users:*" --format "value(name)")

Before removing any resource from GCP, make sure it’s not needed. There may be situations where someone else in your IT department may require the information. The following command can help you locate any unattached GCP resources:

gcloud compute instances list [--project projectID] | grep TERMINATED

The above command is best suited for smaller environments. Teams should set up ongoing monitoring for more extensive operations. It’s also a good idea to use tools capable of more sophisticated detection techniques.

Optimizing GCP Costs Automatically with Blink

By finding a space to consolidate your GCP resource management, you put yourself in a better position to avoid the problem of unattached GCP disks. Automating your ability to locate and delete unused resources increases the efficiency of your operations and lowers your overall costs.

When you create a free Blink account, you can quickly build and schedule an automation to run this task for you regularly. Here's an example in Blink of this specific automation:

Blink automation for unused GCP disk

Create your free Blink account and start optimizing your GCP costs today.

Simplify your cloud operations

Sign up for Blink today

Transform your cloud operations today with a library of purpose-built DevOps and SecOps playbooks and hundreds of integrations.

Sign up