Any way to get a list of Unused Disks?

rafalw

Member
Aug 22, 2017
10
1
8
Hi!
We have ~dozen -hosts PVE cluster that is using two storage nodes, that serves 5 iscsi shares, also some of our hosts have their internal storages.
Migrating VMS between storages and migrating VM's disks between storages is very common in our enviroment, eg. for maintenance.
Currently, i`ve found some abandonned disks, marked as "Unused disk X". Probably my admins didn't use "delete source" option while migrating and forgot to delete afterwards.

Is there a way, to find all "unused disks" wihout checking VM's hardware tab one-by-one? I'm thinking of freeing unnecessarly used storage.
Screenshot_2019-02-20 cp-node4 - Proxmox Virtual Environment.png
 
You could do an grep over all VM Configs.
But this will not work for disks which are unassigned and still existing on the storages itself. So you will only find the disks they are still exists in the config marked unused.
 
yup, looks like it's workin :)
Code:
/etc/pve/nodes# find . -type f -name "*.conf" -exec cat {} \; | grep unused
unused0: ST-Node2.lvm.shared.3:vm-142-disk-1
unused1: ST-Node2.lvm.shared.3:vm-142-disk-2
 
But this will not work for disks which are unassigned and still existing on the storages itself. So you will only find the disks they are still exists in the config marked unused.

Yes, you can also go the other way and finding out what actually is used and compare if to the list of all storages, then you'll have all entries that exist on disk but not in any configuration.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!