Proxmox is an open-source virtualization platform that allows you to create and manage virtual machines and containers. One common issue faced by users is the "Disk in Use" error when trying to clean up a disk. This error occurs when a device is still in use by the system, preventing you from removing or modifying it. In this guide, we will show you how to resolve this issue by using a few simple commands.
Step 1: Check the Physical Volumes
The first step is to check the physical volumes (PVs) of the disks. To do this, open a terminal on your Proxmox server and run the following command:
If there are any physical volumes that are still in use, you will see an error message stating "File descriptor XX (pipe:[XXXXXX]) leaked on pvs invocation." and the output will look like this:
PV VG Fmt Attr PSize PFree
/dev/sda3 pve-OLD-2EC01C62 lvm2 a-- 1.09t 15.99g
/dev/sdg3 pve lvm2 a-- 1.09t 16.00g
In this example, the disk
"/dev/sda3" is still in use.
Step 2: Remove the Volume Group
The next step is to remove the volume group (VG) of the disk that is still in use. To do this, run the following command:
vgremove <VG name>
In our example, the command would be:
This command will remove the volume group and any logical volumes associated with it. Once this is done, you can proceed to remove the physical volume.
Step 3: Remove the Logical Volumes
After removing the volume group, you need to remove any logical volumes that are associated with it. To do this, run the following command:
This command will list all the logical volumes currently in use. Look for the logical volume that corresponds to the disk you want to remove.
In our example, the output would look like this:
This command lists all active device-mapper devices. In the output, you will see the names of the logical volumes. Identify the logical volumes that belong to the removed VG and remove them using the following command:
dmsetup remove LV-name
LV-name with the name of the logical volume that you want to remove. Repeat this command for all LVs that belong to the removed VG.
Once you have removed all the problematic LVs, you can run the pvs command again to check if the issue has been resolved.
In this guide, we have learned how to clean up the disk on Proxmox that is throwing an error of being in use after a new installation. We identified the problematic VG and removed it, followed by removing all the associated LVs. By following these steps, you should be able to resolve the issue and use your Proxmox installation without any problems.